Ignore:
Timestamp:
11/07/14 17:51:01 (10 years ago)
Author:
Maciej Komosinski
Message:

Sources support both 32-bit and 64-bit, and more compilers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/extvalue.h

    r228 r247  
    101101#ifdef EXTVALUEUNION
    102102long data[(EXTVALUEUNIONSIZE+sizeof(long)-1)/sizeof(long)];
    103 long& idata() const {return (long&)data[0];};
     103paInt& idata() const {return (paInt&)data[0];};
    104104double& ddata() const {return *(double*)data;};
    105105ExtObject& odata() const {return *(ExtObject*)data;};
     
    107107#else
    108108union {
    109 long i;
     109paInt i;
    110110double d;
    111111SString *s;
    112112ExtObject *o;
    113113};
    114 long& idata() const {return (long&)i;};
     114paInt& idata() const {return (paInt&)i;};
    115115double& ddata() const {return (double&)d;};
    116116ExtObject& odata() const {return *o;};
     
    123123ExtValue():type(TUnknown){}
    124124~ExtValue() {setEmpty();}
    125 ExtValue(long v) {seti(v);}
     125ExtValue(paInt v) {seti(v);}
    126126ExtValue(double v) {setd(v);}
    127127ExtValue(const SString &v) {sets(v);}
    128128ExtValue(const ExtObject &srco) {seto(srco);}
    129129static ExtValue invalid() {ExtValue v; v.setInvalid(); return v;}
    130 long compare(const ExtValue& src) const;
     130int compare(const ExtValue& src) const;
    131131int operator==(const ExtValue& src) const;
    132132void operator+=(const ExtValue& src);
     
    144144ExtPType getType() {return type;}
    145145void *getObjectTarget(const char* classname,bool warn=true) const;
    146 void setInt(long v) {if (type!=TInt) setri(v); else idata()=v;}
     146void setInt(paInt v) {if (type!=TInt) setri(v); else idata()=v;}
    147147void setDouble(double v) {if (type!=TDouble) setrd(v); else ddata()=v;}
    148148void setString(const SString &v) {if (type!=TString) setrs(v); else sdata()=v;}
    149149void setObject(const ExtObject &src) {if (type!=TObj) setro(src); else odata()=src;}
    150 static long getInt(const char* s);
     150static paInt getInt(const char* s);
    151151static double getDouble(const char* s);
    152 long getInt() const;
     152paInt getInt() const;
    153153double getDouble() const;
    154154SString getString() const;
     
    176176void setr(const ExtValue& src){setEmpty();set(src);}
    177177void set(const ExtValue& src);
    178 void setri(long v) {setEmpty();seti(v);}
     178void setri(paInt v) {setEmpty();seti(v);}
    179179void setrd(double v) {setEmpty();setd(v);}
    180 void seti(long v) {type=TInt;idata()=v;}
     180void seti(paInt v) {type=TInt;idata()=v;}
    181181void setd(double v) {type=TDouble;ddata()=v;}
    182182#ifdef EXTVALUEUNION
Note: See TracChangeset for help on using the changeset viewer.