- Timestamp:
- Aug 22, 2005, 5:26:29 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/base_object.cc
r4942 r5102 52 52 // delete []this->className; 53 53 if (this->objectName) 54 delete []this->objectName;}54 delete[] this->objectName;} 55 55 56 56 /** … … 84 84 { 85 85 if (this->objectName) 86 delete []this->objectName;86 delete[] this->objectName; 87 87 if (objectName) 88 88 { -
trunk/src/lib/lang/base_object.h
r5039 r5102 27 27 28 28 void setName (const char* newName); 29 /** \briefreturns the Name of this Object */29 /** returns the Name of this Object */ 30 30 inline const char* getName ()const { return this->objectName; }; 31 31 -
trunk/src/lib/lang/class_list.cc
r4874 r5102 109 109 } 110 110 111 /** 112 * searches for classID and returns the list of Entities 113 * @param classID the ID of the class to get the list from 114 * @return the List accessed by classID, or NULL if not found 115 */ 111 116 tList<BaseObject>* ClassList::getList(long classID) 112 117 { … … 119 124 { 120 125 if (unlikely(tmpCL->classID == classID)) 126 return tmpCL->objectList; 127 tmpCL = tmpCL->next; 128 } 129 } 130 return NULL; 131 } 132 133 /** 134 * searches for className and returns the list of Entities 135 * @param className the name of the class to get the list from 136 * @return the List accessed by classID, or NULL if not found 137 */tList<BaseObject>* ClassList::getList(const char* className) 138 { 139 if(unlikely(ClassList::first == NULL)) 140 return NULL; 141 else 142 { 143 ClassList* tmpCL = ClassList::first; 144 while (likely(tmpCL != NULL)) 145 { 146 if (unlikely(!strcmp(tmpCL->className, className))) 121 147 return tmpCL->objectList; 122 148 tmpCL = tmpCL->next; … … 205 231 } 206 232 207 208 233 /** 209 234 * prints out a string of all the types this Object matches -
trunk/src/lib/lang/class_list.h
r5039 r5102 39 39 40 40 static tList<BaseObject>* getList(long classID = CL_NULL); 41 static tList<BaseObject>* getList(const char* className); 41 42 static BaseObject* getObject(const char* name, long classID = CL_NULL); 42 43 static bool exists(const BaseObject* object, long classID = CL_NULL); -
trunk/src/util/loading/load_param.cc
r5100 r5102 17 17 18 18 #include "list.h" 19 #include "array.h"20 19 #include "base_object.h" 21 20 … … 386 385 * searches for classes, which beginn with classNameBegin 387 386 * @param classNameBegin the beginning string of a Class 388 * @return a NEW char-array with ClassNames. The ARRAYshould be deleted afterwards,387 * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards, 389 388 * !! The strings MUST NOT be deleted !! 390 389 */ 391 Array<char*>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)390 tList<const char>* LoadClassDescription::searchClassWithShort(const char* classNameBegin) 392 391 { 393 392 unsigned int searchLength = strlen(classNameBegin); 394 Array<char*>* retVal = new Array<char*>;393 tList<const char>* retVal = new tList<const char>; 395 394 396 395 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); … … 401 400 !strncasecmp(enumClassDesc->className, classNameBegin, searchLength)) 402 401 { 403 retVal->add Entry(enumClassDesc->className);402 retVal->add(enumClassDesc->className); 404 403 } 405 404 enumClassDesc = iterator->nextElement(); … … 407 406 delete iterator; 408 407 409 retVal->finalizeArray();410 408 return retVal; 411 409 } -
trunk/src/util/loading/load_param.h
r5100 r5102 31 31 // Forward Declaration // 32 32 template<class T> class tList; 33 template<class T> class Array;34 33 35 34 //! macro that makes it even more easy to load a Parameter … … 312 311 313 312 static void printAll(const char* fileName = NULL); 314 static Array<char*>* searchClassWithShort(const char* classNameBegin);313 static tList<const char>* searchClassWithShort(const char* classNameBegin); 315 314 // static const LoadParamDescription* getClass(const char* className); 316 315 -
trunk/src/util/shell.cc
r5100 r5102 20 20 #include "text_engine.h" 21 21 #include "list.h" 22 #include "array.h"23 22 #include "graphics_engine.h" 24 23 #include "event_handler.h" … … 382 381 { 383 382 if (this->pressedKey == event.type) 383 { 384 384 this->pressedKey = SDLK_FIRST; 385 this->delayed = 0.0; 385 this->delayed = 0.0; 386 } 386 387 } 387 388 } … … 462 463 } 463 464 464 printf("%s\n",commandBegin); 465 Array<char*>* classArray = LoadClassDescription::searchClassWithShort(commandBegin); 466 if (classArray->getCount() == 0) 467 { 468 delete[] completionLine; 469 delete classArray; 465 this->classComplete(commandBegin); 466 467 delete[] completionLine; 468 } 469 470 /** 471 * autocompletes a className 472 * @param classBegin the Beginning of a String to autoComplete 473 * @return true on success, false otherwise 474 */ 475 bool Shell::classComplete(const char* classBegin) 476 { 477 if (unlikely(classBegin == NULL)) 478 return false; 479 tList<const char>* classList = LoadClassDescription::searchClassWithShort(classBegin); 480 if (classList->getSize() == 0) 481 { 482 delete classList; 470 483 //PRINTF(0)("no completion found for %s\n", commandBegin); 471 return false; 472 } 473 474 for (unsigned int i = 0; i < classArray->getCount(); i++) 475 { 476 PRINTF(0)("%s\n", classArray->getEntry(i)); 477 } 478 if (classArray->getCount() == 1) 479 { 480 this->removeCharacters(strlen(commandBegin)); 481 this->addCharacters(classArray->getEntry(0)); 482 this->addCharacter(' '); 483 } 484 485 delete[] completionLine; 486 delete classArray; 487 } 484 return false; 485 } 486 487 const char* addString = classList->firstElement(); 488 unsigned int addLength = 0; 489 unsigned int inputLenght = strlen(classBegin); 490 491 if (addString != NULL) 492 addLength = strlen(addString); 493 tIterator<const char>* charIterator = classList->getIterator(); 494 const char* charElem = charIterator->nextElement(); 495 while (charElem != NULL) 496 { 497 PRINTF(0)("%s:: ", charElem); 498 { 499 for (unsigned int i = inputLenght; i < addLength; i++) 500 if (addString[i] != charElem[i]) 501 { 502 addLength = i; 503 break; 504 } 505 } 506 507 charElem = charIterator->nextElement(); 508 } 509 delete charIterator; 510 511 if (addLength >= inputLenght) 512 { 513 char* adder = new char[addLength+1]; 514 strncpy(adder, addString, addLength); 515 adder[addLength] = '\0'; 516 this->removeCharacters(inputLenght); 517 this->addCharacters(adder); 518 // this->addCharacters("::"); 519 delete[] adder; 520 } 521 delete classList; 522 } 523 524 bool Shell::objectComplete(const char* objectBegin, ClassID classID) 525 { 526 527 } 528 529 bool Shell::functionComplete(const char* functionBegin) 530 { 531 } 532 533 488 534 489 535 /** -
trunk/src/util/shell.h
r5097 r5102 67 67 private: 68 68 bool autoComplete(); 69 bool classComplete(const char* classBegin); 70 bool objectComplete(const char* objectBegin, ClassID classID); 71 bool functionComplete(const char* functionBegin); 69 72 70 73
Note: See TracChangeset
for help on using the changeset viewer.