Changeset 7203 in orxonox.OLD for branches/std/src/lib/util/loading/load_param.cc
- Timestamp:
- Mar 9, 2006, 5:28:10 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/util/loading/load_param.cc
r7201 r7203 28 28 * @param executor the Executor, that executes the loading procedure. 29 29 */ 30 CLoadParam::CLoadParam(const TiXmlElement* root, const char*paramName, BaseObject* object, const Executor& executor, bool inLoadCycle)31 { 32 this->paramName = paramName; 30 CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, const Executor& executor, bool inLoadCycle) 31 : paramName(paramName), object(object) 32 { 33 33 this->object = object; 34 34 this->inLoadCycle = inLoadCycle; … … 37 37 if (likely(!inLoadCycle)) 38 38 this->loadElem = grabParameterElement(root, paramName); 39 //this->loadString = grabParameter(root, paramName); 40 else if (!strcmp(root->Value(), paramName)) 39 else if (paramName == root->Value()) 41 40 this->loadElem = (TiXmlElement*)root->FirstChild(); 42 41 else … … 46 45 this->executor = executor.clone(); 47 46 48 if (this->executor)49 this->executor->setName(paramName);47 //if (this->executor) 48 // this->executor->setName(paramName); 50 49 } 51 50 … … 60 59 if (likely(this->executor != NULL)) 61 60 { 61 std::string loadString; 62 62 if (this->loadElem != NULL && this->loadElem->ToText()) 63 this->loadString = this->loadElem->Value(); 64 else 65 this->loadString = NULL; 63 loadString = this->loadElem->Value(); 66 64 if (likely(this->object != NULL) && 67 ( this->loadString != NULL||65 ( !loadString.empty() || 68 66 ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString))) 69 67 { 70 PRINTF(4)("Loading '%s' with Parameters '%s' onto: '%s'(%s)\n", this->paramName, this->loadString, this->object->getName(), this->object->getClassName());71 this->executor->execute(this->object, this->loadString);68 PRINTF(4)("Loading '%s' with Parameters '%s' onto: '%s'(%s)\n", this->paramName, loadString, this->object->getName(), this->object->getClassName()); 69 this->executor->execute(this->object, &loadString); 72 70 } 73 71 delete this->executor; … … 99 97 * @returns a pointer to itself. 100 98 */ 101 CLoadParam& CLoadParam::describe(const char*descriptionText)102 { 103 if (LoadClassDescription::parametersDescription && this->paramDesc && !this->paramDesc->getDescription())99 CLoadParam& CLoadParam::describe(const std::string& descriptionText) 100 { 101 if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty()) 104 102 { 105 103 this->paramDesc->setDescription(descriptionText); … … 230 228 * @returns the Value of the parameter if found, NULL otherwise 231 229 */ 232 const char* grabParameter(const TiXmlElement* root, const char*parameterName)230 std::string grabParameter(const TiXmlElement* root, const std::string& parameterName) 233 231 { 234 232 const TiXmlElement* element; 235 233 const TiXmlNode* node; 236 234 237 if (root == NULL || parameterName == NULL)235 if (root == NULL) 238 236 return NULL; 239 assert( parameterName != NULL);240 237 241 238 element = root->FirstChildElement( parameterName); … … 256 253 * @returns the Element of the parameter if found, NULL otherwise 257 254 */ 258 const TiXmlElement* grabParameterElement(const TiXmlElement* root, const char*parameterName)255 const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName) 259 256 { 260 257 const TiXmlElement* element; 261 258 const TiXmlNode* node; 262 259 263 if (root == NULL || parameterName == NULL)260 if (root == NULL) 264 261 return NULL; 265 assert( parameterName != NULL);266 262 267 263 element = root->FirstChildElement( parameterName);
Note: See TracChangeset
for help on using the changeset viewer.