Changeset 7412 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Apr 28, 2006, 12:03:54 AM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r7411 r7412 295 295 } 296 296 297 ShellCommand* ShellCommand::completionPlugin(unsigned int parameter, const CompletorPlugin& completorPlugin) 298 { 299 if (this == NULL || this->executor == NULL) 300 return NULL; 301 302 if (parameter >= this->executor->getParamCount()) 303 { 304 PRINTF(1)("Parameter %d not inside of valid ParameterCount %d of Command %s::%s\n", 305 parameter, this->executor->getParamCount(), this->getName(), this->shellClass->getName()); 306 } 307 else 308 { 309 delete this->completors[parameter]; 310 this->completors[parameter] = completorPlugin.clone(); 311 } 312 return this; 313 } 314 315 297 316 /** 298 317 * @brief prints out nice information about the Shells Commands … … 331 350 332 351 352 353 /////////// 354 // ALIAS // 355 /////////// 356 333 357 /** 334 358 * @param aliasName the name of the Alias -
trunk/src/lib/shell/shell_command.h
r7411 r7412 62 62 friend class ShellCommandClass; 63 63 public: 64 //! an enumerator for different types the Shell parses.65 typedef enum {66 NullRecognition = 0,67 ClassRecognition = 1,68 ObjectRecognition = 2,69 FunctionRecognition = 4,70 AliasRecognition = 8,71 ParameterRecognition = 16,72 } RecognitionType;73 74 64 static bool execute (const std::string& executionString); 75 65 … … 79 69 const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL, 80 70 const MultiType& value4 = MT_NULL); 71 ShellCommand* completionPlugin(unsigned int parameter, const CompletorPlugin& completorPlugin); 81 72 82 73 static ShellCommand* registerCommand(const std::string& commandName, const std::string& className, const Executor& executor); -
trunk/src/lib/shell/shell_completion.cc
r7409 r7412 114 114 if (sc != NULL) 115 115 { 116 std::vector<std::string> test; 117 sc->getCompletorPlugin(0)->addToCompleteList(test, inputSplits[inputSplits.size()-1]); 116 std::vector<std::string> completed; 117 sc->getCompletorPlugin(0)->addToCompleteList(completed, inputSplits[inputSplits.size()-1]); 118 for (unsigned int i = 0; i < completed.size(); i++) 119 this->completionList.push_back(CompletionElement(completed[i], ParamCompletion)); 118 120 } 119 121 } … … 256 258 !nocaseCmp(*string, completionBegin, searchLength)) 257 259 { 258 CompletionElement newElem; 259 newElem.name = (*string); 260 newElem.type = type; 261 this->completionList.push_back(newElem); 260 this->completionList.push_back(CompletionElement (*string, type)); 262 261 } 263 262 } … … 282 281 !nocaseCmp((*bo)->getName(), completionBegin, searchLength)) 283 282 { 284 CompletionElement newElem; 285 newElem.name = (*bo)->getName(); 286 newElem.type = type; 287 this->completionList.push_back(newElem); 283 this->completionList.push_back(CompletionElement((*bo)->getName(), type)); 288 284 } 289 285 } … … 316 312 case AliasCompletion: 317 313 return typeNames[4]; 314 case ParamCompletion: 315 return typeNames[5]; 318 316 } 319 317 } … … 326 324 "object", 327 325 "function", 328 "alias" 326 "alias", 327 "parameter", 329 328 }; 330 329 -
trunk/src/lib/shell/shell_completion.h
r7406 r7412 29 29 FunctionCompletion = 4, 30 30 AliasCompletion = 8, 31 ParamCompletion = 16, 31 32 } CompletionType; 32 33 … … 34 35 struct CompletionElement 35 36 { 37 CompletionElement(std::string name, CompletionType type) : name(name), type(type) {} 36 38 std::string name; //!< the Name of the Element to be completed. 37 39 CompletionType type; //!< the type of the Element -
trunk/src/lib/shell/shell_completion_plugin.cc
r7409 r7412 47 47 void CompletorStringArray::addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const 48 48 { 49 printf("TEST\n"); 49 50 unsigned int inputLen = completionBegin.size(); 50 51 for (unsigned int i = 0; i < this->_size; ++i) 52 { 53 printf("%s\n", this->_stringArray[i].c_str()); 51 54 if (!nocaseCmp(this->_stringArray[i], completionBegin, inputLen)) 52 55 completionList.push_back(this->_stringArray[i]); 56 } 53 57 } 54 58 -
trunk/src/lib/util/helper_functions.cc
r7371 r7412 146 146 int nocaseCmp(const std::string& s1, const std::string& s2, unsigned int len) 147 147 { 148 if (len == 0) 149 return 0; 148 150 std::string::const_iterator it1=s1.begin(); 149 151 std::string::const_iterator it2=s2.begin();
Note: See TracChangeset
for help on using the changeset viewer.