Changeset 4254 in orxonox.OLD for orxonox/branches/levelLoader/src/util/loading/load_param.cc
- Timestamp:
- May 22, 2005, 1:43:16 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelLoader/src/util/loading/load_param.cc
r4252 r4254 16 16 #include "load_param.h" 17 17 18 #include "list.h" 19 #include "base_object.h" 18 20 19 BaseLoadParam::BaseLoadParam(BaseObject* object, const char* type1, const char* type2, 20 const char* type3, const char* type4, const char* type5) 21 #include <stdarg.h> 22 23 24 BaseLoadParam::BaseLoadParam(BaseObject* object, const char* paramName, int paramCount, ...) 21 25 { 22 26 if (LoadClassDescription::parametersDescription) 27 { 28 // locating the class 29 this->classDesc = LoadClassDescription::addClass(object->getClassName()); 30 this->paramDesc = this->classDesc->addParam(paramName); 31 32 this->paramDesc->types = new char*[paramCount]; 33 this->paramDesc->paramCount = paramCount; 34 35 va_list types; 36 va_start (types, paramCount); 37 for(int i = 0; i < paramCount; i++) 38 { 39 const char* tmpTypeName = va_arg (types, const char*); 40 this->paramDesc->types[i] = new char[strlen(tmpTypeName)+1]; 41 strcpy(this->paramDesc->types[i], tmpTypeName); 42 } 43 va_end(types); 44 45 int argCount = 0; 46 } 23 47 } 48 49 50 void BaseLoadParam::describe(const char* descriptionText) 51 { 52 if (this->paramDesc) 53 { 54 55 } 56 57 } 58 59 60 LoadParamDescription::LoadParamDescription(const char* paramName) 61 { 62 this->types = NULL; 63 this->paramName = new char[strlen(paramName)+1]; 64 strcpy(this->paramName, paramName); 65 } 66 67 LoadParamDescription::~LoadParamDescription(void) 68 { 69 for(int i = 0; i < this->paramCount; i++) 70 { 71 delete this->types[i]; 72 } 73 delete []this->types; 74 delete []this->paramName; 75 } 76 77 78 tList<LoadClassDescription>* LoadClassDescription::classList = new tList<LoadClassDescription>; 24 79 25 80 /** 26 81 \brief if the description of Parameters should be executed 27 82 */ 28 bool LoadClassDescription::parametersDescription = false; 83 bool LoadClassDescription::parametersDescription = true; 84 85 LoadClassDescription::LoadClassDescription(const char* className) 86 { 87 this->className = new char[strlen(className)+1]; 88 strcpy(this->className, className); 89 90 classList->add(this); 91 92 this->paramList = new tList<LoadParamDescription>; 93 } 94 95 LoadClassDescription::~LoadClassDescription(void) 96 { 97 delete []this->className; 98 99 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 100 LoadParamDescription* enumParamDesc = iterator->nextElement(); 101 while (enumParamDesc) 102 { 103 delete enumParamDesc; 104 enumParamDesc = iterator->nextElement(); 105 } 106 delete iterator; 107 108 } 109 110 111 LoadClassDescription* LoadClassDescription::addClass(const char* className) 112 { 113 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 114 LoadClassDescription* enumClassDesc = iterator->nextElement(); 115 while (enumClassDesc) 116 { 117 if (!strcmp(enumClassDesc->className, className)) 118 { 119 delete iterator; 120 return enumClassDesc; 121 } 122 enumClassDesc = iterator->nextElement(); 123 } 124 delete iterator; 125 126 return new LoadClassDescription(className); 127 } 128 129 130 LoadParamDescription* LoadClassDescription::addParam(const char* paramName) 131 { 132 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 133 LoadParamDescription* enumParamDesc = iterator->nextElement(); 134 while (enumParamDesc) 135 { 136 if (!strcmp(enumParamDesc->paramName, paramName)) 137 { 138 delete iterator; 139 this->paramList->add(enumParamDesc); 140 return enumParamDesc; 141 } 142 enumParamDesc = iterator->nextElement(); 143 } 144 delete iterator; 145 146 this->paramList->add(new LoadParamDescription(paramName)); 147 return paramList->lastElement(); 148 }
Note: See TracChangeset
for help on using the changeset viewer.