Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7390 in orxonox.OLD


Ignore:
Timestamp:
Apr 26, 2006, 11:43:19 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ShellCommands stuff

File:
1 edited

Legend:

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

    r7389 r7390  
    5656
    5757  /**
    58    * collects the Commands registered to some class.
    59    * @param className the name of the Class to collect the Commands from.
    60    * @param stringList a List to paste the Commands into.
    61    * @returns true on success, false otherwise
    62    */
    63   bool ShellCommandClass::getCommandListOfClass(const std::string& className, std::list<std::string>& stringList)
    64   {
    65     std::list<ShellCommandClass*>::iterator elem;
    66     for(elem = ShellCommandClass::commandClassList->begin(); elem != ShellCommandClass::commandClassList->end(); elem++)
    67     {
    68       if (className == (*elem)->getName())
    69       {
    70         std::vector<ShellCommand*>::iterator command;
    71         for(command = (*elem)->commandList.begin(); command != (*elem)->commandList.end(); command++)
    72           stringList.push_back((*command)->getName());
    73       }
    74     }
    75     return true;
     58   * @param command the Command to register.
     59   */
     60  void ShellCommandClass::registerCommand(ShellCommand* command)
     61  {
     62    this->commandList.push_back(command);
     63  }
     64
     65  /**
     66   * @brief unregister command.
     67   * @param command the Command to unregister.
     68   */
     69  void ShellCommandClass::unregisterCommand(ShellCommand* command)
     70  {
     71    std::vector<ShellCommand*>::iterator delC = std::find(this->commandList.begin(), this->commandList.end(), command);
     72    if (delC != this->commandList.end())
     73      this->commandList.erase(delC);
    7674  }
    7775
     
    9391  }
    9492
     93
     94  /**
     95   * @brief collects the Commands registered to some class.
     96   * @param className the name of the Class to collect the Commands from.
     97   * @param stringList a List to paste the Commands into.
     98   * @returns true on success, false otherwise
     99   */
     100  bool ShellCommandClass::getCommandListOfClass(const std::string& className, std::list<std::string>& stringList)
     101  {
     102    std::list<ShellCommandClass*>::iterator elem;
     103    for(elem = ShellCommandClass::commandClassList->begin(); elem != ShellCommandClass::commandClassList->end(); elem++)
     104    {
     105      if (className == (*elem)->getName())
     106      {
     107        std::vector<ShellCommand*>::iterator command;
     108        for(command = (*elem)->commandList.begin(); command != (*elem)->commandList.end(); command++)
     109          stringList.push_back((*command)->getName());
     110      }
     111    }
     112    return true;
     113  }
     114
     115
    95116  /**
    96117   * @brief checks if a Class is already registered to the Commands' class-stack
     
    118139
    119140  /**
    120    * searches for a CommandClass
     141   * @brief searches for a CommandClass
    121142   * @param className the name of the CommandClass
    122143   * @returns the CommandClass if found, or a new CommandClass if not
     
    186207  }
    187208
    188   void ShellCommandClass::registerCommand(ShellCommand* command)
    189   {
    190     this->commandList.push_back(command);
    191   }
    192 
    193 
    194   void ShellCommandClass::unregisterCommand(ShellCommand* command)
    195   {
    196     std::vector<ShellCommand*>::iterator delC = std::find(this->commandList.begin(), this->commandList.end(), command);
    197     if (delC != this->commandList.end())
    198       this->commandList.erase(delC);
    199   }
    200 
    201 
    202 
    203209}
    204210
Note: See TracChangeset for help on using the changeset viewer.