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