Changeset 7418 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Apr 28, 2006, 11:31:09 AM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r7417 r7418 168 168 { 169 169 assert ((*alias)->getCommand() != NULL && (*alias)->getCommand()->shellClass != NULL); 170 // Search for Objects. 171 if (strings.size() == 1) 172 fillObjectList("", (*alias)->getCommand(), boList); 173 else 174 { 175 if (!fillObjectList(strings[1], (*alias)->getCommand(), boList)) 176 fillObjectList("", (*alias)->getCommand(), boList); 177 } 170 178 return (*alias)->getCommand(); 171 179 } … … 180 188 if (strings.size() >= 1) 181 189 { 190 // Search for Objects. 182 191 retCmd = ShellCommand::getCommand(strings[1], cmdClass); 183 192 if (retCmd != NULL) 184 193 { 185 194 paramBegin = 2; 195 fillObjectList("", retCmd, boList); 186 196 return retCmd; 187 197 } … … 194 204 { 195 205 paramBegin = 3; 206 fillObjectList(strings[1], retCmd, boList); 196 207 return retCmd; 197 208 } … … 205 216 } 206 217 207 bool ShellCommand::fillObjectList(const std::string& objectDescriptor, ShellCommand* cmd, std::vector<BaseObject*>* boList) 208 { 209 assert (cmd != NULL && cmd->shellClass != NULL && boList != NULL); 218 /** 219 * @brief fills the ObjectList boList with Objects that can be reffered to by cmd. 220 * @param objectDescriptor: the ObjectName (beginning, full name or empty) to fill the List with 221 * @param cmd: The Command to complete Objects for. 222 * @param boList: The List of BaseObject's that will be filled with found entries. 223 * @returns: true if more than one Entry was fond, else (false , or if boList is NULL). 224 */ 225 bool ShellCommand::fillObjectList(const std::string& objectDescriptor, const ShellCommand* cmd, std::vector<BaseObject*>* boList) 226 { 227 assert (cmd != NULL && cmd->shellClass != NULL); 228 if(boList == NULL) 229 return false; 210 230 211 231 const std::list<BaseObject*>* objectList = ClassList::getList(cmd->shellClass->getName()); … … 228 248 } 229 249 } 250 return !boList->empty(); 230 251 } 231 252 -
trunk/src/lib/shell/shell_command.h
r7417 r7418 90 90 virtual ~ShellCommand(); 91 91 92 static bool fillObjectList(const std::string& objectDescriptor, ShellCommand* cmd, std::vector<BaseObject*>* boList);92 static bool fillObjectList(const std::string& objectDescriptor, const ShellCommand* cmd, std::vector<BaseObject*>* boList); 93 93 static const std::string& paramToString(long parameter); 94 94
Note: See TracChangeset
for help on using the changeset viewer.