Changeset 5637 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- Nov 18, 2005, 7:04:02 PM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r5636 r5637 280 280 * @param paramCount the count of parameters this command takes 281 281 */ 282 ShellCommand::ShellCommand(const char* commandName, const char* className, unsigned int paramCount, ...)282 ShellCommand::ShellCommand(const char* commandName, const char* className, Executor* executor) 283 283 { 284 284 this->setClassID(CL_SHELL_COMMAND, "ShellCommand"); … … 298 298 this->defaultValue = new MultiType[paramCount]; 299 299 300 va_list parameterList; 301 va_start(parameterList, paramCount); 302 303 // What Parameters we have got 304 for (unsigned int i = 0; i < paramCount; i++) 305 this->parameters[i] = va_arg(parameterList, int); 300 this->executor = executor; 306 301 } 307 302 … … 325 320 ShellCommand* ShellCommand::registerCommand(const char* commandName, const char* className, Executor* executor) 326 321 { 327 return NULL; 322 if (ShellCommand::isRegistered(commandName, className, executor)) 323 return NULL; 324 else 325 return new ShellCommand(commandName, className, executor); 328 326 329 327 } … … 378 376 * This is checked in the registerCommand-function. 379 377 */ 380 bool ShellCommand::isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...)378 bool ShellCommand::isRegistered(const char* commandName, const char* className, Executor* executor) 381 379 { 382 380 if (ShellCommandClass::commandClassList == NULL) … … 447 445 { 448 446 if (inputSplits.getCount() > 1) 449 elemAL->getCommand()->execut eCommand(objectList->firstElement(), executionString+inputSplits.getOffset(1));447 elemAL->getCommand()->executor->execute(objectList->firstElement(), executionString+inputSplits.getOffset(1)); 450 448 else 451 elemAL->getCommand()->execut eCommand(objectList->firstElement(), "");449 elemAL->getCommand()->executor->execute(objectList->firstElement(), ""); 452 450 delete itAL; 453 451 return true; … … 516 514 } 517 515 if (inputSplits.getCount() > fktPos+1) 518 enumCMD->execut eCommand(objectPointer, executionString+inputSplits.getOffset(fktPos +1));516 enumCMD->executor->execute(objectPointer, executionString+inputSplits.getOffset(fktPos +1)); 519 517 else 520 enumCMD->execut eCommand(objectPointer, "");518 enumCMD->executor->execute(objectPointer, ""); 521 519 delete itCMD; 522 520 return true; -
trunk/src/lib/shell/shell_command.h
r5636 r5637 120 120 121 121 protected: 122 ShellCommand(const char* commandName, const char* className, unsigned int paramCount, ...);122 ShellCommand(const char* commandName, const char* className, Executor* executor); 123 123 ~ShellCommand(); 124 124 … … 126 126 inline ShellCommand_Type getType() { return this->functorType; }; 127 127 128 static bool isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...);128 static bool isRegistered(const char* commandName, const char* className, Executor* executor); 129 129 static const char* paramToString(long parameter); 130 131 private:132 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */133 virtual void executeCommand (BaseObject* object, const char* parameters) = 0;134 130 135 131 protected:
Note: See TracChangeset
for help on using the changeset viewer.