Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5189 in orxonox.OLD for trunk/src/lib/shell


Ignore:
Timestamp:
Sep 17, 2005, 2:09:14 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: minor function, to retrieve a List of Commands from a ClassList

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

Legend:

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

    r5188 r5189  
    5959  delete iterator;
    6060  delete this->commandList;
     61}
     62
     63tList<const char>* ShellCommandClass::getCommandListOfClass(const char* className)
     64{
     65  tList<const char>* retList;
     66  tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator();
     67  ShellCommandClass* elem = iterator->firstElement();
     68  while(elem != NULL)
     69  {
     70    if (!strcmp (elem->getName(), className))
     71    {
     72      tIterator<ShellCommandBase>* itFkt = elem->commandList->getIterator();
     73      ShellCommandBase* command = itFkt->firstElement();
     74      while (command != NULL)
     75      {
     76        retList->add(command->getName());
     77        command = itFkt->nextElement();
     78      }
     79      delete itFkt;
     80    }
     81
     82    elem = iterator->nextElement();
     83  }
     84  delete iterator;
     85  return retList;
    6186}
    6287
  • trunk/src/lib/shell/shell_command.h

    r5179 r5189  
    5151  public:
    5252    static const tList<ShellCommandClass>* getCommandClassList() { return ShellCommandClass::commandClassList; };
     53    static tList<const char>* getCommandListOfClass(const char* className);
    5354    static ShellCommandClass* getCommandClass(const char* className);
    5455    static void unregisterAllCommands();
Note: See TracChangeset for help on using the changeset viewer.