Changeset 6613 in orxonox.OLD for trunk/src/util
- Timestamp:
- Jan 19, 2006, 1:51:00 AM (19 years ago)
- Location:
- trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/loading/load_param.cc
r5708 r6613 38 38 // determin the LoadString. 39 39 if (likely(!inLoadCycle)) 40 this->loadString = grabParameter(root, paramName); 40 this->loadElem = grabParameterElement(root, paramName); 41 //this->loadString = grabParameter(root, paramName); 42 else if (!strcmp(root->Value(), paramName)) 43 this->loadElem = (TiXmlElement*)root->FirstChild(); 41 44 else 42 { 43 if (!strcmp(root->Value(), paramName)) 44 { 45 const TiXmlNode* val = root->FirstChild(); 46 if( val->ToText()) 47 this->loadString = val->Value(); 48 } 49 else 50 this->loadString = NULL; 51 } 45 this->loadElem = NULL; 52 46 53 47 // set the Executor. … … 65 59 if (likely(this->executor != NULL)) 66 60 { 67 if (likely(this->object != NULL && this->executor != NULL) && 61 if (this->loadElem != NULL && this->loadElem->ToText()) 62 this->loadString = this->loadElem->Value(); 63 else 64 this->loadString = NULL; 65 if (likely(this->object != NULL) && 68 66 ( this->loadString != NULL || 69 67 ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString))) … … 74 72 delete this->executor; 75 73 } 76 77 74 } 78 75 … … 250 247 return NULL; 251 248 } 249 250 /** 251 * @param root: The XML-element to grab a parameter from 252 * @param parameterName: the parameter to grab 253 * @returns the Element of the parameter if found, NULL otherwise 254 */ 255 const TiXmlElement* grabParameterElement(const TiXmlElement* root, const char* parameterName) 256 { 257 const TiXmlElement* element; 258 const TiXmlNode* node; 259 260 if (root == NULL || parameterName == NULL) 261 return NULL; 262 assert( parameterName != NULL); 263 264 element = root->FirstChildElement( parameterName); 265 if( element == NULL) return NULL; 266 267 node = element->FirstChild(); 268 while( node != NULL) 269 { 270 if( node->ToText()) return (TiXmlElement*)node; 271 node = node->NextSibling(); 272 } 273 return NULL; 274 } 275 276 277 -
trunk/src/util/loading/load_param.h
r5708 r6613 104 104 LoadClassDescription* classDesc; //!< The LoadClassDescription of this CLoadParameter 105 105 LoadParamDescription* paramDesc; //!< The LoadParameterDescription of this LoadParameter 106 const TiXmlElement* loadElem; //!< The Element to load. 106 107 const char* loadString; //!< The string loaded by this LoadParam 107 108 const void* pointerToParam; //!< A Pointer to a Parameter. … … 113 114 114 115 const char* grabParameter(const TiXmlElement* root, const char* parameterName); 116 const TiXmlElement* grabParameterElement(const TiXmlElement* root, const char* parameterName); 115 117 116 118 #endif /* _LOAD_PARAM_H */
Note: See TracChangeset
for help on using the changeset viewer.