Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

orxonox/trunk: fixed a notNULL definition

File:
1 edited

Legend:

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

    r7386 r7388  
    2424#include "compiler.h"
    2525
    26 #include <stdio.h>
    27 #include <string.h>
    28 
    2926namespace OrxShell
    3027{
     
    5350  ShellCommandClass::~ShellCommandClass()
    5451  {
    55     while(this->commandList.size() > 0)
    56     {
    57       delete this->commandList.front();
    58       this->commandList.pop_front();
     52    while(!this->commandList.empty())
     53    {
     54      delete this->commandList.back();
     55      this->commandList.pop_back();
    5956    }
    6057  }
     
    7370      if (className == (*elem)->getName())
    7471      {
    75         std::list<ShellCommand*>::iterator command;
     72        std::vector<ShellCommand*>::iterator command;
    7673        for(command = (*elem)->commandList.begin(); command != (*elem)->commandList.end(); command++)
    7774          stringList.push_back((*command)->getName());
     
    194191        {
    195192          PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className.c_str(), (*classIT)->commandList.size());
    196           std::list<ShellCommand*>::const_iterator cmdIT;
     193          std::vector<ShellCommand*>::const_iterator cmdIT;
    197194          for (cmdIT = (*classIT)->commandList.begin(); cmdIT != (*classIT)->commandList.end(); cmdIT++)
    198195          {
     
    216213  }
    217214
     215  void ShellCommandClass::registerCommand(ShellCommand* command)
     216  {
     217    this->commandList.push_back(command);
     218  }
     219
     220
     221  void ShellCommandClass::unregisterCommand(ShellCommand* command)
     222  {
     223    std::vector<ShellCommand*>::iterator delC = std::find(this->commandList.begin(), this->commandList.end(), command);
     224    this->commandList.erase(delC);
     225  }
     226
     227
     228
    218229}
     230
     231
     232
     233
Note: See TracChangeset for help on using the changeset viewer.