mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
Core: Improving Ref
git-svn-id: svn://ultimatepp.org/upp/trunk@4665 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
3415d44f3c
commit
dd3a28d1dd
3 changed files with 124 additions and 19 deletions
|
|
@ -49,6 +49,7 @@ template<> inline dword ValueTypeNo(const String*) { return STRING_V; }
|
|||
template<> inline dword ValueTypeNo(const WString*) { return WSTRING_V; }
|
||||
template<> inline dword ValueTypeNo(const Date*) { return DATE_V; }
|
||||
template<> inline dword ValueTypeNo(const Time*) { return TIME_V; }
|
||||
template<> inline dword ValueTypeNo(const Value*) { return VALUE_V; }
|
||||
|
||||
template <class T, dword type, class B = EmptyClass>
|
||||
class ValueType : public B {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ struct RefManager {
|
|||
virtual bool IsNull(const void *) { return false; }
|
||||
virtual void SetValue(void *, const Value& v) { NEVER(); }
|
||||
virtual void SetNull(void *) { NEVER(); }
|
||||
virtual void Assign(void *t, const void *s) { NEVER(); }
|
||||
virtual ~RefManager() {}
|
||||
};
|
||||
|
||||
|
|
@ -98,7 +97,6 @@ struct StdRef : public RefManager {
|
|||
virtual int GetType() { return GetValueTypeNo<T>(); }
|
||||
virtual bool IsNull(const void *p) { return UPP::IsNull(*(T *) p); }
|
||||
virtual void SetNull(void *p) { UPP::SetNull(*(T *)p); }
|
||||
void Assign(void *t, const void *s) { *(T*)t = *(T*)s; }
|
||||
virtual ~StdRef() {}
|
||||
};
|
||||
|
||||
|
|
@ -126,8 +124,6 @@ public:
|
|||
operator Value() const { return GetValue(); }
|
||||
Value operator~() const { return GetValue(); }
|
||||
Ref& operator=(const Value& v) { SetValue(v); return *this; }
|
||||
// Ref& operator=(const Ref& r);
|
||||
// Ref& operator=(ValueTypeRef& r);
|
||||
|
||||
Ref(String& s);
|
||||
Ref(WString& s);
|
||||
|
|
@ -176,21 +172,6 @@ Ref::Ref(const ValueTypeRef& r)
|
|||
ptr = r.ptr;
|
||||
m = r.m;
|
||||
}
|
||||
/*
|
||||
Ref& Ref::operator=(ValueTypeRef& r)
|
||||
{
|
||||
ASSERT(r.m->GetType() == GetType());
|
||||
m->Assign(ptr, r.ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Ref& Ref::operator=(const Ref& r)
|
||||
{
|
||||
ASSERT(r.m->GetType() == GetType());
|
||||
m->Assign(ptr, r.ptr);
|
||||
return *this;
|
||||
}
|
||||
*/
|
||||
|
||||
template <class T, dword type, class B>
|
||||
ValueType<T, type, B>::operator ValueTypeRef()
|
||||
|
|
|
|||
123
uppsrc/Core/src.tpp/Ref$en-us.tpp
Normal file
123
uppsrc/Core/src.tpp/Ref$en-us.tpp
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
topic "class Ref : private Moveable<Ref> ";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
[0 $$3,0#96390100711032703541132217272105:end]
|
||||
[H6;0 $$4,0#05600065144404261032431302351956:begin]
|
||||
[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item]
|
||||
[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement]
|
||||
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
|
||||
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
|
||||
[b42;2 $$9,9#13035079074754324216151401829390:normal]
|
||||
[{_}
|
||||
[s1;:Ref`:`:class: [@(0.0.255)3 class][3 _][*3 Ref][3 _:_][@(0.0.255)3 private][3 _][*@3;3 Moveable][3 <
|
||||
][*3 Ref][3 >_]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s0;*@7;4%% &]
|
||||
[ {{10000@(113.42.0) [s0;%% [*@7;4 Title]]}}&]
|
||||
[s0;i448;a25;kKO9;@(0.0.255) &]
|
||||
[ {{10000F(128)G(128)@1 [s0;%% [* Function List]]}}&]
|
||||
[s0;i448;a25;kKO9;:noref:@(0.0.255) &]
|
||||
[ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&]
|
||||
[s0; &]
|
||||
[ {{10000F(128)G(128)@1 [s0;%% [* Constructor detail]]}}&]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:GetType`(`)const: [_^dword^ dword]_[* GetType]()_[@(0.0.255) const]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:IsNull`(`)const: [@(0.0.255) bool]_[* IsNull]()_[@(0.0.255) const]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:GetVoidPtr`(`)const: [@(0.0.255) void]_`*[* GetVoidPtr]()_[@(0.0.255) const]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Is`(`)const: [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[@(0.0.255) bool]_
|
||||
[* Is]()_[@(0.0.255) const]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Get`(`)const: [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[*@4 T][@(0.0.255) `&
|
||||
]_[* Get]()_[@(0.0.255) const]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:SetNull`(`): [@(0.0.255) void]_[* SetNull]()&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:GetValue`(`)const: [_^Value^ Value]_[* GetValue]()_[@(0.0.255) const]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:SetValue`(const Value`&`): [@(0.0.255) void]_[* SetValue]([@(0.0.255) const]_[_^Value^ V
|
||||
alue][@(0.0.255) `&]_[*@3 v])&]
|
||||
[s2;%% [%-*@3 v] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:operator Value`(`)const: [* operator_Value]()_[@(0.0.255) const]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:operator`~`(`)const: [_^Value^ Value]_[* operator`~]()_[@(0.0.255) const]&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:operator`=`(const Value`&`): [_^Ref^ Ref][@(0.0.255) `&]_[* operator`=]([@(0.0.255) c
|
||||
onst]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v])&]
|
||||
[s2;%% [%-*@3 v] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(String`&`): [* Ref]([_^String^ String][@(0.0.255) `&]_[*@3 s])&]
|
||||
[s2;%% [%-*@3 s] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(WString`&`): [* Ref]([_^WString^ WString][@(0.0.255) `&]_[*@3 s])&]
|
||||
[s2;%% [%-*@3 s] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(int`&`): [* Ref]([@(0.0.255) int`&]_[*@3 i])&]
|
||||
[s2;%% [%-*@3 i] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(int64`&`): [* Ref]([_^int64^ int64][@(0.0.255) `&]_[*@3 i])&]
|
||||
[s2;%% [%-*@3 i] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(double`&`): [* Ref]([@(0.0.255) double`&]_[*@3 d])&]
|
||||
[s2;%% [%-*@3 d] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(bool`&`): [* Ref]([@(0.0.255) bool`&]_[*@3 b])&]
|
||||
[s2;%% [%-*@3 b] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(Date`&`): [* Ref]([_^Date^ Date][@(0.0.255) `&]_[*@3 d])&]
|
||||
[s2;%% [%-*@3 d] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(Time`&`): [* Ref]([_^Time^ Time][@(0.0.255) `&]_[*@3 t])&]
|
||||
[s2;%% [%-*@3 t] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(Value`&`): [* Ref]([_^Value^ Value][@(0.0.255) `&]_[*@3 v])&]
|
||||
[s2;%% [%-*@3 v] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(void`*`,RefManager`*`): [* Ref]([@(0.0.255) void]_`*[*@3 `_ptr],
|
||||
[_^RefManager^ RefManager]_`*[*@3 `_m])&]
|
||||
[s2;%% [%-*@3 `_ptr] [%-*@3 `_m] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(const ValueTypeRef`&`): [* Ref]([@(0.0.255) const]_[_^ValueTypeRef^ ValueT
|
||||
ypeRef][@(0.0.255) `&]_[*@3 r])&]
|
||||
[s2;%% [%-*@3 r] .&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Ref`:`:Ref`(`): [* Ref]()&]
|
||||
[s2;%% &]
|
||||
[s3; &]
|
||||
[s0;%% ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue