Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7389 in orxonox.OLD for trunk/src/lib/shell/shell_command_class.cc


Ignore:
Timestamp:
Apr 26, 2006, 11:39:51 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: new and improved ShellCommandAlias

File:
1 edited

Legend:

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

    r7388 r7389  
    2626namespace OrxShell
    2727{
    28 
    2928  std::list<ShellCommandClass*>* ShellCommandClass::commandClassList = NULL;
    30   std::list<ShellCommandAlias*>* ShellCommandClass::aliasList = NULL;
    3129
    3230  /**
     
    7977
    8078  /**
    81    * collects the Aliases registered to the ShellCommands
    82    * @param stringList a List to paste the Aliases into.
    83    * @returns true on success, false otherwise
    84    */
    85   bool ShellCommandClass::getCommandListOfAlias(std::list<std::string>& stringList)
    86   {
    87     if (ShellCommandClass::aliasList == NULL)
    88       return false;
    89 
    90     std::list<ShellCommandAlias*>::iterator alias;
    91     for (alias = ShellCommandClass::aliasList->begin(); alias != ShellCommandClass::aliasList->end(); alias++)
    92       stringList.push_back((*alias)->getName());
    93     return true;
    94   }
    95 
    96   /**
    97    * unregisters all Commands that exist
     79   * @brief unregisters all Commands that exist
    9880   */
    9981  void ShellCommandClass::unregisterAllCommands()
     
    10991    }
    11092
    111     // unregister all aliases (there should be nothing to do here :))
    112     if (ShellCommandClass::aliasList != NULL)
    113     {
    114       std::list<ShellCommandAlias*>::iterator alias;
    115       for (alias = ShellCommandClass::aliasList->begin(); alias != ShellCommandClass::aliasList->end(); alias++)
    116         delete (*alias);
    117       delete ShellCommandClass::aliasList;
    118       ShellCommandClass::aliasList = NULL;
    119     }
    120   }
    121 
    122   /**
    123    * checks if a Class is already registered to the Commands' class-stack
     93  }
     94
     95  /**
     96   * @brief checks if a Class is already registered to the Commands' class-stack
    12497   * @param className the Name of the Class to check for
    12598   * @returns the CommandClass if found, NULL otherwise
     
    222195  {
    223196    std::vector<ShellCommand*>::iterator delC = std::find(this->commandList.begin(), this->commandList.end(), command);
    224     this->commandList.erase(delC);
     197    if (delC != this->commandList.end())
     198      this->commandList.erase(delC);
    225199  }
    226200
Note: See TracChangeset for help on using the changeset viewer.