Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Apr 28, 2006, 1:12:28 AM (18 years ago)
Author:
bensch
Message:

also get the offset

File:
1 edited

Legend:

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

    r7413 r7414  
    136136  /**
    137137   * @brief takes out an InputLine, searching for a Command.
     138   * @see const ShellCommand* const ShellCommand::getCommandFromInput(const SubString& strings)
    138139   * @param inputLine: the Input to analyse.
     140   * @param paramBegin: The begin of the Splitted SubStrings entry of the Parameters section.
    139141   * @returns: The ShellCommand if found.
    140142   */
    141   const ShellCommand* const ShellCommand::getCommandFromInput(const std::string& inputLine)
    142   {
    143     SubString strings(inputLine, SubString::WhiteSpaces);
     143  const ShellCommand* const ShellCommand::getCommandFromInput(const std::string& inputLine, unsigned int& paramBegin)
     144  {
     145    ShellCommand::getCommandFromInput(SubString(inputLine, SubString::WhiteSpaces), paramBegin);
     146  }
     147
     148  /**
     149   * @brief takes out an InputLine, searching for a Command.
     150   * @param strings: the Input to analyse.
     151   * @param paramBegin: The begin of the Splitted SubStrings entry of the Parameters section.
     152   * @returns: The ShellCommand if found.
     153   */
     154  const ShellCommand* const ShellCommand::getCommandFromInput(const SubString& strings, unsigned int& paramBegin)
     155  {
    144156    // no input, no Command.
    145157    if (strings.size() == 0)
    146       return NULL;
     158    {
     159      paramBegin = 0;
     160      return NULL;
     161    }
    147162
    148163    // CHECK FOR ALIAS
     
    162177      const ShellCommand* retCmd;
    163178      if (strings.size() >= 1)
     179      {
    164180        retCmd = ShellCommand::getCommand(strings[1], cmdClass);
     181        paramBegin = 2;
     182      }
    165183      if (retCmd == NULL && strings.size() >= 2)
     184      {
    166185        retCmd = ShellCommand::getCommand(strings[2], cmdClass);
    167       return retCmd;
    168 
    169     }
     186        paramBegin = 3;
     187      }
     188      if (retCmd != NULL) // check for the paramBegin.
     189        return retCmd;
     190    }
     191    paramBegin = 0;
     192    return NULL;
    170193  }
    171194
Note: See TracChangeset for help on using the changeset viewer.