Changeset 5545 in orxonox.OLD for trunk/src/lib/util/multi_type.h
- Timestamp:
- Nov 11, 2005, 4:32:28 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/multi_type.h
r5544 r5545 2 2 * @file multi_type.h 3 3 * @brief Definition of ... 4 */4 */ 5 5 6 6 #ifndef _MULTI_TYPE_H … … 29 29 class MultiType { 30 30 31 public: 32 MultiType(); 33 MultiType(bool value); 34 MultiType(int value); 35 MultiType(double value); 36 MultiType(char value); 37 MultiType(const char* value); 38 virtual ~MultiType(); 39 void init(); 31 public: 32 MultiType(); 33 MultiType(bool value); 34 MultiType(int value); 35 MultiType(double value); 36 MultiType(char value); 37 MultiType(const char* value); 38 virtual ~MultiType(); 40 39 41 MultiType operator= (const MultiType& mt);40 MultiType operator= (const MultiType& mt); 42 41 43 void setType(MT_Type);42 void setType(MT_Type); 44 43 45 void setBool(bool value);46 void setInt(int value);47 void setFloat(float value);48 void setChar(char value);49 void setString(const char* value);44 void setBool(bool value); 45 void setInt(int value); 46 void setFloat(float value); 47 void setChar(char value); 48 void setString(const char* value); 50 49 51 inline void setValue(bool value) { this->setBool(value); };52 inline void setValue(int value) { this->setInt(value); };53 inline void setValue(float value) { this->setFloat(value); };54 inline void setValue(char value) { this->setChar(value); };55 inline void setValue(const char* value) { this->setString(value); };50 inline void setValue(bool value) { this->setBool(value); }; 51 inline void setValue(int value) { this->setInt(value); }; 52 inline void setValue(float value) { this->setFloat(value); }; 53 inline void setValue(char value) { this->setChar(value); }; 54 inline void setValue(const char* value) { this->setString(value); }; 56 55 57 /** @returns the Type of the Value stored in this MultiType */58 inline MT_Type getType() const { return this->type; };56 /** @returns the Type of the Value stored in this MultiType */ 57 inline MT_Type getType() const { return this->type; }; 59 58 60 bool getBool() const;61 int getInt() const;62 float getFloat() const;63 char getChar() const;64 const char* getString();59 bool getBool() const; 60 int getInt() const; 61 float getFloat() const; 62 char getChar() const; 63 const char* getString(); 65 64 66 65 67 void debug();66 void debug(); 68 67 69 static const char* MultiTypeToString(MT_Type type);70 static MT_Type StringToMultiType(const char* type);68 static const char* MultiTypeToString(MT_Type type); 69 static MT_Type StringToMultiType(const char* type); 71 70 72 private: 73 MT_Type type; 74 union Type 75 { 76 bool Bool; 77 int Int; 78 float Float; 79 char Char; 80 char* String; 71 private: 72 void init(); 81 73 82 } value;83 74 84 char* storedString; 75 private: 76 MT_Type type; 77 union Type 78 { 79 bool Bool; 80 int Int; 81 float Float; 82 char Char; 83 char* String; 84 85 } value; 86 87 char* storedString; 85 88 }; 86 89
Note: See TracChangeset
for help on using the changeset viewer.