Changeset 7219 in orxonox.OLD for branches/std/src/lib/shell
- Timestamp:
- Mar 12, 2006, 5:14:44 PM (19 years ago)
- Location:
- branches/std/src/lib/shell
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/shell/shell_command.cc
r7218 r7219 41 41 PRINTF(5)("create shellcommand %s %s\n", commandName, className); 42 42 this->setName(commandName); 43 this->description = NULL;44 this->alias = NULL;45 43 this->executor = executor.clone(); 46 44 this->executor->setName(commandName); … … 177 175 for (alias = ShellCommandClass::aliasList->begin(); alias != ShellCommandClass::aliasList->end(); alias++ ) 178 176 { 179 if ( (*alias)->getName() != NULL &&inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&177 if (inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL && 180 178 (*alias)->getCommand()->shellClass != NULL ) 181 179 { … … 258 256 * @param description the description of the Given command 259 257 */ 260 ShellCommand* ShellCommand::describe(const char*description)258 ShellCommand* ShellCommand::describe(const std::string& description) 261 259 { 262 260 if (this == NULL) … … 338 336 /* for (unsigned int i = 0; i< elem->paramCount; i++) 339 337 printf("%s ", ShellCommand::paramToString(elem->parameters[i]));*/ 340 if ( (*cmdIT)->description != NULL)341 printf("- %s", (*cmdIT)->description);338 if (!(*cmdIT)->description.empty()) 339 printf("- %s", (*cmdIT)->description.c_str()); 342 340 printf("\n"); 343 341 -
branches/std/src/lib/shell/shell_command.h
r7216 r7219 63 63 static bool execute (const std::string& executionString); 64 64 65 ShellCommand* describe(const char*description);65 ShellCommand* describe(const std::string& description); 66 66 ShellCommand* setAlias(const char* alias); 67 67 ShellCommand* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL, … … 89 89 ShellCommandAlias* alias; //!< An Alias for the Class. 90 90 91 const char*description; //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");91 std::string description; //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla"); 92 92 Executor* executor; //!< The Executor, that really executes the Function. 93 93 … … 100 100 public: 101 101 /** @returns the Name of the Alias. */ 102 const char*getName() const { return this->aliasName; };102 const std::string& getName() const { return this->aliasName; }; 103 103 /** @returns the Command, this Alias is asociated with */ 104 104 ShellCommand* getCommand() const { return this->command; }; … … 106 106 private: 107 107 /** @param aliasName the name of the Alias @param command the Command, to associate this alias with */ 108 ShellCommandAlias(const char*aliasName, ShellCommand* command) { this->aliasName = aliasName; this->command = command; };108 ShellCommandAlias(const std::string& aliasName, ShellCommand* command) { this->aliasName = aliasName; this->command = command; }; 109 109 110 110 private: 111 const char*aliasName; //!< the name of the Alias111 std::string aliasName; //!< the name of the Alias 112 112 ShellCommand* command; //!< a pointer to the command, this alias executes. 113 113 }; -
branches/std/src/lib/shell/shell_command_class.cc
r7216 r7219 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) … … 203 203 /* for (unsigned int i = 0; i< elem->paramCount; i++) 204 204 PRINT(0)("%s ", ShellCommand::paramToString(elem->parameters[i]));*/ 205 if ( (*cmdIT)->description != NULL)206 PRINT(0)("- %s", (*cmdIT)->description );205 if (!(*cmdIT)->description.empty()) 206 PRINT(0)("- %s", (*cmdIT)->description.c_str()); 207 207 PRINT(0)("\n"); 208 208 } -
branches/std/src/lib/shell/shell_command_class.h
r7216 r7219 39 39 virtual ~ShellCommandClass(); 40 40 41 static const ShellCommandClass* isRegistered(const char*className);41 static const ShellCommandClass* isRegistered(const std::string& className); 42 42 static void initCommandClassList(); 43 43
Note: See TracChangeset
for help on using the changeset viewer.