Changeset 7219 in orxonox.OLD for branches/std/src/lib/util/loading
- Timestamp:
- Mar 12, 2006, 5:14:44 PM (19 years ago)
- Location:
- branches/std/src/lib/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/util/loading/load_param_description.cc
r7203 r7219 134 134 * @param className the name of the class to be loadable 135 135 */ 136 LoadClassDescription::LoadClassDescription(const char* className) 137 { 138 this->className = new char[strlen(className)+1]; 139 strcpy(this->className, className); 136 LoadClassDescription::LoadClassDescription(const std::string& className) 137 { 138 this->className = className; 140 139 141 140 if (LoadClassDescription::classList == NULL) … … 156 155 this->paramList.pop_front(); 157 156 } 158 159 delete[] this->className;160 157 } 161 158 … … 182 179 Otherwise it returns a new classDescription 183 180 */ 184 LoadClassDescription* LoadClassDescription::addClass(const char*className)181 LoadClassDescription* LoadClassDescription::addClass(const std::string& className) 185 182 { 186 183 if (LoadClassDescription::classList != NULL) … … 189 186 while (it != LoadClassDescription::classList->end()) 190 187 { 191 if ( !strcmp((*it)->className, className))188 if ((*it)->className == className) 192 189 { 193 190 return (*it); … … 200 197 201 198 /** 202 * does the same as addClass(const char*className), but with params199 * does the same as addClass(const std::string& className), but with params 203 200 * @param paramName the name of the parameter to add. 204 201 */ 205 LoadParamDescription* LoadClassDescription::addParam(const char*paramName)202 LoadParamDescription* LoadClassDescription::addParam(const std::string& paramName) 206 203 { 207 204 std::list<LoadParamDescription*>::iterator it = this->paramList.begin(); … … 226 223 * @todo implement it 227 224 */ 228 void LoadClassDescription::printAll(const char*fileName)225 void LoadClassDescription::printAll(const std::string& fileName) 229 226 { 230 227 PRINT(3)("===============================================================\n"); … … 235 232 while (classDesc != LoadClassDescription::classList->end()) 236 233 { 237 PRINT(3)("<%s>\n", (*classDesc)->className );234 PRINT(3)("<%s>\n", (*classDesc)->className.c_str()); 238 235 std::list<LoadParamDescription*>::iterator param = (*classDesc)->paramList.begin(); 239 236 while (param != (*classDesc)->paramList.end()) … … 242 239 param++; 243 240 } 244 PRINT(3)("</%s>\n\n", (*classDesc)->className );241 PRINT(3)("</%s>\n\n", (*classDesc)->className.c_str()); 245 242 classDesc++; 246 243 } … … 257 254 * !! The strings MUST NOT be deleted !! 258 255 */ 259 std::list< const char*> LoadClassDescription::searchClassWithShort(const char*classNameBegin)256 std::list<std::string> LoadClassDescription::searchClassWithShort(const std::string& classNameBegin) 260 257 { 261 258 /// FIXME 262 259 // NOT USED 263 260 /* unsigned int searchLength = strlen(classNameBegin); 264 std::list<const char*> retVal;261 std::list<const std::string&> retVal; 265 262 266 263 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); -
branches/std/src/lib/util/loading/load_param_description.h
r7203 r7219 59 59 friend class CLoadParam; 60 60 public: 61 LoadClassDescription(const char*className);61 LoadClassDescription(const std::string& className); 62 62 ~LoadClassDescription(); 63 63 64 static LoadClassDescription* addClass(const char*className);65 LoadParamDescription* addParam(const char*paramName);64 static LoadClassDescription* addClass(const std::string& className); 65 LoadParamDescription* addParam(const std::string& paramName); 66 66 67 67 static void deleteAllDescriptions(); 68 68 69 static void printAll(const char* fileName = NULL);70 static std::list< const char*> searchClassWithShort(const char*classNameBegin);71 // static const LoadParamDescription* getClass(const char*className);69 static void printAll(const std::string& fileName = ""); 70 static std::list<std::string> searchClassWithShort(const std::string& classNameBegin); 71 // static const LoadParamDescription* getClass(const std::string& className); 72 72 73 73 private: 74 74 static bool parametersDescription; //!< if parameter-description should be enabled. 75 75 static std::list<LoadClassDescription*>* classList; //!< a list, that stores all the loadable classes. (after one instance has been loaded) 76 char*className; //!< name of the class76 std::string className; //!< name of the class 77 77 78 78 std::list<LoadParamDescription*> paramList; //!< List of parameters this class knows.
Note: See TracChangeset
for help on using the changeset viewer.