Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7221 in orxonox.OLD for trunk/src/lib/shell/shell_command.cc


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

File:
1 edited

Legend:

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

    r7201 r7221  
    4141  PRINTF(5)("create shellcommand %s %s\n", commandName, className);
    4242  this->setName(commandName);
    43   this->description = NULL;
    44   this->alias = NULL;
    4543  this->executor = executor.clone();
    4644  this->executor->setName(commandName);
     
    153151 * @return true on success, false otherwise.
    154152 */
    155 bool ShellCommand::execute(const char* executionString)
     153bool ShellCommand::execute(const std::string& executionString)
    156154{
    157155  if (ShellCommandClass::commandClassList == NULL)
     
    177175      for (alias = ShellCommandClass::aliasList->begin(); alias != ShellCommandClass::aliasList->end(); alias++ )
    178176      {
    179         if ((*alias)->getName() != NULL && !strcmp((*alias)->getName(), inputSplits.getString(0)) && (*alias)->getCommand() != NULL &&
     177        if (inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&
    180178            (*alias)->getCommand()->shellClass != NULL )
    181179        {
     
    184182          {
    185183            if (inputSplits.getCount() > 1)
    186               (*alias)->getCommand()->executor->execute(objectList->front(), executionString+inputSplits.getOffset(1));
     184            {
     185
     186              (*alias)->getCommand()->executor->execute(objectList->front(), executionString.substr(inputSplits.getOffset(1))); /// TODO CHECK IF OK
     187            }
    187188            else
    188189              (*alias)->getCommand()->executor->execute(objectList->front(), "");
     
    198199      for (commandClassIT = ShellCommandClass::commandClassList->begin(); commandClassIT != ShellCommandClass::commandClassList->end(); commandClassIT++)
    199200      {
    200         if ((*commandClassIT)->getName() && !strcasecmp(inputSplits.getString(0), (*commandClassIT)->getName()))
     201        if ((*commandClassIT)->getName() && inputSplits.getString(0) == (*commandClassIT)->getName())
    201202        {
    202203          //elemCL->getName();
     
    217218        for (object = objectList->begin(); object != objectList->end(); object++)
    218219        {
    219           if ((*object)->getName() != NULL && !strcasecmp((*object)->getName(), inputSplits.getString(1)))
     220          if ((*object)->getName() != NULL && inputSplits.getString(1) == (*object)->getName() )
    220221          {
    221222            objectPointer = (*object);
     
    235236        for (cmdIT = commandClass->commandList.begin(); cmdIT != commandClass->commandList.end(); cmdIT++)
    236237        {
    237           if (!strcmp((*cmdIT)->getName(), inputSplits.getString(fktPos)))
     238          if (inputSplits.getString(fktPos) == (*cmdIT)->getName())
    238239          {
    239240            if (objectPointer == NULL && (*cmdIT)->executor->getType() & Executor_Objective)
    240241              return false;
    241242            if (inputSplits.getCount() > fktPos+1)
    242               (*cmdIT)->executor->execute(objectPointer, executionString+inputSplits.getOffset(fktPos +1));
     243              (*cmdIT)->executor->execute(objectPointer, executionString.substr(inputSplits.getOffset(fktPos +1))); /// TODO CHECK IF OK
    243244            else
    244245              (*cmdIT)->executor->execute(objectPointer, "");
     
    255256 * @param description the description of the Given command
    256257 */
    257 ShellCommand* ShellCommand::describe(const char* description)
     258ShellCommand* ShellCommand::describe(const std::string& description)
    258259{
    259260  if (this == NULL)
     
    326327  for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
    327328  {
    328     PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className, (*classIT)->commandList.size());
     329    PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className.c_str(), (*classIT)->commandList.size());
    329330
    330331    list<ShellCommand*>::iterator cmdIT;
     
    335336      /*      for (unsigned int i = 0; i< elem->paramCount; i++)
    336337       printf("%s ", ShellCommand::paramToString(elem->parameters[i]));*/
    337       if ((*cmdIT)->description != NULL)
    338        printf("- %s", (*cmdIT)->description);
     338      if (!(*cmdIT)->description.empty())
     339        printf("- %s", (*cmdIT)->description.c_str());
    339340      printf("\n");
    340341
Note: See TracChangeset for help on using the changeset viewer.