Changeset 1611 for code/branches/core3/src/core/ConfigValueContainer.cc
- Timestamp:
- Jun 19, 2008, 5:02:45 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/core/ConfigValueContainer.cc
r1610 r1611 47 47 { 48 48 /** 49 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 50 @param type The type of the corresponding config-file 51 @param identifier The identifier of the class the variable belongs to 52 @param varname The name of the variable 53 @param defvalue The default-value 54 */ 55 ConfigValueContainer::ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const MultiTypeMath& defvalue) 49 @brief Initializes the ConfigValueContainer with defaultvalues. 50 */ 51 void ConfigValueContainer::init(ConfigFileType type, Identifier* identifier, const std::string& varname) 56 52 { 57 53 this->type_ = type; … … 63 59 this->bDoInitialCallback_ = false; 64 60 this->bAddedDescription_ = false; 65 61 } 62 63 /** 64 @brief Does some special initialization for single config-values. 65 */ 66 void ConfigValueContainer::initValue(const MultiTypeMath& defvalue) 67 { 66 68 this->value_ = defvalue; 67 69 this->bIsVector_ = false; 68 70 69 this->defvalueString_ = defvalue.toString();71 this->defvalueString_ = this->value_.toString(); 70 72 this->update(); 71 73 } 72 74 73 75 /** 74 @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable. 75 @param type The type of the corresponding config-file 76 @param identifier The identifier of the class the variable belongs to 77 @param varname The name of the variable 78 @param defvalue The default-value 79 */ 80 ConfigValueContainer::ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const std::vector<MultiTypeMath>& defvalue) 81 { 82 this->type_ = type; 83 this->identifier_ = identifier; 84 this->sectionname_ = identifier->getName(); 85 this->varname_ = varname; 86 this->callback_ = 0; 87 this->bContainerIsNew_ = true; 88 this->bDoInitialCallback_ = false; 89 this->bAddedDescription_ = false; 90 91 this->valueVector_ = defvalue; 76 @brief Does some special initialization for vector config-values. 77 */ 78 void ConfigValueContainer::initVector() 79 { 92 80 this->bIsVector_ = true; 93 81 94 if (defvalue.size() > 0) 95 { 96 this->value_ = defvalue[0]; 97 98 for (unsigned int i = 0; i < defvalue.size(); i++) 99 { 100 ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, i, defvalue[i].toString(), this->value_.isA(MT_string)); 101 this->defvalueStringVector_.push_back(defvalue[i].toString()); 102 } 103 104 this->update(); 105 } 82 for (unsigned int i = 0; i < this->valueVector_.size(); i++) 83 { 84 ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i].toString(), this->value_.isA(MT_string)); 85 this->defvalueStringVector_.push_back(this->valueVector_[i].toString()); 86 } 87 88 this->update(); 106 89 } 107 90
Note: See TracChangeset
for help on using the changeset viewer.