Changeset 7221 in orxonox.OLD for trunk/src/lib/util/loading/load_param_description.cc
- Timestamp:
- Mar 15, 2006, 3:10:45 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/loading/load_param_description.cc
r7130 r7221 22 22 * @param paramName the name of the parameter to load 23 23 */ 24 LoadParamDescription::LoadParamDescription(const char*paramName)24 LoadParamDescription::LoadParamDescription(const std::string& paramName) 25 25 { 26 26 this->types = NULL; 27 this->description = NULL;28 27 this->defaultValues = NULL; 29 this->paramName = new char[strlen(paramName)+1]; 30 strcpy(this->paramName, paramName); 28 this->paramName = paramName; 31 29 } 32 30 … … 46 44 delete[] this->types; 47 45 delete[] this->defaultValues; 48 delete[] this->paramName;49 delete[] this->description;50 46 } 51 47 … … 53 49 * @param descriptionText The text to set as a description for this Parameter 54 50 */ 55 void LoadParamDescription::setDescription(const char* descriptionText) 56 { 57 this->description = new char[strlen(descriptionText)+1]; 58 strcpy(this->description, descriptionText); 51 void LoadParamDescription::setDescription(const std::string& descriptionText) 52 { 53 this->description = descriptionText; 59 54 } 60 55 … … 64 59 void LoadParamDescription::print() const 65 60 { 66 PRINT(3)(" <%s>", this->paramName );61 PRINT(3)(" <%s>", this->paramName.c_str()); 67 62 for (int i = 0; i < this->paramCount; i++) 68 63 { … … 101 96 // } 102 97 } 103 PRINT(3)("</%s>", this->paramName );104 if ( this->description)105 PRINT(3)(" -- %s", this->description );98 PRINT(3)("</%s>", this->paramName.c_str()); 99 if (!this->description.empty()) 100 PRINT(3)(" -- %s", this->description.c_str()); 106 101 // default values 107 102 if (this->paramCount > 0) … … 139 134 * @param className the name of the class to be loadable 140 135 */ 141 LoadClassDescription::LoadClassDescription(const char* className) 142 { 143 this->className = new char[strlen(className)+1]; 144 strcpy(this->className, className); 136 LoadClassDescription::LoadClassDescription(const std::string& className) 137 { 138 this->className = className; 145 139 146 140 if (LoadClassDescription::classList == NULL) … … 161 155 this->paramList.pop_front(); 162 156 } 163 164 delete[] this->className;165 157 } 166 158 … … 187 179 Otherwise it returns a new classDescription 188 180 */ 189 LoadClassDescription* LoadClassDescription::addClass(const char*className)181 LoadClassDescription* LoadClassDescription::addClass(const std::string& className) 190 182 { 191 183 if (LoadClassDescription::classList != NULL) … … 194 186 while (it != LoadClassDescription::classList->end()) 195 187 { 196 if ( !strcmp((*it)->className, className))188 if ((*it)->className == className) 197 189 { 198 190 return (*it); … … 205 197 206 198 /** 207 * does the same as addClass(const char*className), but with params199 * does the same as addClass(const std::string& className), but with params 208 200 * @param paramName the name of the parameter to add. 209 201 */ 210 LoadParamDescription* LoadClassDescription::addParam(const char*paramName)202 LoadParamDescription* LoadClassDescription::addParam(const std::string& paramName) 211 203 { 212 204 std::list<LoadParamDescription*>::iterator it = this->paramList.begin(); 213 205 while (it != this->paramList.end()) 214 206 { 215 if ( !strcmp((*it)->paramName, paramName))207 if ((*it)->paramName == paramName) 216 208 { 217 209 return NULL; … … 231 223 * @todo implement it 232 224 */ 233 void LoadClassDescription::printAll(const char*fileName)225 void LoadClassDescription::printAll(const std::string& fileName) 234 226 { 235 227 PRINT(3)("===============================================================\n"); … … 240 232 while (classDesc != LoadClassDescription::classList->end()) 241 233 { 242 PRINT(3)("<%s>\n", (*classDesc)->className );234 PRINT(3)("<%s>\n", (*classDesc)->className.c_str()); 243 235 std::list<LoadParamDescription*>::iterator param = (*classDesc)->paramList.begin(); 244 236 while (param != (*classDesc)->paramList.end()) … … 247 239 param++; 248 240 } 249 PRINT(3)("</%s>\n\n", (*classDesc)->className );241 PRINT(3)("</%s>\n\n", (*classDesc)->className.c_str()); 250 242 classDesc++; 251 243 } … … 262 254 * !! The strings MUST NOT be deleted !! 263 255 */ 264 std::list< const char*> LoadClassDescription::searchClassWithShort(const char*classNameBegin)256 std::list<std::string> LoadClassDescription::searchClassWithShort(const std::string& classNameBegin) 265 257 { 266 258 /// FIXME 267 259 // NOT USED 268 260 /* unsigned int searchLength = strlen(classNameBegin); 269 std::list<const char*> retVal;261 std::list<const std::string&> retVal; 270 262 271 263 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
Note: See TracChangeset
for help on using the changeset viewer.