mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
CtrlCore: bool support to Ref
git-svn-id: svn://ultimatepp.org/upp/trunk@3545 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c4066a4e4b
commit
57a085b52a
2 changed files with 6 additions and 3 deletions
|
|
@ -237,15 +237,14 @@ struct Ref::ValueRef : public RefManager {
|
|||
virtual void SetNull(void *ptr) { *(Value *) ptr = Null; }
|
||||
};
|
||||
|
||||
|
||||
Ref::Ref(String& s) { ptr = &s; m = &Single< RichRef<String> >(); }
|
||||
Ref::Ref(WString& s) { ptr = &s; m = &Single< RichRef<WString> >(); }
|
||||
Ref::Ref(int& i) { ptr = &i; m = &Single< RichRef<int> >(); }
|
||||
Ref::Ref(int64& i) { ptr = &i; m = &Single< RichRef<int64> >(); }
|
||||
Ref::Ref(double& d) { ptr = &d; m = &Single< RichRef<double> >(); }
|
||||
Ref::Ref(bool& b) { ptr = &b; m = &Single< RichRef<bool> >(); }
|
||||
Ref::Ref(Date& d) { ptr = &d; m = &Single< RichRef<Date> >(); }
|
||||
Ref::Ref(Time& t) { ptr = &t; m = &Single< RichRef<Time> >(); }
|
||||
|
||||
Ref::Ref(Value& v) { ptr = &v; m = &Single< ValueRef >(); }
|
||||
|
||||
// ----------------------------------
|
||||
|
|
|
|||
|
|
@ -555,14 +555,16 @@ protected:
|
|||
|
||||
public:
|
||||
dword GetType() const { return m ? m->GetType() : VOID_V; }
|
||||
operator Value() const { return m ? m->GetValue(ptr) : Value(); }
|
||||
bool IsNull() const { return m ? m->IsNull(ptr) : true; }
|
||||
|
||||
void *GetVoidPtr() const { return ptr; }
|
||||
|
||||
void SetNull() { if(m) m->SetNull(ptr); }
|
||||
Value GetValue() const { return m ? m->GetValue(ptr) : Value(); }
|
||||
void SetValue(const Value& v) { ASSERT(m); m->SetValue(ptr, v); }
|
||||
|
||||
operator Value() const { return GetValue(); }
|
||||
Value operator~() const { return GetValue(); }
|
||||
Ref& operator=(const Value& v) { SetValue(v); return *this; }
|
||||
|
||||
Ref(String& s);
|
||||
|
|
@ -570,6 +572,7 @@ public:
|
|||
Ref(int& i);
|
||||
Ref(int64& i);
|
||||
Ref(double& d);
|
||||
Ref(bool& b);
|
||||
Ref(Date& d);
|
||||
Ref(Time& t);
|
||||
Ref(Value& v);
|
||||
|
|
@ -588,6 +591,7 @@ inline WString& RefWString(Ref f) { return GetRef<WString>(f); }
|
|||
inline int& RefInt(Ref f) { return GetRef<int>(f); }
|
||||
inline int64& RefInt64(Ref f) { return GetRef<int64>(f); }
|
||||
inline double& RefDouble(Ref f) { return GetRef<double>(f); }
|
||||
inline bool& RefBool(Ref f) { return GetRef<bool>(f); }
|
||||
inline Date& RefDate(Ref f) { return GetRef<Date>(f); }
|
||||
inline Time& RefTime(Ref f) { return GetRef<Time>(f); }
|
||||
inline Value& RefValue(Ref f) { ASSERT(f.GetType() == VALUE_V);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue