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 <list> |
---|
11 | |
---|
12 | |
---|
13 | namespace OrxShell |
---|
14 | { |
---|
15 | // FORWARD DECLARATION |
---|
16 | class ShellCommand; |
---|
17 | class ShellCommandAlias; |
---|
18 | |
---|
19 | //! A class to hold all Classes that have (once) registered Commands. |
---|
20 | class ShellCommandClass : public BaseObject |
---|
21 | { |
---|
22 | friend class ShellCommand; |
---|
23 | |
---|
24 | public: |
---|
25 | /** @returns the CommandClassList */ |
---|
26 | static const std::list<ShellCommandClass*>* getCommandClassList() { return ShellCommandClass::commandClassList; }; |
---|
27 | static bool getCommandListOfClass(const std::string& className, std::list<std::string>* stringList); |
---|
28 | static bool getCommandListOfAlias(std::list<std::string>* aliasList); |
---|
29 | |
---|
30 | static ShellCommandClass* getCommandClass(const std::string& className); |
---|
31 | static void unregisterAllCommands(); |
---|
32 | |
---|
33 | static void help (const std::string& className); |
---|
34 | |
---|
35 | private: |
---|
36 | ShellCommandClass(const std::string& className); |
---|
37 | virtual ~ShellCommandClass(); |
---|
38 | |
---|
39 | static const ShellCommandClass* isRegistered(const std::string& className); |
---|
40 | static void initCommandClassList(); |
---|
41 | |
---|
42 | private: |
---|
43 | const std::string className; //!< The Name of the Class. This should match the ClassName of the Commands Class. |
---|
44 | long classID; //!< The classID of this Class |
---|
45 | std::list<ShellCommand*> commandList; //!< A list of Commands from this Class |
---|
46 | static std::list<ShellCommandClass*>* commandClassList; //!< A list of Classes |
---|
47 | static std::list<ShellCommandAlias*>* aliasList; //!< An Alias to A Command. (only for classes with one Instance) |
---|
48 | }; |
---|
49 | |
---|
50 | } |
---|
51 | |
---|
52 | #endif /* _SHELL_COMMAND_H */ |
---|