Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9692 in orxonox.OLD for branches/new_class_id/src/lib/shell


Ignore:
Timestamp:
Aug 23, 2006, 12:43:25 AM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: some thoughts on a BaseIterator class, that can travers through ObejectLists without knowing the Polymorph type.
This is all virtual, and since templated virutal functions are not allowed, quite hard to implements…
hpe it will work

Location:
branches/new_class_id/src/lib/shell
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/shell/shell.cc

    r8362 r9692  
    5454  ->completionPlugin(0, OrxShell::CompletorFileSystem(".ttf", "fonts/"));
    5555
     56  NewObjectListDefinition(Shell);
    5657
    5758  /**
     
    6061  Shell::Shell ()
    6162  {
    62     this->setClassID(CL_SHELL, "Shell");
     63    this->registerObject(this, Shell::_objectList);
     64
    6365    this->setName("Shell");
    6466
  • branches/new_class_id/src/lib/shell/shell.h

    r7762 r9692  
    4848  class Shell : public Element2D, public EventListener
    4949  {
    50 
     50    NewObjectListDeclaration(Shell);
    5151  public:
    5252    Shell();
  • branches/new_class_id/src/lib/shell/shell_buffer.h

    r8145 r9692  
    2424  class ShellBuffer
    2525  {
    26 
    2726  public:
    2827    virtual ~ShellBuffer();
  • branches/new_class_id/src/lib/shell/shell_command.cc

    r9406 r9692  
    2121#include "compiler.h"
    2222#include "debug.h"
    23 #include "class_list.h"
    2423
    2524#include "key_names.h"
     
    2827{
    2928  SHELL_COMMAND(debug, ShellCommandClass, help);
     29  NewObjectListDefinition(ShellCommand);
    3030
    3131
     
    3838  ShellCommand::ShellCommand(const std::string& commandName, const std::string& className, Executor* executor)
    3939  {
    40     this->setClassID(CL_SHELL_COMMAND, "ShellCommand");
     40    this->registerObject(this, ShellCommand::_objectList);
    4141    PRINTF(4)("create shellcommand '%s' for class '%s'\n", commandName.c_str(), className.c_str());
    4242    this->setName(commandName);
     
    9494  void ShellCommand::unregisterCommand(const std::string& commandName, const std::string& className)
    9595  {
    96 
    9796    ShellCommandClass* cmdClass = ShellCommandClass::acquireCommandClass(className);
    9897    if (cmdClass != NULL)
    9998    {
    10099      CmdList::iterator cmd;
    101       for (cmd = cmdClass->commandList.begin(); cmd != cmdClass->commandList.end(); cmd++)
     100      for (cmd = cmdClass->_commandList.begin(); cmd != cmdClass->_commandList.end(); cmd++)
    102101        if (commandName == (*cmd)->getName())
    103102        {
     
    119118
    120119    CmdList::const_iterator elem;
    121     for (unsigned int i = 0; i < cmdClass->commandList.size(); i++)
    122     {
    123       if (commandName == cmdClass->commandList[i]->getName())
    124         return (cmdClass->commandList[i]);
     120    for (unsigned int i = 0; i < cmdClass->_commandList.size(); i++)
     121    {
     122      if (commandName == cmdClass->_commandList[i]->getName())
     123        return (cmdClass->_commandList[i]);
    125124    }
    126125    return NULL;
  • branches/new_class_id/src/lib/shell/shell_command.h

    r8145 r9692  
    5858  class ShellCommand : public BaseObject
    5959  {
     60    NewObjectListDeclaration(ShellCommand);
     61
    6062    friend class ShellCommandClass;
    6163  public:
  • branches/new_class_id/src/lib/shell/shell_command_class.cc

    r9406 r9692  
    2121
    2222#include "debug.h"
    23 #include "class_list.h"
    2423#include "compiler.h"
    2524
     
    2827namespace OrxShell
    2928{
     29  NewObjectListDefinition(ShellCommandClass);
     30
    3031  CmdClassList* ShellCommandClass::commandClassList = NULL;
    3132
     
    3536   */
    3637  ShellCommandClass::ShellCommandClass(const std::string& className)
    37       : className(className)
    38   {
    39     this->setClassID(CL_SHELL_COMMAND_CLASS, "ShellCommandClass");
     38      : _className(className)
     39  {
     40    this->registerObject(this, ShellCommandClass::_objectList);
    4041    this->setName(className);
    4142
  • branches/new_class_id/src/lib/shell/shell_command_class.h

    r8362 r9692  
    2525  class ShellCommandClass : public BaseObject
    2626  {
     27    NewObjectListDeclaration(ShellCommandClass);
     28
    2729    friend class ShellCommand;
    2830  public:
    2931    /** @returns the CommandClassList */
    30     static const CmdClassList& getCommandClassList() { return *ShellCommandClass::commandClassList; };
     32    static const CmdClassList& getCommandClassList() { return *ShellCommandClass::_commandClassList; };
    3133
    3234    static bool getCommandListOfClass(const std::string& className, std::list<std::string>& stringList);
     
    3436    static void unregisterAllCommands();
    3537    static ShellCommandClass* getCommandClass(const std::string& className);
    36     ClassID getClassID();
     38    NewClassID getClassID();
    3739    static bool exists(const std::string& className);
    3840
     
    5153
    5254  private:
    53     const std::string                      className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
    54     ClassID                                classID;                   //!< The classID of this Class
    55     CmdList                                commandList;               //!< A list of Commands from this Class
     55    const std::string                      _className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
     56    NewClassID                             _classID;                   //!< The classID of this Class
     57    CmdList                                _commandList;               //!< A list of Commands from this Class
    5658
    57     static CmdClassList*                   commandClassList;          //!< A list of Classes
     59    static CmdClassList*                   _commandClassList;          //!< A list of Classes
    5860  };
    5961}
  • branches/new_class_id/src/lib/shell/shell_input.cc

    r8339 r9692  
    2424#include "compiler.h"
    2525#include "key_names.h"
     26
    2627
    2728namespace OrxShell
     
    3132  ->setAlias("help");
    3233
     34  NewObjectListDefinition(ShellInput);
    3335
    3436  /**
     
    3941      : Text ("")
    4042  {
     43    this->registerObject(this, ShellInput::_objectList);
     44
    4145    this->pressedKey = SDLK_FIRST;
    42     this->setClassID(CL_SHELL_INPUT, "ShellInput");
    4346
    4447    this->inputLine = "";
  • branches/new_class_id/src/lib/shell/shell_input.h

    r7858 r9692  
    3030  class ShellInput : public Text,  public EventListener
    3131  {
     32    NewObjectListDeclaration(ShellInput);
    3233
    3334  public:
Note: See TracChangeset for help on using the changeset viewer.