Changeset 7421 in orxonox.OLD for trunk/src/lib/shell/shell_command.cc
- Timestamp:
- Apr 28, 2006, 2:31:13 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r7420 r7421 298 298 } 299 299 return false; 300 301 302 /*303 long classID = CL_NULL; //< the classID retrieved from the Class.304 ShellCommandClass* commandClass = NULL; //< the command class this command applies to.305 const std::list<BaseObject*>* objectList = NULL; //< the list of Objects stored in classID306 BaseObject* objectPointer = NULL; //< a pointer to th Object to Execute the command on307 // bool emptyComplete = false; //< if the completion input is empty string. e.g ""308 // long completeType = SHELLC_NONE; //< the Type we'd like to complete.309 310 311 312 // if we only have one input (!MUST BE AN ALIAS)313 // CHECK FOR ALIAS314 std::vector<ShellCommandAlias*>::const_iterator alias;315 for (alias = ShellCommandAlias::getAliases().begin(); alias != ShellCommandAlias::getAliases().end(); alias++ )316 {317 if (inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&318 (*alias)->getCommand()->shellClass != NULL )319 {320 objectList = ClassList::getList((*alias)->getCommand()->shellClass->getName());321 if (objectList != NULL)322 {323 (*(*alias)->getCommand()->executor)(objectList->front(), inputSplits.getSubSet(1).join());324 return true;325 }326 }327 }328 329 // looking for a Matching Class (in the First Argument)330 std::vector<ShellCommandClass*>::iterator commandClassIT;331 for (commandClassIT = ShellCommandClass::commandClassList.begin(); commandClassIT != ShellCommandClass::commandClassList.end(); commandClassIT++)332 {333 if (inputSplits[0] == (*commandClassIT)->getName())334 {335 //elemCL->getName();336 classID = ClassList::StringToID((*commandClassIT)->getName());337 commandClass = (*commandClassIT);338 objectList = ClassList::getList((ClassID)classID);339 break;340 }341 }342 343 // Second Agument. (either Object, or Function)344 if (commandClass != NULL && inputSplits.size() >= 2)345 {346 int fktPos = 1; // The position of the Function (either at pos 1(if object given), or 2)347 // If we have an ObjectList.348 if (objectList != NULL)349 {350 // Checking for a Match in the Objects of classID (else take the first)351 std::list<BaseObject*>::const_iterator object;352 for (object = objectList->begin(); object != objectList->end(); object++)353 {354 if ((*object)->getName() != NULL && inputSplits[1] == (*object)->getName())355 {356 /// TODO make this work for multiple Objects at once.357 objectPointer = (*object);358 fktPos = 2;359 break;360 }361 }362 363 // if we did not find an Object with matching name, take the first.364 if (objectPointer == NULL)365 objectPointer = objectList->front();366 }367 368 // match a function.369 if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.size() >= 3)))370 {371 std::vector<ShellCommand*>::iterator cmdIT;372 for (cmdIT = commandClass->commandList.begin(); cmdIT != commandClass->commandList.end(); cmdIT++)373 {374 if (inputSplits[fktPos] == (*cmdIT)->getName())375 {376 if (objectPointer == NULL && (*cmdIT)->executor->getType() & Executor_Objective)377 return false;378 else379 {380 (*(*cmdIT)->executor)(objectPointer, inputSplits.getSubSet(fktPos+1).join()); /// TODO CHECK IF OK381 return true;382 }383 }384 }385 }386 }387 return false;388 */389 300 } 390 301
Note: See TracChangeset
for help on using the changeset viewer.