Changeset 9869 in orxonox.OLD for trunk/src/lib/shell/shell_completion.cc
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_completion.cc
r9406 r9869 22 22 #include "shell_command.h" 23 23 24 #include "substring.h" 25 #include "class_list.h" 24 #include "helper_functions.h" 26 25 #include "debug.h" 27 26 … … 51 50 bool ShellCompletion::autoComplete(std::string& input) 52 51 { 53 long classID = CL_NULL; //< the classID retrieved from the Class.54 const std::list<BaseObject*>* objectList = NULL;//< the list of Objects stored in classID's ClassList52 ClassID classID; 53 const ObjectListBase* objectList = NULL; //< the list of Objects stored in classID's ClassList 55 54 bool emptyComplete = false; //< if the completion input is empty string. e.g "" 56 55 long completeType = NullCompletion; //< the Type we'd like to complete. … … 85 84 (!emptyComplete && inputSplits.size() == 2)) 86 85 { 87 classID = ClassList::StringToID(inputSplits.getString(0)); 88 objectList = ClassList::getList((ClassID)classID); 89 if (classID != CL_NULL) 86 objectList = ObjectListBase::getObjectList(inputSplits[0]); 87 if (objectList != NULL) 88 classID = objectList->identity(); 89 if (classID != NullClass::staticClassID()) 90 90 completeType |= ObjectCompletion; 91 91 completeType |= FunctionCompletion; … … 95 95 (!emptyComplete && inputSplits.size() == 3)) 96 96 { 97 if ( ClassList::exists(inputSplits[0], inputSplits[1]))97 if (ObjectListBase::getBaseObject(inputSplits[0], inputSplits[1])) 98 98 completeType |= FunctionCompletion; 99 99 } … … 113 113 114 114 if (completeType & ClassCompletion) 115 this->objectComplete(completeString, CL_SHELL_COMMAND_CLASS);115 this->objectComplete(completeString, &ShellCommandClass::objectList()); 116 116 if (completeType & ObjectCompletion) 117 this->objectComplete(completeString, classID);117 this->objectComplete(completeString, objectList); 118 118 if (completeType & FunctionCompletion) 119 119 this->commandComplete(completeString, inputSplits[0]); … … 133 133 * @return true on success, false otherwise 134 134 */ 135 bool ShellCompletion::objectComplete(const std::string& objectBegin, long classID) 136 { 137 const std::list<BaseObject*>* boList = ClassList::getList((ClassID)classID); 138 if (boList != NULL) 139 { 140 CompletionType type = ObjectCompletion; 141 if (classID == CL_SHELL_COMMAND_CLASS) 142 type = ClassCompletion; 143 if (!this->addToCompleteList(*boList, objectBegin, type)) 144 return false; 145 } 146 else 147 return false; 135 bool ShellCompletion::objectComplete(const std::string& objectBegin, const ObjectListBase* objectList) 136 { 137 assert (objectList != NULL); 138 139 CompletionType type = ObjectCompletion; 140 if (objectList == &ShellCommandClass::objectList()) 141 type = ClassCompletion; 142 143 ObjectListBase::base_list list; 144 objectList->getBaseObjectList(&list); 145 146 if (!this->addToCompleteList(list, objectBegin, type)) 147 return false; 148 148 149 return true; 149 150 } … … 321 322 switch (type) 322 323 { 323 324 325 326 327 328 329 330 331 332 333 334 324 default:// SHELLC_NONE 325 return typeNames[0]; 326 case ClassCompletion: 327 return typeNames[1]; 328 case ObjectCompletion: 329 return typeNames[2]; 330 case FunctionCompletion: 331 return typeNames[3]; 332 case AliasCompletion: 333 return typeNames[4]; 334 case ParamCompletion: 335 return typeNames[5]; 335 336 } 336 337 }
Note: See TracChangeset
for help on using the changeset viewer.