Changeset 9697 in orxonox.OLD for branches/new_class_id/src/lib/shell/shell_completion.cc
- Timestamp:
- Aug 25, 2006, 12:03:08 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/shell/shell_completion.cc
r9406 r9697 23 23 24 24 #include "substring.h" 25 #include "class_list.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 NewClassID classID; 53 const NewObjectListBase* 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 = NewObjectListBase::getObjectList(inputSplits[0]); 87 if (objectList != NULL) 88 classID = objectList->identity(); 89 if (classID != NullClass::classID()) 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 (NewObjectListBase::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 NewObjectListBase* objectList) 136 { 137 assert (objectList != NULL); 138 139 CompletionType type = ObjectCompletion; 140 if (objectList == &ShellCommandClass::objectList()) 141 type = ClassCompletion; 142 143 /// FIXME 144 // if (!this->addToCompleteList(*boList, objectBegin, type)) 145 // return false; 146 148 147 return true; 149 148 } … … 321 320 switch (type) 322 321 { 323 324 325 326 327 328 329 330 331 332 333 334 322 default:// SHELLC_NONE 323 return typeNames[0]; 324 case ClassCompletion: 325 return typeNames[1]; 326 case ObjectCompletion: 327 return typeNames[2]; 328 case FunctionCompletion: 329 return typeNames[3]; 330 case AliasCompletion: 331 return typeNames[4]; 332 case ParamCompletion: 333 return typeNames[5]; 335 334 } 336 335 }
Note: See TracChangeset
for help on using the changeset viewer.