Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7420 in orxonox.OLD for trunk


Ignore:
Timestamp:
Apr 28, 2006, 2:22:26 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Completion and execution is ok now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_command.cc

    r7419 r7420  
    9898      for (cmd = cmdClass->commandList.begin(); cmd < cmdClass->commandList.end(); cmd++)
    9999        if (commandName == (*cmd)->getName())
     100        {
    100101          delete (*cmd);
     102          break;
     103        }
    101104    }
    102105  }
     
    244247      {
    245248        for (bo = objectList->begin(); bo != objectList->end(); bo++)
    246           if ((*bo)->getName() != NULL && nocaseCmp(objectDescriptor, (*bo)->getName(), objectDescriptor.size()))
     249          if ((*bo)->getName() != NULL && !nocaseCmp(objectDescriptor, (*bo)->getName(), objectDescriptor.size()))
    247250            boList->push_back(*bo);
    248251      }
     
    274277  bool ShellCommand::execute(const std::string& executionString)
    275278  {
     279    SubString inputSplits(executionString, SubString::WhiteSpacesWithComma);
     280
     281    // if we do not have any input return
     282    if (inputSplits.empty())
     283      return false;
     284
     285    unsigned int paramBegin;
     286    const ShellCommand* sc;
     287    std::vector<BaseObject*> boList;
     288    sc = getCommandFromInput(inputSplits, paramBegin, &boList);
     289    if (sc != NULL)
     290    {
     291      PRINT(0)("Command %s on ", sc->getName());
     292      for(std::vector<BaseObject*>::const_iterator bo = boList.begin(); bo != boList.end(); ++bo)
     293      {
     294        PRINT(0)("%s::%s\n", (*bo)->getClassName(), (*bo)->getName());
     295        (*sc->executor)((*bo), inputSplits.getSubSet(paramBegin).join());
     296      }
     297      return true;
     298    }
     299    return false;
     300
     301
     302    /*
    276303    long classID = CL_NULL;                      //< the classID retrieved from the Class.
    277304    ShellCommandClass* commandClass = NULL;      //< the command class this command applies to.
     
    281308    //  long completeType = SHELLC_NONE;           //< the Type we'd like to complete.
    282309
    283     SubString inputSplits(executionString, SubString::WhiteSpacesWithComma);
    284 
    285     // if we do not have any input return
    286     if (inputSplits.empty())
    287       return false;
    288 
    289     unsigned int paramBegin;
    290     const ShellCommand* sc;
    291     std::vector<BaseObject*> boList;
    292     sc = getCommandFromInput(inputSplits, paramBegin, &boList);
    293     if (sc != NULL)
    294     {
    295       PRINT(0)("Command %s on ", sc->getName());
    296       for(std::vector<BaseObject*>::const_iterator bo = boList.begin(); bo != boList.end(); ++bo)
    297         PRINT(0)("%s::%s\n", (*bo)->getClassName(), (*bo)->getName());
    298     }
     310
    299311
    300312    // if we only have one input (!MUST BE AN ALIAS)
     
    374386    }
    375387    return false;
     388    */
    376389  }
    377390
Note: See TracChangeset for help on using the changeset viewer.