Changeset 7371 in orxonox.OLD for trunk/src/lib/shell/shell_completion.cc
- Timestamp:
- Apr 26, 2006, 2:12:45 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_completion.cc
r7344 r7371 63 63 64 64 PRINTF(5)("AutoComplete on input\n"); 65 this-> emptyCompletionList();65 this->clearCompletionList(); 66 66 67 67 // Check if we are in a input. eg. the supplied string "class " and now we complete either function or object … … 135 135 if (clList != NULL) 136 136 { 137 if (!this->addToCompleteList( clList, classBegin, SHELLC_CLASS))137 if (!this->addToCompleteList(*clList, classBegin, SHELLC_CLASS)) 138 138 return false; 139 139 } … … 157 157 if (classID == CL_SHELL_COMMAND_CLASS) 158 158 type = SHELLC_CLASS; 159 if (!this->addToCompleteList( boList, objectBegin, type))159 if (!this->addToCompleteList(*boList, objectBegin, type)) 160 160 return false; 161 161 } … … 175 175 ShellCommandClass::getCommandListOfClass(className, &fktList); 176 176 //printf("%s\n", boList->firstElement()->getName()); 177 if (!this->addToCompleteList( &fktList, functionBegin, SHELLC_FUNCTION))177 if (!this->addToCompleteList(fktList, functionBegin, SHELLC_FUNCTION)) 178 178 return false; 179 179 return true; … … 190 190 ShellCommandClass::getCommandListOfAlias(&aliasList); 191 191 //printf("%s\n", boList->firstElement()->getName()); 192 if (!this->addToCompleteList( &aliasList, aliasBegin, SHELLC_ALIAS))192 if (!this->addToCompleteList(aliasList, aliasBegin, SHELLC_ALIAS)) 193 193 return false; 194 194 return true; … … 265 265 * !! The strings MUST NOT be deleted !! 266 266 */ 267 bool ShellCompletion::addToCompleteList(const std::list<std::string>* inputList, const std::string& completionBegin, SHELLC_TYPE type) 268 { 269 if (inputList == NULL) 270 return false; 267 bool ShellCompletion::addToCompleteList(const std::list<std::string>& inputList, const std::string& completionBegin, SHELLC_TYPE type) 268 { 271 269 unsigned int searchLength = completionBegin.size(); 272 270 273 list<std::string>::const_iterator string;274 for (string = inputList ->begin(); string != inputList->end(); string++)271 std::list<std::string>::const_iterator string; 272 for (string = inputList.begin(); string != inputList.end(); string++) 275 273 { 276 274 if ((*string).size() >= searchLength && 277 ! strncasecmp((*string).c_str(), completionBegin.c_str(), searchLength))275 !nocaseCmp(*string, completionBegin, searchLength)) 278 276 { 277 printf ("%s\n", (*string).c_str()); 279 278 ShellC_Element newElem; 280 newElem.name = (*string) .c_str();279 newElem.name = (*string); 281 280 newElem.type = type; 282 281 this->completionList.push_back(newElem); … … 292 291 * !! The strings MUST NOT be deleted !! 293 292 */ 294 bool ShellCompletion::addToCompleteList(const std::list<BaseObject*>* inputList, const std::string& completionBegin, SHELLC_TYPE type) 295 { 296 if (inputList == NULL) 297 return false; 293 bool ShellCompletion::addToCompleteList(const std::list<BaseObject*>& inputList, const std::string& completionBegin, SHELLC_TYPE type) 294 { 298 295 unsigned int searchLength = completionBegin.size(); 299 296 300 list<BaseObject*>::const_iterator bo;301 for(bo = inputList ->begin(); bo != inputList->end(); bo++)297 std::list<BaseObject*>::const_iterator bo; 298 for(bo = inputList.begin(); bo != inputList.end(); bo++) 302 299 { 303 300 if ((*bo)->getName() != NULL && 304 301 strlen((*bo)->getName()) >= searchLength && 305 ! strncasecmp((*bo)->getName(), completionBegin.c_str(), searchLength))302 !nocaseCmp((*bo)->getName(), completionBegin, searchLength)) 306 303 { 307 304 ShellC_Element newElem; … … 320 317 * This is done at the beginning of each completion-run 321 318 */ 322 void ShellCompletion:: emptyCompletionList()319 void ShellCompletion::clearCompletionList() 323 320 { 324 321 this->completionList.clear();
Note: See TracChangeset
for help on using the changeset viewer.