Changeset 7221 in orxonox.OLD for trunk/src/lib/shell/shell_command_class.cc
- Timestamp:
- Mar 15, 2006, 3:10:45 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command_class.cc
r5780 r7221 36 36 * @param className the Name of the command-class to create 37 37 */ 38 ShellCommandClass::ShellCommandClass(const char* className) 38 ShellCommandClass::ShellCommandClass(const std::string& className) 39 : className(className) 39 40 { 40 41 this->setClassID(CL_SHELL_COMMAND_CLASS, "ShellCommandClass"); 41 42 this->setName(className); 42 43 43 this->className = className;44 44 this->classID = CL_NULL; 45 45 … … 65 65 * @returns true on success, false otherwise 66 66 */ 67 bool ShellCommandClass::getCommandListOfClass(const char* className, std::list<const char*>* stringList)68 { 69 if (stringList == NULL || className == NULL)67 bool ShellCommandClass::getCommandListOfClass(const std::string& className, std::list<std::string>* stringList) 68 { 69 if (stringList == NULL) 70 70 return false; 71 71 … … 73 73 for(elem = ShellCommandClass::commandClassList->begin(); elem != ShellCommandClass::commandClassList->end(); elem++) 74 74 { 75 if ( !strcmp ((*elem)->getName(), className))75 if (className == (*elem)->getName()) 76 76 { 77 77 list<ShellCommand*>::iterator command; … … 88 88 * @returns true on success, false otherwise 89 89 */ 90 bool ShellCommandClass::getCommandListOfAlias(std::list< const char*>* stringList)90 bool ShellCommandClass::getCommandListOfAlias(std::list<std::string>* stringList) 91 91 { 92 92 if (stringList == NULL || ShellCommandClass::aliasList == NULL) … … 130 130 * @returns the CommandClass if found, NULL otherwise 131 131 */ 132 const ShellCommandClass* ShellCommandClass::isRegistered(const char*className)132 const ShellCommandClass* ShellCommandClass::isRegistered(const std::string& className) 133 133 { 134 134 if (ShellCommandClass::commandClassList == NULL) … … 138 138 for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++) 139 139 { 140 if ( !strcmp(className, (*classIT)->className))140 if (className == (*classIT)->className) 141 141 { 142 142 if ((*classIT)->classID == CL_NULL) … … 154 154 * @returns the CommandClass if found, or a new CommandClass if not 155 155 */ 156 ShellCommandClass* ShellCommandClass::getCommandClass(const char*className)156 ShellCommandClass* ShellCommandClass::getCommandClass(const std::string& className) 157 157 { 158 158 if (ShellCommandClass::commandClassList == NULL) … … 162 162 for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++) 163 163 { 164 if ( !strcmp(className, (*classIT)->className))164 if (className == (*classIT)->className) 165 165 { 166 166 return (*classIT); … … 186 186 * @param className: the Class of Commands to show help about 187 187 */ 188 void ShellCommandClass::help(const char* className) 189 { 190 if (className == NULL) 191 return; 188 void ShellCommandClass::help(const std::string& className) 189 { 192 190 if (likely(ShellCommandClass::commandClassList != NULL)) 193 191 { … … 195 193 for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++) 196 194 { 197 if ( (*classIT)->className && !strcasecmp(className, (*classIT)->className))195 if (className == (*classIT)->className) 198 196 { 199 PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className , (*classIT)->commandList.size());197 PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className.c_str(), (*classIT)->commandList.size()); 200 198 list<ShellCommand*>::const_iterator cmdIT; 201 199 for (cmdIT = (*classIT)->commandList.begin(); cmdIT != (*classIT)->commandList.end(); cmdIT++) … … 205 203 /* for (unsigned int i = 0; i< elem->paramCount; i++) 206 204 PRINT(0)("%s ", ShellCommand::paramToString(elem->parameters[i]));*/ 207 if ( (*cmdIT)->description != NULL)208 PRINT(0)("- %s", (*cmdIT)->description );205 if (!(*cmdIT)->description.empty()) 206 PRINT(0)("- %s", (*cmdIT)->description.c_str()); 209 207 PRINT(0)("\n"); 210 208 } … … 212 210 } 213 211 } 214 PRINTF(3)("Class %s not found in Command's classes\n", className );212 PRINTF(3)("Class %s not found in Command's classes\n", className.c_str()); 215 213 } 216 214 else
Note: See TracChangeset
for help on using the changeset viewer.