Changeset 7417 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- Apr 28, 2006, 11:11:57 AM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r7415 r7417 141 141 * @returns: The ShellCommand if found. 142 142 */ 143 const ShellCommand* const ShellCommand::getCommandFromInput(const std::string& inputLine, unsigned int& paramBegin )143 const ShellCommand* const ShellCommand::getCommandFromInput(const std::string& inputLine, unsigned int& paramBegin, std::vector<BaseObject*>* boList) 144 144 { 145 145 ShellCommand::getCommandFromInput(SubString(inputLine, SubString::WhiteSpaces), paramBegin); … … 152 152 * @returns: The ShellCommand if found. 153 153 */ 154 const ShellCommand* const ShellCommand::getCommandFromInput(const SubString& strings, unsigned int& paramBegin )154 const ShellCommand* const ShellCommand::getCommandFromInput(const SubString& strings, unsigned int& paramBegin, std::vector<BaseObject*>* boList) 155 155 { 156 156 // no input, no Command. … … 172 172 } 173 173 174 // CHECK FOR COMMAND_CLASS 174 175 const ShellCommandClass* cmdClass = ShellCommandClass::getCommandClass(strings[0]); 175 176 if (cmdClass != NULL) 176 177 { 177 178 const ShellCommand* retCmd; 179 // Function/Command right after Class 178 180 if (strings.size() >= 1) 179 181 { 180 182 retCmd = ShellCommand::getCommand(strings[1], cmdClass); 181 paramBegin = 2; 182 } 183 if (retCmd != NULL) 184 { 185 paramBegin = 2; 186 return retCmd; 187 } 188 } 189 // Function/Command after Class and 'Object' 183 190 if (retCmd == NULL && strings.size() >= 2) 184 191 { 185 192 retCmd = ShellCommand::getCommand(strings[2], cmdClass); 193 if (retCmd != NULL) 194 { 186 195 paramBegin = 3; 196 return retCmd; 197 } 187 198 } 188 199 if (retCmd != NULL) // check for the paramBegin. 189 200 return retCmd; 190 201 } 202 // Nothing usefull found at all. 191 203 paramBegin = 0; 192 204 return NULL; 193 205 } 194 206 207 bool ShellCommand::fillObjectList(const std::string& objectDescriptor, ShellCommand* cmd, std::vector<BaseObject*>* boList) 208 { 209 assert (cmd != NULL && cmd->shellClass != NULL && boList != NULL); 210 211 const std::list<BaseObject*>* objectList = ClassList::getList(cmd->shellClass->getName()); 212 if (objectList != NULL) 213 { 214 std::list<BaseObject*>::const_iterator bo; 215 216 // No Description given (only for speedup) 217 if (objectDescriptor.empty()) 218 { 219 for (bo = objectList->begin(); bo != objectList->end(); bo++) 220 boList->push_back(*bo); 221 } 222 // some description 223 else 224 { 225 for (bo = objectList->begin(); bo != objectList->end(); bo++) 226 if ((*bo)->getName() != NULL && nocaseCmp(objectDescriptor, (*bo)->getName(), objectDescriptor.size())) 227 boList->push_back(*bo); 228 } 229 } 230 } 195 231 196 232 /** -
trunk/src/lib/shell/shell_command.h
r7414 r7417 76 76 static const ShellCommand* const getCommand(const std::string& commandName, const ShellCommandClass* cmdClass); 77 77 static bool exists(const std::string& commandName, const std::string& className); 78 static const ShellCommand* const getCommandFromInput(const std::string& inputLine, unsigned int& paramBegin );79 static const ShellCommand* const getCommandFromInput(const SubString& strings, unsigned int& paramBegin );78 static const ShellCommand* const getCommandFromInput(const std::string& inputLine, unsigned int& paramBegin, std::vector<BaseObject*>* boList = NULL); 79 static const ShellCommand* const getCommandFromInput(const SubString& strings, unsigned int& paramBegin, std::vector<BaseObject*>* boList = NULL); 80 80 81 81 const ShellCommandClass* const getCommandClass() const { return this->shellClass; }; … … 90 90 virtual ~ShellCommand(); 91 91 92 static bool fillObjectList(const std::string& objectDescriptor, ShellCommand* cmd, std::vector<BaseObject*>* boList); 92 93 static const std::string& paramToString(long parameter); 93 94
Note: See TracChangeset
for help on using the changeset viewer.