Changeset 7403 in orxonox.OLD for trunk/src/lib/shell/shell_completion.cc
- Timestamp:
- Apr 27, 2006, 5:49:12 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_completion.cc
r7393 r7403 51 51 bool ShellCompletion::autoComplete(std::string& input) 52 52 { 53 long classID ;//< the classID retrieved from the Class.54 const std::list<BaseObject*>* objectList; //< the list of Objects stored in classID 53 long classID = CL_NULL; //< the classID retrieved from the Class. 54 const std::list<BaseObject*>* objectList; //< the list of Objects stored in classID's ClassList 55 55 bool emptyComplete = false; //< if the completion input is empty string. e.g "" 56 56 long completeType = NullCompletion; //< the Type we'd like to complete. 57 std::string completeString ;//< the string to complete.57 std::string completeString = ""; //< the string to complete. 58 58 59 59 … … 62 62 63 63 // Check if we are in a input. eg. the supplied string "class " and now we complete either function or object 64 if (input [input.size()-1] == ' ')64 if (input.empty() || input[input.size()-1] == ' ') 65 65 emptyComplete = true; 66 66 … … 69 69 70 70 // What String will be completed 71 if (emptyComplete == true) 72 completeString = ""; 73 else 71 if (!emptyComplete && inputSplits.size() >= 1) 74 72 completeString = inputSplits.getString(inputSplits.size()-1); 75 73 76 // CLASS COMPLETION77 if (inputSplits.size() == 0 )74 // CLASS/ALIAS COMPLETION (on first argument) 75 if (inputSplits.size() == 0 || (!emptyComplete && inputSplits.size() == 1)) 78 76 { 79 77 completeType |= ClassCompletion; 80 78 completeType |= AliasCompletion; 81 79 } 82 else if (inputSplits.size() == 1 && emptyComplete == false)83 {84 completeType |= ClassCompletion;85 completeType |= AliasCompletion;86 }87 80 88 81 // OBJECT/FUNCTION COMPLETIONS 89 else if (( inputSplits.size() == 1 && emptyComplete == true) ||90 (inputSplits.size() == 2 && emptyComplete == false))82 else if ((emptyComplete && inputSplits.size() == 1) || 83 (!emptyComplete && inputSplits.size() == 2)) 91 84 { 92 85 classID = ClassList::StringToID(inputSplits.getString(0)); … … 94 87 if (classID != CL_NULL) 95 88 completeType |= ObjectCompletion; 96 //if (objectList != NULL && objectList->getSize() == 1)97 89 completeType |= FunctionCompletion; 98 90 } 99 else if ((inputSplits.size() == 2 && emptyComplete == true) || 100 (inputSplits.size() == 3 && emptyComplete == false)) 101 { 102 classID = ClassList::StringToID(inputSplits.getString(0)); 103 if (classID == CL_NULL) 104 return false; 105 else 91 else if ((emptyComplete && inputSplits.size() == 2 ) || 92 (!emptyComplete && inputSplits.size() == 3)) 93 { 94 if (ClassList::exists(inputSplits[0], inputSplits[1])) 106 95 completeType |= FunctionCompletion; 107 96 }
Note: See TracChangeset
for help on using the changeset viewer.