Changeset 721 for code/branches/FICN/src/orxonox/core
- Timestamp:
- Dec 29, 2007, 3:14:39 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc
r717 r721 29 29 30 30 #include "misc/Tokenizer.h" 31 #include "misc/ String2Number.h"31 #include "misc/Convert.h" 32 32 #include "ConfigValueContainer.h" 33 33 … … 50 50 this->type_ = VT_Int; 51 51 52 this->defvalueString_ = number2String(defvalue, "0");// Try to convert the default-value to a string52 Convert::ToString(this->defvalueString_, defvalue, "0"); // Try to convert the default-value to a string 53 53 this->searchConfigFileLine(); // Search the entry in the config-file 54 54 … … 72 72 this->type_ = VT_uInt; 73 73 74 this->defvalueString_ = number2String(defvalue, "0");// Try to convert the default-value to a string74 Convert::ToString(this->defvalueString_, defvalue, "0"); // Try to convert the default-value to a string 75 75 this->searchConfigFileLine(); // Search the entry in the config-file 76 76 … … 94 94 this->type_ = VT_Char; 95 95 96 this->defvalueString_ = number2String((int)defvalue, "0");// Try to convert the default-value to a string96 Convert::ToString(this->defvalueString_, (int)defvalue, "0"); // Try to convert the default-value to a string 97 97 this->searchConfigFileLine(); // Search the entry in the config-file 98 98 … … 116 116 this->type_ = VT_uChar; 117 117 118 this->defvalueString_ = number2String((unsigned int)defvalue, "0");// Try to convert the default-value to a string118 Convert::ToString(this->defvalueString_, (unsigned int)defvalue, "0"); // Try to convert the default-value to a string 119 119 this->searchConfigFileLine(); // Search the entry in the config-file 120 120 … … 138 138 this->type_ = VT_Float; 139 139 140 this->defvalueString_ = number2String(defvalue, "0.000000");// Try to convert the default-value to a string140 Convert::ToString(this->defvalueString_, defvalue, "0.000000"); // Try to convert the default-value to a string 141 141 this->searchConfigFileLine(); // Search the entry in the config-file 142 142 … … 160 160 this->type_ = VT_Double; 161 161 162 this->defvalueString_ = number2String(defvalue, "0.000000");// Try to convert the default-value to a string162 Convert::ToString(this->defvalueString_, defvalue, "0.000000"); // Try to convert the default-value to a string 163 163 this->searchConfigFileLine(); // Search the entry in the config-file 164 164 … … 182 182 this->type_ = VT_LongDouble; 183 183 184 this->defvalueString_ = number2String(defvalue, "0.000000");// Try to convert the default-value to a string184 Convert::ToString(this->defvalueString_, defvalue, "0.000000"); // Try to convert the default-value to a string 185 185 this->searchConfigFileLine(); // Search the entry in the config-file 186 186 … … 384 384 bool ConfigValueContainer::parseSting(const std::string& input, int defvalue) 385 385 { 386 return string2Number(this->value_.value_int_, input, defvalue);386 return Convert::FromString(this->value_.value_int_, input, defvalue); 387 387 } 388 388 … … 395 395 bool ConfigValueContainer::parseSting(const std::string& input, unsigned int defvalue) 396 396 { 397 return string2Number(this->value_.value_uint_, input, defvalue);397 return Convert::FromString(this->value_.value_uint_, input, defvalue); 398 398 } 399 399 … … 407 407 { 408 408 // I used value_int_ instead of value_char_ to avoid number <-> char confusion in the config-file 409 return string2Number(this->value_.value_int_, input, (int)defvalue);409 return Convert::FromString(this->value_.value_int_, input, (int)defvalue); 410 410 } 411 411 … … 419 419 { 420 420 // I used value_uint_ instead of value_uchar_ to avoid number <-> char confusion in the config-file 421 return string2Number(this->value_.value_uint_, input, (unsigned int)defvalue);421 return Convert::FromString(this->value_.value_uint_, input, (unsigned int)defvalue); 422 422 } 423 423 … … 430 430 bool ConfigValueContainer::parseSting(const std::string& input, float defvalue) 431 431 { 432 return string2Number(this->value_.value_float_, input, defvalue);432 return Convert::FromString(this->value_.value_float_, input, defvalue); 433 433 } 434 434 … … 441 441 bool ConfigValueContainer::parseSting(const std::string& input, double defvalue) 442 442 { 443 return string2Number(this->value_.value_double_, input, defvalue);443 return Convert::FromString(this->value_.value_double_, input, defvalue); 444 444 } 445 445 … … 452 452 bool ConfigValueContainer::parseSting(const std::string& input, long double defvalue) 453 453 { 454 return string2Number(this->value_.value_long_double_, input, defvalue);454 return Convert::FromString(this->value_.value_long_double_, input, defvalue); 455 455 } 456 456 … … 477 477 { 478 478 // Its not a known word - is it a number? 479 return string2Number(this->value_.value_bool_, input, defvalue);479 return Convert::FromString(this->value_.value_bool_, input, defvalue); 480 480 } 481 481 … … 549 549 { 550 550 std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ","); 551 if (! string2Number(this->value_vector2_.x, tokens[0], defvalue.x))551 if (!Convert::FromString(this->value_vector2_.x, tokens[0], defvalue.x)) 552 552 { 553 553 this->value_vector2_ = defvalue; 554 554 return false; 555 555 } 556 if (! string2Number(this->value_vector2_.y, tokens[1], defvalue.y))556 if (!Convert::FromString(this->value_vector2_.y, tokens[1], defvalue.y)) 557 557 { 558 558 this->value_vector2_ = defvalue; … … 583 583 { 584 584 std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ","); 585 if (! string2Number(this->value_vector3_.x, tokens[0], defvalue.x))585 if (!Convert::FromString(this->value_vector3_.x, tokens[0], defvalue.x)) 586 586 { 587 587 this->value_vector3_ = defvalue; 588 588 return false; 589 589 } 590 if (! string2Number(this->value_vector3_.y, tokens[1], defvalue.y))590 if (!Convert::FromString(this->value_vector3_.y, tokens[1], defvalue.y)) 591 591 { 592 592 this->value_vector3_ = defvalue; 593 593 return false; 594 594 } 595 if (! string2Number(this->value_vector3_.z, tokens[2], defvalue.z))595 if (!Convert::FromString(this->value_vector3_.z, tokens[2], defvalue.z)) 596 596 { 597 597 this->value_vector3_ = defvalue; … … 622 622 { 623 623 std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ","); 624 if (! string2Number(this->value_colourvalue_.r, tokens[0], defvalue.r))624 if (!Convert::FromString(this->value_colourvalue_.r, tokens[0], defvalue.r)) 625 625 { 626 626 this->value_colourvalue_ = defvalue; 627 627 return false; 628 628 } 629 if (! string2Number(this->value_colourvalue_.g, tokens[1], defvalue.g))629 if (!Convert::FromString(this->value_colourvalue_.g, tokens[1], defvalue.g)) 630 630 { 631 631 this->value_colourvalue_ = defvalue; 632 632 return false; 633 633 } 634 if (! string2Number(this->value_colourvalue_.b, tokens[2], defvalue.b))634 if (!Convert::FromString(this->value_colourvalue_.b, tokens[2], defvalue.b)) 635 635 { 636 636 this->value_colourvalue_ = defvalue; 637 637 return false; 638 638 } 639 if (! string2Number(this->value_colourvalue_.a, tokens[3], defvalue.a))639 if (!Convert::FromString(this->value_colourvalue_.a, tokens[3], defvalue.a)) 640 640 { 641 641 this->value_colourvalue_ = defvalue;
Note: See TracChangeset
for help on using the changeset viewer.