- Timestamp:
- Mar 8, 2006, 10:46:37 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r7198 r7199 142 142 143 143 LoadParam(root, "bind-node", this, Element2D, setBindNode) 144 .describe("sets a node, this 2D-Element should be shown upon (name of the node)") 145 .defaultValues(NULL); 144 .describe("sets a node, this 2D-Element should be shown upon (name of the node)"); 146 145 147 146 LoadParam(root, "visibility", this, Element2D, setVisibility) -
trunk/src/lib/lang/class_list.cc
r7198 r7199 31 31 SHELL_COMMAND_STATIC(debug, ClassList, ClassList::debugS) 32 32 ->describe("Shows all registered classes, if param1: is a valid ClassName only values of this class are shown. param2: how much output") 33 ->defaultValues( NULL, 1);33 ->defaultValues(MT_NULL, 1); 34 34 #endif 35 35 -
trunk/src/lib/particles/particle_system.cc
r7198 r7199 128 128 LoadParam(root, "precache", this, ParticleSystem, precache) 129 129 .describe("Precaches the ParticleSystem for %1 seconds, %2 times per Second") 130 .defaultValues(1 , 25);130 .defaultValues(1.0, 25.0); 131 131 } 132 132 -
trunk/src/lib/physics/fields/field.cc
r7198 r7199 62 62 LoadParam(root, "magnitude", this, Field, setMagnitude) 63 63 .describe("sets the magnitude of this Field") 64 .defaultValues(1 );64 .defaultValues(1.0f); 65 65 66 66 LoadParam(root, "attenuation", this, Field, setAttenuation) -
trunk/src/lib/shell/shell_command.cc
r7198 r7199 39 39 { 40 40 this->setClassID(CL_SHELL_COMMAND, "ShellCommand"); 41 PRINTF(5)("create shellcommand %s %s\n", commandName, className); 41 42 this->setName(commandName); 42 43 this->description = NULL; -
trunk/src/lib/util/executor/executor.cc
r7198 r7199 45 45 this->setClassID(CL_EXECUTOR, "Executor"); 46 46 47 48 47 // What Parameters have we got 49 48 this->defaultValue[0] = param0; … … 53 52 this->defaultValue[4] = param4; 54 53 54 this->paramCount = 0; 55 55 for (unsigned int i = 0; i < FUNCTOR_MAX_ARGUMENTS; i++) 56 56 { … … 61 61 } 62 62 } 63 assert (paramCount <= FUNCTOR_MAX_ARGUMENTS);64 63 } 65 64 … … 109 108 { 110 109 if (*value[i] != MT_NULL) 111 { 112 if (this->defaultValue[i].getType() == value[i]->getType()) 113 { 114 this->defaultValue[i] = *value[i]; 115 } 116 else 117 { 118 PRINTF(1)("Unable to set this Value, as it is not of type %s\n", MultiType::MultiTypeToString(this->defaultValue[i].getType())); 119 } 120 } 110 this->defaultValue[i].setValueOf(*value[i]); 121 111 } 122 112 return this; -
trunk/src/lib/util/executor/executor.h
r7198 r7199 13 13 #include "substring.h" 14 14 #include "functor_list.h" //< MUST BE INCLUDED HERE AT LEAST ONCE. 15 16 #include <stdarg.h>17 15 18 16 //! an enumerator for the definition of the Type. … … 89 87 #define l_FLOAT_DEFGRAB(i) this->defaultValue[i].getFloat() 90 88 //! where to chek for default STRING values 91 #define l_ STRING_DEFGRAB(i) this->defaultValue[i].getString()89 #define l_CSTRING_DEFGRAB(i) this->defaultValue[i].getCString() 92 90 93 91 ////////////////////////// -
trunk/src/lib/util/executor/functor_list.h
r5995 r7199 21 21 l_SHORT: short 22 22 l_FLOAT: float 23 l_ STRING: const char*23 l_CSTRING: const char* 24 24 l_XML_ELEM: TiXmlElement* 25 25 */ … … 60 60 // #define l_SHORT_FUNC atoi //!< The function to parse a SHORT 61 61 // #define l_SHORT_NAME "short" //!< The name of a SHORT 62 // #define l_SHORT_PARAMParameterShort //!< the type of the parameter SHORT62 // #define l_SHORT_PARAM ParameterShort //!< the type of the parameter SHORT 63 63 // #define l_SHORT_DEFAULT 0 //!< a default Value for a SHORT 64 64 … … 74 74 //#define l_VECTOR_DEFAULT Vector(0,0,0) //!< Default value for a VECTOR 75 75 76 #define l_STRING_TYPE const char* //!< The type of a STRING 76 #define l_CSTRING_TYPE const char* //!< The type of a STRING 77 #define l_CSTRING_FUNC isString //!< The function to parse a STRING 78 #define l_CSTRING_NAME "string" //!< The name of a STRING 79 #define l_CSTRING_PARAM MT_STRING //!< the type of the parameter STRING 80 #define l_CSTRING_DEFAULT "" //!< a default Value for an STRING 81 82 #define l_STRING_TYPE const std::string& //!< The type of a STRING 77 83 #define l_STRING_FUNC isString //!< The function to parse a STRING 78 84 #define l_STRING_NAME "string" //!< The name of a STRING … … 93 99 FUNCTOR_LIST(0)(); 94 100 //! makes functions with one string 95 FUNCTOR_LIST(1)(l_ STRING);101 FUNCTOR_LIST(1)(l_CSTRING); 96 102 //! makes functions with two strings 97 FUNCTOR_LIST(2)(l_ STRING, l_STRING);103 FUNCTOR_LIST(2)(l_CSTRING, l_CSTRING); 98 104 //! makes functions with three strings 99 FUNCTOR_LIST(3)(l_ STRING, l_STRING, l_STRING);105 FUNCTOR_LIST(3)(l_CSTRING, l_CSTRING, l_CSTRING); 100 106 //! makes functions with four strings 101 FUNCTOR_LIST(4)(l_ STRING, l_STRING, l_STRING, l_STRING);107 FUNCTOR_LIST(4)(l_CSTRING, l_CSTRING, l_CSTRING, l_CSTRING); 102 108 103 109 //! makes functions with one bool … … 135 141 136 142 //! mixed values: 137 FUNCTOR_LIST(2)(l_ STRING, l_FLOAT);143 FUNCTOR_LIST(2)(l_CSTRING, l_FLOAT); 138 144 FUNCTOR_LIST(2)(l_UINT, l_LONG); 139 FUNCTOR_LIST(2)(l_ STRING, l_UINT);145 FUNCTOR_LIST(2)(l_CSTRING, l_UINT); 140 146 141 FUNCTOR_LIST(3)(l_ STRING, l_FLOAT, l_UINT);147 FUNCTOR_LIST(3)(l_CSTRING, l_FLOAT, l_UINT); 142 148 143 149 -
trunk/src/lib/util/loading/resource_manager.cc
r7196 r7199 451 451 tmpResource->param[0] = param0; 452 452 tmpResource->param[1] = param1; 453 tmpResource->pointer = new MD2Data(fullName, tmpResource->param[0].get String(), tmpResource->param[1].getFloat());453 tmpResource->pointer = new MD2Data(fullName, tmpResource->param[0].getCString(), tmpResource->param[1].getFloat()); 454 454 } 455 455 break; … … 520 520 { 521 521 MultiType param = param0; /// HACK 522 char* secFullName = ResourceManager::getFullName(param.get String());522 char* secFullName = ResourceManager::getFullName(param.getCString()); 523 523 if (ResourceManager::isFile(secFullName)) 524 524 { … … 747 747 int len = strlen(ResourceManager::ResourceTypeToChar(this->resourceList[i]->type)); 748 748 len += strlen(this->resourceList[i]->name); 749 if (this->resourceList[i]->param[0].get String()) len += strlen(this->resourceList[i]->param[0].getString()) +1;750 if (this->resourceList[i]->param[1].get String()) len += strlen(this->resourceList[i]->param[1].getString()) +1;751 if (this->resourceList[i]->param[2].get String()) len += strlen(this->resourceList[i]->param[2].getString()) +1;749 if (this->resourceList[i]->param[0].getCString()) len += strlen(this->resourceList[i]->param[0].getCString()) +1; 750 if (this->resourceList[i]->param[1].getCString()) len += strlen(this->resourceList[i]->param[1].getCString()) +1; 751 if (this->resourceList[i]->param[2].getCString()) len += strlen(this->resourceList[i]->param[2].getCString()) +1; 752 752 len += 10; 753 753 char* tmp = new char[len]; … … 756 756 strcat(tmp,","); 757 757 strcat (tmp, this->resourceList[i]->name); 758 if (this->resourceList[i]->param[0].get String() && this->resourceList[i]->param[0].getString() != '\0')758 if (this->resourceList[i]->param[0].getCString() && this->resourceList[i]->param[0].getCString() != '\0') 759 759 { 760 760 strcat(tmp,","); 761 strcat( tmp, this->resourceList[i]->param[0].get String());762 } 763 if (this->resourceList[i]->param[1].get String() && this->resourceList[i]->param[1].getString() != '\0')761 strcat( tmp, this->resourceList[i]->param[0].getCString()); 762 } 763 if (this->resourceList[i]->param[1].getCString() && this->resourceList[i]->param[1].getCString() != '\0') 764 764 { 765 765 strcat(tmp,","); 766 strcat( tmp, this->resourceList[i]->param[1].get String());767 } 768 if (this->resourceList[i]->param[2].get String() && this->resourceList[i]->param[2].getString() != '\0')766 strcat( tmp, this->resourceList[i]->param[1].getCString()); 767 } 768 if (this->resourceList[i]->param[2].getCString() && this->resourceList[i]->param[2].getCString() != '\0') 769 769 { 770 770 strcat(tmp,","); 771 strcat( tmp, this->resourceList[i]->param[2].get String());771 strcat( tmp, this->resourceList[i]->param[2].getCString()); 772 772 } 773 773 return tmp; -
trunk/src/lib/util/multi_type.cc
r7197 r7199 23 23 #include <string.h> 24 24 #include <stdio.h> 25 #include <sstream> 25 26 26 27 #ifdef DEBUG … … 31 32 32 33 /** 33 * creates a multiType without any stored value at all.34 * @brief creates a multiType without any stored value at all. 34 35 */ 35 36 MultiType::MultiType(MT_Type type) … … 39 40 } 40 41 /** 41 * creates a multiType out of a boolean42 * @brief creates a multiType out of a boolean 42 43 * @param value the Value of this MulitType 43 44 */ … … 49 50 50 51 /** 51 * creates a multiType out of an integer52 * @brief creates a multiType out of an integer 52 53 * @param value the Value of this MulitType 53 54 */ … … 59 60 60 61 /** 61 * creates a multiType out of a float (double)62 * @brief creates a multiType out of a float (double) 62 63 * @param value the Value of this MulitType 63 64 */ … … 69 70 70 71 /** 71 * creates a multiType out of a char72 * @brief creates a multiType out of a char 72 73 * @param value the Value of this MulitType 73 74 */ … … 79 80 80 81 /** 81 * creates a multiType out of aString82 * @brief creates a multiType out of a C-String 82 83 * @param value the Value of this MulitType 83 84 */ … … 88 89 } 89 90 91 /** 92 * @brief creates a multiType out of a String 93 * @param value the Value of this MulitType 94 */ 95 MultiType::MultiType(const std::string& value) 96 { 97 this->init(); 98 this->setString(value); 99 } 100 101 /** 102 * @brief constructs a new MultiType from another one (copy) 103 */ 90 104 MultiType::MultiType(const MultiType& multiType) 91 105 { 92 this->init();93 106 *this = multiType; 94 107 } 95 108 96 109 /** 97 * standard deconstructor110 * @brief standard deconstructor 98 111 */ 99 112 MultiType::~MultiType () 100 { 101 if (this->storedString != NULL) 102 delete[] this->storedString; 103 } 104 105 /** 106 * copy Constructor 113 { } 114 115 /** 116 * @brief copy operator 107 117 * @param mt: the entity to copy 108 * @returns aCopy of itself. (strings inside are copied as well)118 * @returns A Copy of itself. (strings inside are copied as well) 109 119 */ 110 120 MultiType& MultiType::operator= (const MultiType& mt) … … 112 122 this->type = mt.type; 113 123 this->value = mt.value; 114 if (mt.type == MT_STRING && mt.storedString != NULL) 115 { 116 this->setString(mt.storedString); 117 } 118 else 119 this->storedString = NULL; 124 this->storedString = mt.storedString; 125 120 126 return *this; 121 127 } … … 148 154 return (this->value.Float == mt.value.Float); 149 155 case MT_STRING: 150 if (this->value.String != NULL && mt.value.String != NULL) 151 return (!strcmp(this->value.String, mt.value.String)); 152 else 153 return (this->value.String == NULL && mt.value.String == NULL); 154 } 155 } 156 157 /** 158 * @brief checks if the internal value matches the boolean value. 159 * @param value to check against this one 160 * @returns true on match. false otherwise 156 return (this->storedString == mt.storedString); 157 } 158 } 159 160 161 /** 162 * @brief initializes the MultiType 163 */ 164 void MultiType::init() 165 { 166 this->type = MT_NULL; 167 this->value.Float = 0.0f; 168 } 169 170 171 /** 172 * @brief sets the type of this MultiType and resets to the default value 173 * @param type the new Type 174 */ 175 void MultiType::setType(MT_Type type) 176 { 177 if (this->type == type) 178 return; 179 180 switch (type) 181 { 182 case MT_BOOL: 183 this->setBool(this->getBool()); 184 break; 185 case MT_INT: 186 this->setInt(this->getInt()); 187 break; 188 case MT_FLOAT: 189 this->setFloat(this->getFloat()); 190 break; 191 case MT_CHAR: 192 this->setChar(this->getChar()); 193 break; 194 case MT_STRING: 195 this->setString(this->getString()); 196 break; 197 } 198 } 199 200 /** 201 * @brief sets the Value of mt without changing the type of this MultiType 202 * @param mt: the MultiType to get the value from 161 203 * 162 * Two MultiType match if and only if 163 * 1. the stored values match the given Value 164 */ 165 bool MultiType::operator==(const char* value) const 166 { 167 if (this->value.String != NULL && value != NULL) 168 return (!strcmp(this->value.String, value)); 169 else 170 return (this->value.String == NULL && value == NULL); 171 } 172 173 174 /** 175 * initializes the MultiType 176 */ 177 void MultiType::init() 178 { 179 this->type = MT_NULL; 180 this->storedString = NULL; 181 this->value.Float = 0.0f; 182 } 183 184 185 /** 186 * sets the type of this MultiType and resets to the default value 187 * @param type the new Type 188 */ 189 void MultiType::setType(MT_Type type) 190 { 191 if (this->type != type) 192 this->type = type; 193 } 194 195 /** 196 * sets a new Value to the MultiType 204 * This is a pure Value copy. The current type will be preserved. 205 * 206 * @TODO speedup 207 */ 208 void MultiType::setValueOf(const MultiType& mt) 209 { 210 MT_Type prevType = this->type; 211 212 *this = mt; 213 this->setType(prevType); 214 } 215 216 217 /** 218 * @brief sets a new Value to the MultiType 197 219 * @param value the new Value as a bool 198 220 */ … … 204 226 205 227 /** 206 * sets a new Value to the MultiType228 * @brief sets a new Value to the MultiType 207 229 * @param value the new Value as an int 208 230 */ … … 214 236 215 237 /** 216 * sets a new Value to the MultiType238 * @brief sets a new Value to the MultiType 217 239 * @param value the new Value as a float 218 240 */ … … 224 246 225 247 /** 226 * sets a new Value to the MultiType248 * @brief sets a new Value to the MultiType 227 249 * @param value the new Value as a char 228 250 */ … … 234 256 235 257 /** 236 * sets a new Value to the MultiType258 * @brief sets a new Value to the MultiType 237 259 * @param value the new Value as a String 238 260 */ 239 void MultiType::setString(const char*value)261 void MultiType::setString(const std::string& value) 240 262 { 241 263 this->type = MT_STRING; 242 243 if (this->storedString != NULL) 244 delete[] this->storedString; 245 246 if (value == NULL) 247 { 248 this->storedString = new char[1]; 249 this->storedString[0] = '\0'; 250 this->value.String = this->storedString; 251 return; 252 } 253 else 254 { 255 this->storedString = new char[strlen(value)+1]; 256 strcpy(storedString, value); 257 this->value.String = this->storedString; 258 } 259 } 260 261 262 263 264 264 this->storedString = value; 265 } 266 267 268 /************************** 269 *** RETRIEVAL FUNCTIONS *** 270 **************************/ 265 271 /** 266 272 * @returns the Value of this MultiType as a int … … 275 281 else if (this->type & MT_FLOAT) return (this->value.Float == 0.0f)? false : true; 276 282 else if (this->type & MT_CHAR) return (this->value.Char == '\0')? false : true; 277 else if (this->type & MT_STRING && this->value.String != NULL) return (!strncmp(this->value.String, "true", 4) || !strncmp(this->value.String, "TRUE", 4) || !strncmp(this->value.String, "1", 1))? true : false; //! @TODO make this better. 283 else if (this->type & MT_STRING) return (this->storedString == "true" || 284 this->storedString == "TRUE" || 285 this->storedString != "0"); //! @TODO make this better... 278 286 279 287 return false; … … 291 299 else if (this->type & MT_FLOAT) return (int) this->value.Float; 292 300 else if (this->type & MT_CHAR) return (int) this->value.Char; 293 else if (this->type & MT_STRING && this->value.String != NULL) { 301 else if (this->type & MT_STRING) 302 { 294 303 char* endPtr = NULL; 295 int result = strtol(this-> value.String, &endPtr, 10);296 if ( endPtr >= this-> value.String && endPtr < this->value.String + strlen(this->value.String))304 int result = strtol(this->storedString.c_str(), &endPtr, 10); 305 if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + strlen(this->storedString.c_str())) 297 306 return 0; 298 307 else 299 308 return result; 300 309 } 301 302 310 return 0; 303 311 } 304 312 313 305 314 /** 306 315 * @returns the Value of this MultiType as a float … … 308 317 float MultiType::getFloat() const 309 318 { 310 // default case:319 // default case: 311 320 if (this->type & MT_FLOAT) 312 321 return this->value.Float; … … 314 323 else if (this->type & MT_INT) return (float) this->value.Int; 315 324 else if (this->type & MT_CHAR) return (float) this->value.Char; 316 else if (this->type & MT_STRING && this->value.String != NULL) { 325 else if (this->type & MT_STRING) 326 { 317 327 char* endPtr = NULL; 318 double result = strtod(this-> value.String, &endPtr);319 if ( endPtr >= this-> value.String && endPtr < this->value.String + strlen(this->value.String))328 double result = strtod(this->storedString.c_str(), &endPtr); 329 if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + strlen(this->storedString.c_str())) 320 330 return 0.0f; 321 331 else 322 332 return result; 323 333 } 324 325 334 return 0.0f; 326 335 } … … 332 341 char MultiType::getChar() const 333 342 { 334 // default case:343 // default case: 335 344 if (this->type & MT_INT) 336 345 return this->value.Int; … … 338 347 else if (this->type & MT_INT) return (int) this->value.Int; 339 348 else if (this->type & MT_FLOAT) return (char) this->value.Float; 340 else if (this->type & MT_STRING && this->value.String != NULL) return *this->value.String;349 else if (this->type & MT_STRING) return this->storedString[0]; 341 350 342 351 return '\0'; 343 352 } 344 353 354 345 355 /** 346 356 * @returns the Value of this MultiType as a String 347 357 */ 348 const char* MultiType::getString() 349 { 350 // default case:358 std::string MultiType::getString() const 359 { 360 // default case: 351 361 if (this->type & MT_STRING) 352 return (this->value.String != NULL)? this->value.String : "";362 return this->storedString; 353 363 else 354 364 { 355 365 if (this->type & MT_BOOL) return (this->value.Bool)? "true" : "false"; 356 char tmpString[128]; 357 if (this->storedString != NULL) 358 { 359 delete[] this->storedString; 360 this->storedString = NULL; 361 } 366 362 367 if (this->type & MT_CHAR) 363 368 { 364 this->storedString = new char[2];365 t his->storedString[0] = this->value.Char;366 t his->storedString[1] = '\0';367 return t his->storedString;369 char tmpString[2]; 370 tmpString[0] = this->value.Char; 371 tmpString[1] = '\0'; 372 return tmpString; 368 373 } 369 374 else if (this->type & MT_INT) 370 375 { 376 char tmpString[32]; 371 377 sprintf(tmpString, "%d", this->value.Int); 372 this->storedString = new char[strlen(tmpString)+1]; 373 strcpy (this->storedString, tmpString); 374 return this->storedString; 378 return tmpString; 375 379 } 376 if (this->type & MT_FLOAT)380 else if (this->type & MT_FLOAT) 377 381 { 382 char tmpString[64]; 378 383 sprintf(tmpString, "%f", this->value.Float); 379 this->storedString = new char[strlen (tmpString)+1]; 380 strcpy (this->storedString, tmpString); 381 return this->storedString; 384 return tmpString; 382 385 } 383 386 } 384 385 387 return ""; 386 388 } 387 389 388 390 /** 389 * prints out some nice debug output 390 */ 391 void MultiType::debug() 391 * @returns a formated c-string of the held value 392 */ 393 const char* MultiType::getCString() 394 { 395 if (this->type & MT_STRING) return this->storedString.c_str(); 396 else 397 { 398 this->storedString = this->getString(); 399 return this->storedString.c_str(); 400 } 401 } 402 403 /** 404 * @brief prints out some nice debug output 405 */ 406 void MultiType::debug() const 392 407 { 393 408 #ifdef DEBUG … … 396 411 printf 397 412 #endif 398 ("MultiType of Type '%s' :: Values: BOOL: '%d', INT: '%d', FLOAT: '%f', CHAR: '%c', STRING '%s'\n", 399 MultiType::MultiTypeToString(this->type), 400 this->getBool(), 401 this->getInt(), 402 this->getFloat(), 403 this->getChar(), 404 this->getString() 405 ); 406 407 408 } 409 410 /** 411 * Resets the MultiType to default values. 413 ("MultiType of Type '%s' :: Values: BOOL: '%d', INT: '%d', FLOAT: '%f', CHAR: '%c', STRING '%s'\n", 414 MultiType::MultiTypeToString(this->type), 415 this->getBool(), 416 this->getInt(), 417 this->getFloat(), 418 this->getChar(), 419 this->getString().c_str() 420 ); 421 } 422 423 424 /** 425 * @brief Resets the MultiType to default values. 412 426 */ 413 427 void MultiType::reset() … … 438 452 439 453 /** 440 * converts a MT_Type into a String454 * @brief converts a MT_Type into a String 441 455 * @param type: the MT_Type 442 456 * @returns: the Type as a constant String (do not delete) … … 446 460 switch ( type ) 447 461 { 448 default:449 return "NONE";450 case MT_BOOL:451 return "bool";452 case MT_INT:453 return "int";454 case MT_FLOAT:455 return "float";456 case MT_CHAR:457 return "char";458 case MT_STRING:459 return "string";460 } 461 } 462 463 /** 464 * converts a String into a MT_Type462 default: 463 return "NONE"; 464 case MT_BOOL: 465 return "bool"; 466 case MT_INT: 467 return "int"; 468 case MT_FLOAT: 469 return "float"; 470 case MT_CHAR: 471 return "char"; 472 case MT_STRING: 473 return "string"; 474 } 475 } 476 477 /** 478 * @brief converts a String into a MT_Type 465 479 * @param type: the Type as a String 466 480 * @returns: the Type as MT_Type -
trunk/src/lib/util/multi_type.h
r7197 r7199 1 1 /*! 2 2 * @file multi_type.h 3 * @brief Definition of ...3 * @brief Definition of a MultiType, that is able to hold one Value of many types. 4 4 */ 5 5 6 6 #ifndef _MULTI_TYPE_H 7 7 #define _MULTI_TYPE_H 8 9 #include <string> 8 10 9 11 // FORWARD DECLARATION … … 38 40 MultiType(char value); 39 41 MultiType(const char* value); 42 MultiType(const std::string& value); 40 43 MultiType(const MultiType& multiType); 41 44 virtual ~MultiType(); … … 47 50 MultiType& operator=(char value) { this->setChar(value); return *this; }; 48 51 MultiType& operator=(const char* value) { this->setString(value); return *this; }; 52 MultiType& operator=(const std::string& value) { this->setString(value); return *this; }; 49 53 50 54 bool operator==(const MultiType& mt) const; … … 53 57 bool operator==(float value) const { return (this->getFloat() == value); }; 54 58 bool operator==(char value) const { return (this->getChar() == value); }; 55 bool operator==(const char* value) const;59 bool operator==(const std::string& value) const { return (this->getString() == value); }; 56 60 bool operator==(MT_Type type) const { return (this->type == type); } 57 61 bool operator!=(MT_Type type) const { return (this->type != type); } … … 63 67 void setFloat(float value); 64 68 void setChar(char value); 65 void setString(const char*value);69 void setString(const std::string& value); 66 70 67 71 // for your convenience. … … 71 75 inline void setValue(char value) { this->setChar(value); }; 72 76 inline void setValue(const char* value) { this->setString(value); }; 77 inline void setValue(const std::string& value) { this->setString(value); }; 78 void setValueOf(const MultiType& mt); 73 79 74 80 /** @returns the Type of the Value stored in this MultiType */ … … 81 87 float getFloat() const; 82 88 char getChar() const; 83 const char* getString(); 89 const char* getCString(); 90 std::string getString() const; 84 91 85 92 void reset(); 86 93 87 void debug() ;94 void debug() const; 88 95 89 96 static const char* MultiTypeToString(MT_Type type); … … 101 108 float Float; 102 109 char Char; 103 char* String; 104 110 // std::string* String; 105 111 } value; 106 112 107 113 MT_Type type; 108 114 109 char*storedString;115 std::string storedString; 110 116 }; 111 117
Note: See TracChangeset
for help on using the changeset viewer.