Changeset 7390 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Apr 26, 2006, 11:43:19 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command_class.cc
r7389 r7390 56 56 57 57 /** 58 * collects the Commands registered to some class. 59 * @param className the name of the Class to collect the Commands from. 60 * @param stringList a List to paste the Commands into. 61 * @returns true on success, false otherwise 62 */ 63 bool ShellCommandClass::getCommandListOfClass(const std::string& className, std::list<std::string>& stringList) 64 { 65 std::list<ShellCommandClass*>::iterator elem; 66 for(elem = ShellCommandClass::commandClassList->begin(); elem != ShellCommandClass::commandClassList->end(); elem++) 67 { 68 if (className == (*elem)->getName()) 69 { 70 std::vector<ShellCommand*>::iterator command; 71 for(command = (*elem)->commandList.begin(); command != (*elem)->commandList.end(); command++) 72 stringList.push_back((*command)->getName()); 73 } 74 } 75 return true; 58 * @param command the Command to register. 59 */ 60 void ShellCommandClass::registerCommand(ShellCommand* command) 61 { 62 this->commandList.push_back(command); 63 } 64 65 /** 66 * @brief unregister command. 67 * @param command the Command to unregister. 68 */ 69 void ShellCommandClass::unregisterCommand(ShellCommand* command) 70 { 71 std::vector<ShellCommand*>::iterator delC = std::find(this->commandList.begin(), this->commandList.end(), command); 72 if (delC != this->commandList.end()) 73 this->commandList.erase(delC); 76 74 } 77 75 … … 93 91 } 94 92 93 94 /** 95 * @brief collects the Commands registered to some class. 96 * @param className the name of the Class to collect the Commands from. 97 * @param stringList a List to paste the Commands into. 98 * @returns true on success, false otherwise 99 */ 100 bool ShellCommandClass::getCommandListOfClass(const std::string& className, std::list<std::string>& stringList) 101 { 102 std::list<ShellCommandClass*>::iterator elem; 103 for(elem = ShellCommandClass::commandClassList->begin(); elem != ShellCommandClass::commandClassList->end(); elem++) 104 { 105 if (className == (*elem)->getName()) 106 { 107 std::vector<ShellCommand*>::iterator command; 108 for(command = (*elem)->commandList.begin(); command != (*elem)->commandList.end(); command++) 109 stringList.push_back((*command)->getName()); 110 } 111 } 112 return true; 113 } 114 115 95 116 /** 96 117 * @brief checks if a Class is already registered to the Commands' class-stack … … 118 139 119 140 /** 120 * searches for a CommandClass141 * @brief searches for a CommandClass 121 142 * @param className the name of the CommandClass 122 143 * @returns the CommandClass if found, or a new CommandClass if not … … 186 207 } 187 208 188 void ShellCommandClass::registerCommand(ShellCommand* command)189 {190 this->commandList.push_back(command);191 }192 193 194 void ShellCommandClass::unregisterCommand(ShellCommand* command)195 {196 std::vector<ShellCommand*>::iterator delC = std::find(this->commandList.begin(), this->commandList.end(), command);197 if (delC != this->commandList.end())198 this->commandList.erase(delC);199 }200 201 202 203 209 } 204 210
Note: See TracChangeset
for help on using the changeset viewer.