Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain/src/lib/shell/shell_command_class.h @ 10596

Last change on this file since 10596 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 1.8 KB
Line 
1/*!
2 * @file shell_command_class.h
3 * Definition of a on-screen-shell
4 */
5
6#ifndef _SHELL_COMMAND_CLASS_H
7#define _SHELL_COMMAND_CLASS_H
8
9#include "base_object.h"
10#include <vector>
11#include <list>
12
13namespace OrxShell
14{
15  // FORWARD DECLARATION
16  class ShellCommand;
17  class ShellCommandAlias;
18  class ShellCommandClass;
19
20  typedef std::vector<ShellCommand*>      CmdList;
21  typedef std::vector<ShellCommandClass*> CmdClassList;
22
23
24  //! A class to hold all Classes that have (once) registered Commands.
25  class ShellCommandClass : public BaseObject
26  {
27    ObjectListDeclaration(ShellCommandClass);
28
29    friend class ShellCommand;
30  public:
31    /** @returns the CommandClassList */
32    static const CmdClassList& getCommandClassList() { return *ShellCommandClass::_commandClassList; };
33
34    static bool getCommandListOfClass(const std::string& className, std::list<std::string>& stringList);
35
36    static void unregisterAllCommands();
37    static ShellCommandClass* getCommandClass(const std::string& className);
38    ClassID getClassID();
39    static bool exists(const std::string& className);
40
41    static void help (const std::string& className = "");
42
43    static void debug();
44
45  private:
46    ShellCommandClass(const std::string& className);
47    static ShellCommandClass* acquireCommandClass(const std::string& className);
48    virtual ~ShellCommandClass();
49
50
51    void registerCommand(ShellCommand* command);
52    void unregisterCommand(ShellCommand* command);
53
54  private:
55    const std::string                      _className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
56    CmdList                                _commandList;               //!< A list of Commands from this Class
57
58    static CmdClassList*                   _commandClassList;          //!< A list of Classes
59  };
60}
61
62#endif /* _SHELL_COMMAND_H */
Note: See TracBrowser for help on using the repository browser.