Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Sep 18, 2005, 2:13:28 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: alias-completion works too now :)

File:
1 edited

Legend:

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

    r5192 r5195  
    4141  this->classID = CL_NULL;
    4242  this->commandList = new tList<ShellCommandBase>;
     43  this->aliasList = new tList<ShellCommandAlias>;
    4344
    4445  ShellCommandClass::commandClassList->add(this);
     
    8889}
    8990
     91bool ShellCommandClass::getCommandListOfAlias(tList<const char>* stringList)
     92{
     93  if (stringList == NULL)
     94    return false;
     95
     96  tIterator<ShellCommandAlias>* iterator = ShellCommandClass::aliasList->getIterator();
     97  ShellCommandAlias* elem = iterator->firstElement();
     98  while(elem != NULL)
     99  {
     100    stringList->add(elem->getName());
     101    elem = iterator->nextElement();
     102  }
     103  delete iterator;
     104  return true;
     105}
     106
     107
    90108/**
    91109 * unregisters all Commands that exist
     
    93111void ShellCommandClass::unregisterAllCommands()
    94112{
     113  // unregister all commands
    95114  tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator();
    96115  ShellCommandClass* elem = iterator->firstElement();
     
    105124  delete ShellCommandClass::commandClassList;
    106125  ShellCommandClass::commandClassList = NULL;
     126
     127  // unregister all aliases (there should be nothing to do here :))
     128  tIterator<ShellCommandAlias>* itAL = ShellCommandClass::aliasList->getIterator();
     129  ShellCommandAlias* elemAL = itAL->firstElement();
     130  while(elemAL != NULL)
     131  {
     132    delete elemAL;
     133    elemAL = itAL->nextElement();
     134  }
     135  delete itAL;
     136  delete ShellCommandClass::aliasList;
     137  ShellCommandClass::aliasList = NULL;
    107138}
    108139
     
    168199
    169200tList<ShellCommandClass>* ShellCommandClass::commandClassList = NULL;
     201tList<ShellCommandAlias>* ShellCommandClass::aliasList = NULL;
    170202
    171203/**
     
    428460}
    429461
     462ShellCommandBase* ShellCommandBase::setAlias(const char* alias)
     463{
     464  ShellCommandAlias* aliasCMD = new ShellCommandAlias(alias, this);
     465  ShellCommandClass::aliasList->add(aliasCMD);
     466}
     467
    430468/**
    431469 * see ShellCommandBase::debug()
Note: See TracChangeset for help on using the changeset viewer.