Changeset 1716 for code/branches/core3/src/core/ConfigValueContainer.cc
- Timestamp:
- Sep 6, 2008, 4:21:56 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/core/ConfigValueContainer.cc
r1658 r1716 64 64 @brief Does some special initialization for single config-values. 65 65 */ 66 void ConfigValueContainer::initValue(const MultiType Math& defvalue)66 void ConfigValueContainer::initValue(const MultiType& defvalue) 67 67 { 68 68 this->value_ = defvalue; … … 82 82 for (unsigned int i = 0; i < this->valueVector_.size(); i++) 83 83 { 84 ConfigFileManager::getInstance()->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());84 ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string)); 85 this->defvalueStringVector_.push_back(this->valueVector_[i]); 86 86 } 87 87 … … 103 103 @return True if the new value was successfully assigned 104 104 */ 105 bool ConfigValueContainer::set(const MultiType Math& input)106 { 107 if (this->bIsVector_) 108 { 109 return this->callFunctionWithIndex(&ConfigValueContainer::set, input .toString());105 bool ConfigValueContainer::set(const MultiType& input) 106 { 107 if (this->bIsVector_) 108 { 109 return this->callFunctionWithIndex(&ConfigValueContainer::set, input); 110 110 } 111 111 else … … 113 113 if (this->tset(input)) 114 114 { 115 ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, input .toString(), this->value_.isA(MT_string));115 ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_string)); 116 116 return true; 117 117 } … … 126 126 @return True if the new value was successfully assigned 127 127 */ 128 bool ConfigValueContainer::set(unsigned int index, const MultiType Math& input)128 bool ConfigValueContainer::set(unsigned int index, const MultiType& input) 129 129 { 130 130 if (this->bIsVector_) … … 132 132 if (this->tset(index, input)) 133 133 { 134 ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, index, input .toString(), this->value_.isA(MT_string));134 ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_string)); 135 135 return true; 136 136 } … … 148 148 @return True if the new value was successfully assigned 149 149 */ 150 bool ConfigValueContainer::tset(const MultiTypeMath& input) 151 { 152 if (this->bIsVector_) 153 { 154 return this->callFunctionWithIndex(&ConfigValueContainer::tset, input.toString()); 155 } 156 else 157 { 158 MultiTypeMath temp = this->value_; 159 if (temp.assimilate(input)) 160 { 161 this->value_ = temp; 150 bool ConfigValueContainer::tset(const MultiType& input) 151 { 152 if (this->bIsVector_) 153 { 154 return this->callFunctionWithIndex(&ConfigValueContainer::tset, input); 155 } 156 else 157 { 158 // MultiType temp = this->value_; 159 // if (temp.assimilate(input)) 160 // { 161 // this->value_ = temp; 162 this->value_ = input; 162 163 if (this->identifier_) 163 164 this->identifier_->updateConfigValues(); 164 165 165 166 return true; 166 }167 // } 167 168 } 168 169 return false; … … 175 176 @return True if the new value was successfully assigned 176 177 */ 177 bool ConfigValueContainer::tset(unsigned int index, const MultiType Math& input)178 bool ConfigValueContainer::tset(unsigned int index, const MultiType& input) 178 179 { 179 180 if (this->bIsVector_) … … 189 190 for (unsigned int i = this->valueVector_.size(); i <= index; i++) 190 191 { 191 this->valueVector_.push_back(MultiType Math());192 this->valueVector_.push_back(MultiType()); 192 193 } 193 194 } 194 195 195 MultiTypeMath temp = this->value_; 196 if (temp.assimilate(input)) 197 { 198 this->valueVector_[index] = temp; 196 // MultiType temp = this->value_; 197 // if (temp.assimilate(input)) 198 // { 199 // this->valueVector_[index] = temp; 200 this->valueVector_[index] = input; 199 201 200 202 if (this->identifier_) … … 202 204 203 205 return true; 204 }206 // } 205 207 } 206 208 else … … 216 218 @return True if the new entry was successfully added 217 219 */ 218 bool ConfigValueContainer::add(const MultiType Math& input)220 bool ConfigValueContainer::add(const MultiType& input) 219 221 { 220 222 if (this->bIsVector_) … … 239 241 this->valueVector_.erase(this->valueVector_.begin() + index); 240 242 for (unsigned int i = index; i < this->valueVector_.size(); i++) 241 ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.is A(MT_string));243 ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string)); 242 244 ConfigFileManager::getInstance()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size()); 243 245 … … 275 277 { 276 278 if (!this->bIsVector_) 277 this->value_ .fromString(ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isA(MT_string)));279 this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_string)); 278 280 else 279 281 { … … 283 285 if (i < this->defvalueStringVector_.size()) 284 286 { 285 this->value_ .fromString(ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isA(MT_string)));287 this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_string)); 286 288 } 287 289 else 288 290 { 289 this->value_ .fromString(ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, MultiTypeMath(), this->value_.isA(MT_string)));291 this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_string)); 290 292 } 291 293 … … 301 303 @return The returnvalue of the functioncall 302 304 */ 303 bool ConfigValueContainer::callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType Math&), const std::string& input)305 bool ConfigValueContainer::callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input) 304 306 { 305 307 SubString token(input, " ", SubString::WhiteSpaces, true, '\\', false, '"', false, '(', ')', false, '\0');
Note: See TracChangeset
for help on using the changeset viewer.