Changeset 5194 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- Sep 18, 2005, 1:48:57 AM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_completion.cc
r5193 r5194 19 19 20 20 #include "shell_input.h" 21 #include "shell_command.h" 21 22 22 23 #include "substring.h" … … 64 65 bool ShellCompletion::autoComplete(ShellInput* input) 65 66 { 66 const char* completionLine; 67 const char* completionLine; //< the inputLine we complete. 67 68 68 69 long classID; //< the classID retrieved from the Class. 69 70 tList<BaseObject>* objectList; //< the list of Objects stored in classID 70 71 bool emptyComplete = false; //< if the completion input is empty string. e.g "" 71 SHELLC_TYPE firstType = SHELLC_NONE; 72 SHELLC_TYPE secondType = SHELLC_NONE; 73 long completeType = SHELLC_NONE; 74 const char* completeString; 72 long completeType = SHELLC_NONE; //< the Type we'd like to complete. 73 const char* completeString; //< the string to complete. 75 74 76 75 … … 123 122 { 124 123 classID = ClassList::StringToID(inputSplits.getString(0)); 124 objectList = ClassList::getList(classID); 125 125 if (classID == CL_NULL) 126 {127 126 return false; 128 }129 127 else 130 128 { 129 if (objectList != NULL && objectList->getSize() == 1) 130 completeType |= SHELLC_FUNCTION; 131 131 completeType |= SHELLC_OBJECT; 132 132 } 133 } 134 else if ((inputSplits.getCount() == 2 && emptyComplete == true) || 135 (inputSplits.getCount() == 3 && emptyComplete == false)) 136 { 137 classID = ClassList::StringToID(inputSplits.getString(0)); 138 if (classID == CL_NULL) 139 return false; 140 else 141 completeType |= SHELLC_FUNCTION; 133 142 } 134 143 … … 137 146 if (completeType & SHELLC_OBJECT) 138 147 this->objectComplete(completeString, classID); 139 140 if (emptyComplete == false) 141 this->generalComplete(inputSplits.getString(inputSplits.getCount()-1)); 142 else 143 this->generalComplete(""); 148 if (completeType & SHELLC_FUNCTION) 149 this->functionComplete(completeString, classID); 150 151 152 this->generalComplete(completeString); 153 return true; 144 154 } 145 155 … … 190 200 * @param functionBegin the beginning of the function String 191 201 */ 192 bool ShellCompletion::functionComplete(const char* functionBegin) 193 { 202 bool ShellCompletion::functionComplete(const char* functionBegin, long classID) 203 { 204 if (unlikely(functionBegin == NULL)) 205 return false; 206 tList<const char> fktList; 207 ShellCommandClass::getCommandListOfClass(ClassList::IDToString(classID), &fktList); 208 //printf("%s\n", boList->firstElement()->getName()); 209 if (!this->addToCompleteList(&fktList, functionBegin)) 210 return false; 211 return true; 194 212 } 195 213 -
trunk/src/lib/shell/shell_completion.h
r5193 r5194 40 40 bool objectComplete(const char* objectBegin, long classID); 41 41 bool objectMatch(const char* objectBegin, long classID, unsigned int* length); 42 bool functionComplete(const char* functionBegin );42 bool functionComplete(const char* functionBegin, long classID); 43 43 bool functionMatch(const char* functionBegin, long classID, unsigned int* length); 44 44
Note: See TracChangeset
for help on using the changeset viewer.