Changeset 247 for cpp/frams/util/extvalue.h
- Timestamp:
- 11/07/14 17:51:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/extvalue.h
r228 r247 101 101 #ifdef EXTVALUEUNION 102 102 long data[(EXTVALUEUNIONSIZE+sizeof(long)-1)/sizeof(long)]; 103 long& idata() const {return (long&)data[0];};103 paInt& idata() const {return (paInt&)data[0];}; 104 104 double& ddata() const {return *(double*)data;}; 105 105 ExtObject& odata() const {return *(ExtObject*)data;}; … … 107 107 #else 108 108 union { 109 longi;109 paInt i; 110 110 double d; 111 111 SString *s; 112 112 ExtObject *o; 113 113 }; 114 long& idata() const {return (long&)i;};114 paInt& idata() const {return (paInt&)i;}; 115 115 double& ddata() const {return (double&)d;}; 116 116 ExtObject& odata() const {return *o;}; … … 123 123 ExtValue():type(TUnknown){} 124 124 ~ExtValue() {setEmpty();} 125 ExtValue( longv) {seti(v);}125 ExtValue(paInt v) {seti(v);} 126 126 ExtValue(double v) {setd(v);} 127 127 ExtValue(const SString &v) {sets(v);} 128 128 ExtValue(const ExtObject &srco) {seto(srco);} 129 129 static ExtValue invalid() {ExtValue v; v.setInvalid(); return v;} 130 longcompare(const ExtValue& src) const;130 int compare(const ExtValue& src) const; 131 131 int operator==(const ExtValue& src) const; 132 132 void operator+=(const ExtValue& src); … … 144 144 ExtPType getType() {return type;} 145 145 void *getObjectTarget(const char* classname,bool warn=true) const; 146 void setInt( longv) {if (type!=TInt) setri(v); else idata()=v;}146 void setInt(paInt v) {if (type!=TInt) setri(v); else idata()=v;} 147 147 void setDouble(double v) {if (type!=TDouble) setrd(v); else ddata()=v;} 148 148 void setString(const SString &v) {if (type!=TString) setrs(v); else sdata()=v;} 149 149 void setObject(const ExtObject &src) {if (type!=TObj) setro(src); else odata()=src;} 150 static longgetInt(const char* s);150 static paInt getInt(const char* s); 151 151 static double getDouble(const char* s); 152 longgetInt() const;152 paInt getInt() const; 153 153 double getDouble() const; 154 154 SString getString() const; … … 176 176 void setr(const ExtValue& src){setEmpty();set(src);} 177 177 void set(const ExtValue& src); 178 void setri( longv) {setEmpty();seti(v);}178 void setri(paInt v) {setEmpty();seti(v);} 179 179 void setrd(double v) {setEmpty();setd(v);} 180 void seti( longv) {type=TInt;idata()=v;}180 void seti(paInt v) {type=TInt;idata()=v;} 181 181 void setd(double v) {type=TDouble;ddata()=v;} 182 182 #ifdef EXTVALUEUNION
Note: See TracChangeset
for help on using the changeset viewer.