Changeset 5544 in orxonox.OLD for trunk/src/lib/util/multi_type.cc
- Timestamp:
- Nov 11, 2005, 3:39:27 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/multi_type.cc
r5541 r5544 147 147 148 148 149 bool MultiType::getBool() 149 bool MultiType::getBool() const 150 150 { 151 151 // default case: … … 162 162 163 163 164 int MultiType::getInt() 164 int MultiType::getInt() const 165 165 { 166 166 // default case: … … 183 183 184 184 185 float MultiType::getFloat() 185 float MultiType::getFloat() const 186 186 { 187 187 // default case: … … 204 204 205 205 206 char MultiType::getChar() 206 char MultiType::getChar() const 207 207 { 208 208 // default case: … … 253 253 } 254 254 255 256 void MultiType::debug() 257 { 258 printf("MultiType of Type: %s is: BOOL: %d, INT: %d, FLOAT: %f, CHAR: %c, STRING %s\n", 259 MultiType::MultiTypeToString(this->type), 260 this->getBool(), 261 this->getInt(), 262 this->getFloat(), 263 this->getChar(), 264 this->getString() 265 ); 266 267 268 } 269 270 const char* MultiType::MultiTypeToString(MT_Type type) 271 { 272 switch (type) 273 { 274 default: 275 return "NONE"; 276 case MT_BOOL: 277 return "bool"; 278 case MT_INT: 279 return "int"; 280 case MT_FLOAT: 281 return "float"; 282 case MT_CHAR: 283 return "char"; 284 case MT_STRING: 285 return "string"; 286 } 287 } 288 289 MT_Type MultiType::StringToMultiType(const char* type) 290 { 291 if (!strncmp(type, "bool", 4)) 292 return MT_BOOL; 293 if (!strncmp(type, "int", 3)) 294 return MT_INT; 295 if (!strncmp(type, "float", 5)) 296 return MT_FLOAT; 297 if (!strncmp(type, "char", 4)) 298 return MT_CHAR; 299 if (!strncmp(type, "string", 6)) 300 return MT_STRING; 301 }
Note: See TracChangeset
for help on using the changeset viewer.