Changeset 5103 in orxonox.OLD for trunk/src/util/shell.cc
- Timestamp:
- Aug 22, 2005, 6:08:15 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/shell.cc
r5102 r5103 24 24 25 25 #include "load_param.h" 26 #include "class_list.h" 26 27 #include "debug.h" 27 28 #include <stdarg.h> … … 59 60 this->inputLineText->setParent2D(this); 60 61 62 this->completionList = NULL; 61 63 62 64 EventHandler* evh = EventHandler::getInstance(); … … 91 93 } 92 94 delete charIterator; 95 96 // if (this->completionList != NULL) 97 //delete this->completionList; 93 98 94 99 Shell::singletonRef = NULL; … … 465 470 this->classComplete(commandBegin); 466 471 467 472 delete[] completionLine; 468 473 } 469 474 … … 477 482 if (unlikely(classBegin == NULL)) 478 483 return false; 479 tList<const char>* classList = LoadClassDescription::searchClassWithShort(classBegin);484 const tList<const char>* classList = this->searchClassWithShort(classBegin); 480 485 if (classList->getSize() == 0) 481 486 { 482 delete classList;483 487 //PRINTF(0)("no completion found for %s\n", commandBegin); 484 488 return false; … … 519 523 delete[] adder; 520 524 } 521 delete classList;522 525 } 523 526 … … 529 532 bool Shell::functionComplete(const char* functionBegin) 530 533 { 534 } 535 536 537 /** 538 * searches for classes, which beginn with classNameBegin 539 * @param classNameBegin the beginning string of a Class 540 * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards, 541 * !! The strings MUST NOT be deleted !! 542 */ 543 const tList<const char>* Shell::searchClassWithShort(const char* classNameBegin) 544 { 545 unsigned int searchLength = strlen(classNameBegin); 546 if (this->completionList != NULL) 547 delete this->completionList; 548 this->completionList = new tList<const char>; 549 550 // tList<const char>* classList = ClassList::getClassList(); 551 552 tIterator<const char>* iterator = ClassList::getClassList()->getIterator(); 553 const char* enumString = iterator->nextElement(); 554 while (enumString != NULL) 555 { 556 if (strlen(enumString)>searchLength+1 && 557 !strncasecmp(enumString, classNameBegin, searchLength)) 558 { 559 this->completionList->add(enumString); 560 } 561 enumString = iterator->nextElement(); 562 } 563 delete iterator; 564 565 return this->completionList; 531 566 } 532 567 … … 540 575 if (this->pressedKey != SDLK_FIRST) 541 576 printf("%s::%f %f\n", SDLKToKeyname(this->pressedKey), this->delayed, this->repeatDelay); 542 543 } 577 }
Note: See TracChangeset
for help on using the changeset viewer.