Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7397 in orxonox.OLD for trunk


Ignore:
Timestamp:
Apr 27, 2006, 4:08:46 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Aliases better

Location:
trunk/src/lib/shell
Files:
2 edited

Legend:

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

    r7394 r7397  
    162162    {
    163163      // CHECK FOR ALIAS
    164       std::vector<ShellCommandAlias*>::iterator alias;
    165       for (alias = ShellCommandAlias::aliasList.begin(); alias != ShellCommandAlias::aliasList.end(); alias++ )
     164      std::vector<ShellCommandAlias*>::const_iterator alias;
     165      for (alias = ShellCommandAlias::getAliases().begin(); alias != ShellCommandAlias::getAliases().end(); alias++ )
    166166      {
    167167        if (inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&
     
    271271    {
    272272      ShellCommandAlias* aliasCMD = new ShellCommandAlias(alias, this);
    273       ShellCommandAlias::aliasList.push_back(aliasCMD);
    274273      this->alias = aliasCMD;
    275274    }
     
    333332
    334333
     334  /**
     335   * @param aliasName the name of the Alias
     336   * @param command the Command, to associate this alias with
     337   */
    335338  ShellCommandAlias::ShellCommandAlias(const std::string& aliasName, ShellCommand* command)
    336339  {
  • trunk/src/lib/shell/shell_command.h

    r7389 r7397  
    8585
    8686  private:
    87     ShellCommandClass*               shellClass;                           //!< A Pointer to the Shell-Class this Command belongs to.
    88     ShellCommandAlias*               alias;                                //!< An Alias for the Class.
     87    ShellCommandClass*               shellClass;            //!< A Pointer to the Shell-Class this Command belongs to.
     88    ShellCommandAlias*               alias;                 //!< An Alias for the Class.
    8989
    90     std::string                      description;                          //!< A description for this commnand. (initially ""). Assigned with (create)->describe("blablabla");
    91     Executor*                        executor;                             //!< The Executor, that really executes the Function.
     90    std::string                      description;           //!< A description for this commnand. (initially ""). Assigned with (create)->describe("blablabla");
     91    Executor*                        executor;              //!< The Executor, that really executes the Function.
    9292  };
    9393
     
    9595  class ShellCommandAlias
    9696  {
    97     friend class ShellCommand;
    9897  public:
     98    ShellCommandAlias(const std::string& aliasName, ShellCommand* command);
     99    ~ShellCommandAlias();
     100
    99101    /** @returns the Name of the Alias. */
    100102    const std::string& getName() const { return this->aliasName; };
     
    102104    ShellCommand* getCommand() const { return this->command; };
    103105    static bool getCommandListOfAlias(std::list<std::string>& stringList);
     106    static const std::vector<ShellCommandAlias*>& getAliases() { return ShellCommandAlias::aliasList; };
    104107
    105   private:
    106     /** @param aliasName the name of the Alias @param command the Command, to associate this alias with */
    107     ShellCommandAlias(const std::string& aliasName, ShellCommand* command);
    108     ~ShellCommandAlias();
    109108  private:
    110109    std::string     aliasName;       //!< the name of the Alias
Note: See TracChangeset for help on using the changeset viewer.