Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/atmospheric_engine/src/lib/shell/shell_command_class.h @ 7913

Last change on this file since 7913 was 7743, checked in by bensch, 19 years ago

orxonox/trunk: All the ShellCommands get Registered correctly again

File size: 1.9 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
12namespace OrxShell
13{
14  // FORWARD DECLARATION
15  class ShellCommand;
16  class ShellCommandAlias;
17  class ShellCommandClass;
18
19  typedef std::vector<ShellCommand*>      CmdList;
20  typedef std::vector<ShellCommandClass*> CmdClassList;
21
22
23  //! A class to hold all Classes that have (once) registered Commands.
24  class ShellCommandClass : public BaseObject
25  {
26    friend class ShellCommand;
27  public:
28    /** @returns the CommandClassList */
29    static const CmdClassList& getCommandClassList() { return *ShellCommandClass::commandClassList; };
30
31    static bool getCommandListOfClass(const std::string& className, std::list<std::string>& stringList);
32
33    static void unregisterAllCommands();
34    static ShellCommandClass* getCommandClass(const std::string& className);
35    ClassID getClassID();
36    static bool exists(const std::string& className);
37
38    static void help (const std::string& className = "");
39
40    static void debug();
41
42  private:
43    ShellCommandClass(const std::string& className);
44    static ShellCommandClass* acquireCommandClass(const std::string& className);
45    virtual ~ShellCommandClass();
46
47
48    void registerCommand(ShellCommand* command);
49    void unregisterCommand(ShellCommand* command);
50
51  private:
52    const std::string                      className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
53    ClassID                                classID;                   //!< The classID of this Class
54    CmdList                                commandList;               //!< A list of Commands from this Class
55
56    static CmdClassList*                   commandClassList;          //!< A list of Classes
57  };
58}
59
60#endif /* _SHELL_COMMAND_H */
Note: See TracBrowser for help on using the repository browser.