Changeset 5190 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Sep 18, 2005, 12:09:36 AM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r5189 r5190 61 61 } 62 62 63 tList<const char>* ShellCommandClass::getCommandListOfClass(const char* className) 64 { 65 tList<const char>* retList; 63 bool ShellCommandClass::getCommandListOfClass(const char* className, tList<const char>* stringList) 64 { 65 if (stringList == NULL) 66 return false; 67 66 68 tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator(); 67 69 ShellCommandClass* elem = iterator->firstElement(); … … 74 76 while (command != NULL) 75 77 { 76 retList->add(command->getName());78 stringList->add(command->getName()); 77 79 command = itFkt->nextElement(); 78 80 } … … 83 85 } 84 86 delete iterator; 85 return retList;87 return true; 86 88 } 87 89 -
trunk/src/lib/shell/shell_command.h
r5189 r5190 43 43 //////////////// 44 44 class ShellCommandBase; 45 class ShellCommandAlias; 45 46 46 47 //! A class to hold all Classes that have (once) registered Commands. … … 51 52 public: 52 53 static const tList<ShellCommandClass>* getCommandClassList() { return ShellCommandClass::commandClassList; }; 53 static tList<const char>* getCommandListOfClass(const char* className); 54 static bool ShellCommandClass::getCommandListOfClass(const char* className, tList<const char>* stringList); 55 54 56 static ShellCommandClass* getCommandClass(const char* className); 55 57 static void unregisterAllCommands(); … … 67 69 tList<ShellCommandBase>* commandList; //!< A list of Commands from this Class 68 70 static tList<ShellCommandClass>* commandClassList; //!< A list of Classes 71 static tList<ShellCommandAlias>* aliasesList; //!< An Alias to A Command. (only for classes with one Instance) 69 72 }; 70 73 … … 78 81 79 82 ShellCommandBase* describe(const char* description); 83 ShellCommandBase* setAlias(const char* alias); 80 84 81 85 /** @returns the CommandList of the Shell */ … … 312 316 }; 313 317 318 class ShellCommandAlias 319 { 320 public: 321 ShellCommandAlias(const char* aliasName, ShellCommandBase* command) { this->aliasName = aliasName; this->command = command; }; 322 private: 323 const char* aliasName; 324 ShellCommandBase* command; 325 }; 326 327 314 328 #endif /* _SHELL_COMMAND_H */ -
trunk/src/lib/shell/shell_completion.cc
r5188 r5190 68 68 long classID; //< the classID retrieved from the Class. 69 69 tList<BaseObject>* objectList; //< the list of Objects stored in classID 70 char* classBegin; //< the beginn of the slass string 71 char* classEnd; //< the end of the class string 72 char* objectBegin; //< the begin of the object string 73 char* objectEnd; //< the end of the object string 74 char* functionBegin; //< the begin of the function string 75 char* functionEnd; //< the end of the function string 70 bool emptyComplete = false; //< if the completion input is empty string. e.g "" 71 76 72 77 73 PRINTF(4)("AutoComplete on input\n"); … … 85 81 return false; 86 82 } 83 84 // Check if we are in a input. eg. the supplied string "class " and now we complete either function or object 85 if (this->input->getInput() == NULL || strlen(this->input->getInput()) == 0 || 86 (this->input->getInput() != NULL && 87 strrchr(this->input->getInput(), ' ') >= this->input->getInput() + strlen(this->input->getInput())-1)) 88 { 89 emptyComplete = true; 90 } 91 87 92 if (this->input->getInput() == NULL) 93 { 88 94 return this->objectComplete("", CL_SHELL_COMMAND_CLASS); 89 95 } 90 96 91 97 completionLine = this->input->getInput() + strspn(this->input->getInput(), " \t\n"); … … 169 175 else 170 176 return false; 177 delete classList; 171 178 } 172 179 else … … 333 340 } 334 341 342 335 343 void ShellCompletion::emptyCompletionList() 336 344 {
Note: See TracChangeset
for help on using the changeset viewer.