Changeset 4496 in orxonox.OLD for orxonox/trunk/src/util/loading
- Timestamp:
- Jun 3, 2005, 3:52:05 AM (19 years ago)
- Location:
- orxonox/trunk/src/util/loading
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/loading/game_loader.cc
r4487 r4496 252 252 // free the XML data 253 253 delete XMLDoc; 254 254 255 255 return c; 256 256 } -
orxonox/trunk/src/util/loading/load_param.cc
r4492 r4496 26 26 \param paramName: The name of the parameter loaded. 27 27 \param paramCount: how many parameters this loading-function takes 28 \param multi: if false LoadParam assumes only one occurence of this parameter in root, if true it assumes multiple occurences. 28 29 \param ...: the parameter information 29 30 */ 30 BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...) 31 { 32 this->loadString = grabParameter(root, paramName); 31 BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, 32 int paramCount, bool multi, ...) 33 { 34 this->loadString = NULL; 35 36 if (likely(!multi)) 37 this->loadString = grabParameter(root, paramName); 38 else 39 { 40 printf("paramName:::::%s\n", root->Value()); 41 if (!strcmp(root->Value(), paramName)) 42 { 43 const TiXmlNode* val = root->FirstChild(); 44 if( val->ToText()) 45 this->loadString = val->Value(); 46 } 47 } 48 if (loadString) 49 printf("%s\n", loadString); 33 50 34 51 this->paramDesc = NULL; … … 43 60 44 61 va_list types; 45 va_start (types, paramCount);62 va_start (types, multi); 46 63 for(int i = 0; i < paramCount; i++) 47 64 { -
orxonox/trunk/src/util/loading/load_param.h
r4495 r4496 73 73 */ 74 74 #define LoadParam1(type1) \ 75 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE) ) \76 : BaseLoadParam(root, pt2Object, paramName, 1, type1##_NAME) \75 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE), bool multi = false) \ 76 : BaseLoadParam(root, pt2Object, paramName, 1, multi, type1##_NAME) \ 77 77 { \ 78 78 if (loadString != NULL && root != NULL) \ … … 90 90 */ 91 91 #define LoadParam2(type1, type2) \ 92 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE) ) \93 : BaseLoadParam(root, pt2Object, paramName, 2, type1##_NAME, type2##_NAME) \92 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE), bool multi = false) \ 93 : BaseLoadParam(root, pt2Object, paramName, 2, multi, type1##_NAME, type2##_NAME) \ 94 94 { \ 95 95 if (loadString != NULL && root != NULL) \ … … 115 115 */ 116 116 #define LoadParam3(type1, type2, type3) \ 117 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE) )\118 : BaseLoadParam(root, pt2Object, paramName, 3, type1##_NAME, type2##_NAME, type3##_NAME) \117 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE), bool multi = false)\ 118 : BaseLoadParam(root, pt2Object, paramName, 3, multi, type1##_NAME, type2##_NAME, type3##_NAME) \ 119 119 { \ 120 120 if (loadString != NULL && root != NULL) \ … … 141 141 */ 142 142 #define LoadParam4(type1, type2, type3, type4) \ 143 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) ) \144 : BaseLoadParam(root, pt2Object, paramName, 4, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \143 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE), bool multi = false) \ 144 : BaseLoadParam(root, pt2Object, paramName, 4, multi, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \ 145 145 { \ 146 146 if (loadString != NULL && root != NULL) \ … … 168 168 */ 169 169 #define LoadParam5(type1, type2, type3, type4, type5) \ 170 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE) ) \171 : BaseLoadParam(root, pt2Object, paramName, 5, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \170 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE), bool multi = false) \ 171 : BaseLoadParam(root, pt2Object, paramName, 5, multi, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \ 172 172 { \ 173 173 if (loadString != NULL && root != NULL) \ … … 221 221 222 222 private: 223 static bool parametersDescription; //!< if parameter-description should be enabled.224 static tList<LoadClassDescription>* classList; //!< a list, that holds all the loadable classes. (after one instance has been loaded)225 char* className; //!< name of the class226 tList<LoadParamDescription>* paramList; //!< List of parameters this class knows.223 static bool parametersDescription; //!< if parameter-description should be enabled. 224 static tList<LoadClassDescription>* classList; //!< a list, that holds all the loadable classes. (after one instance has been loaded) 225 char* className; //!< name of the class 226 tList<LoadParamDescription>* paramList; //!< List of parameters this class knows. 227 227 }; 228 228 … … 234 234 235 235 protected: 236 BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...);236 BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, bool multi, ...); 237 237 238 238 protected:
Note: See TracChangeset
for help on using the changeset viewer.