Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 21, 2008, 10:05:05 PM (16 years ago)
Author:
landauf
Message:

added convert-operators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core/src/util/MultiTypePrimitive.h

    r797 r834  
    5454        MultiTypePrimitive(const MultiTypePrimitive& mtp);
    5555
     56        inline MultiTypePrimitive& operator=(MultiType      value) { this->type_ = MT_null; return *this; }
    5657        inline MultiTypePrimitive& operator=(int            value) { this->setValue(value); return *this; }
    5758        inline MultiTypePrimitive& operator=(unsigned int   value) { this->setValue(value); return *this; }
     
    9596        inline bool operator!=(bool           value) const { return (this->value_.bool_       != value); }
    9697        bool operator!=(const MultiTypePrimitive& mtp) const;
     98
     99        inline operator int()            const { return this->value_.int_;        }
     100        inline operator unsigned int()   const { return this->value_.uint_;       }
     101        inline operator char()           const { return this->value_.char_;       }
     102        inline operator unsigned char()  const { return this->value_.uchar_;      }
     103        inline operator short()          const { return this->value_.short_;      }
     104        inline operator unsigned short() const { return this->value_.ushort_;     }
     105        inline operator long()           const { return this->value_.long_;       }
     106        inline operator unsigned long()  const { return this->value_.ulong_;      }
     107        inline operator float ()         const { return this->value_.float_;      }
     108        inline operator double ()        const { return this->value_.double_;     }
     109        inline operator long double()    const { return this->value_.longdouble_; }
     110        inline operator bool()           const { return this->value_.bool_;       }
    97111
    98112        inline void setValue(int            value) { this->type_ = MT_int;        this->value_.int_        = value; }
Note: See TracChangeset for help on using the changeset viewer.