[4838] | 1 | /*! |
---|
[5639] | 2 | * @file shell_command_class.h |
---|
[5068] | 3 | * Definition of a on-screen-shell |
---|
[5391] | 4 | */ |
---|
[1853] | 5 | |
---|
[5639] | 6 | #ifndef _SHELL_COMMAND_CLASS_H |
---|
| 7 | #define _SHELL_COMMAND_CLASS_H |
---|
[1853] | 8 | |
---|
[5129] | 9 | #include "base_object.h" |
---|
[7388] | 10 | #include <vector> |
---|
[1853] | 11 | |
---|
[7374] | 12 | namespace OrxShell |
---|
| 13 | { |
---|
| 14 | // FORWARD DECLARATION |
---|
| 15 | class ShellCommand; |
---|
| 16 | class ShellCommandAlias; |
---|
[7742] | 17 | class ShellCommandClass; |
---|
[3543] | 18 | |
---|
[7742] | 19 | typedef std::vector<ShellCommand*> CmdList; |
---|
| 20 | typedef std::vector<ShellCommandClass*> CmdClassList; |
---|
| 21 | |
---|
| 22 | |
---|
[7374] | 23 | //! A class to hold all Classes that have (once) registered Commands. |
---|
| 24 | class ShellCommandClass : public BaseObject |
---|
| 25 | { |
---|
| 26 | friend class ShellCommand; |
---|
[5170] | 27 | public: |
---|
[5197] | 28 | /** @returns the CommandClassList */ |
---|
[7743] | 29 | static const CmdClassList& getCommandClassList() { return *ShellCommandClass::commandClassList; }; |
---|
[5190] | 30 | |
---|
[7386] | 31 | static bool getCommandListOfClass(const std::string& className, std::list<std::string>& stringList); |
---|
| 32 | |
---|
[5171] | 33 | static void unregisterAllCommands(); |
---|
[7742] | 34 | static ShellCommandClass* getCommandClass(const std::string& className); |
---|
[7411] | 35 | ClassID getClassID(); |
---|
[7408] | 36 | static bool exists(const std::string& className); |
---|
[5170] | 37 | |
---|
[7742] | 38 | static void help (const std::string& className = ""); |
---|
[5204] | 39 | |
---|
[7742] | 40 | static void debug(); |
---|
| 41 | |
---|
[5170] | 42 | private: |
---|
[7221] | 43 | ShellCommandClass(const std::string& className); |
---|
[7408] | 44 | static ShellCommandClass* acquireCommandClass(const std::string& className); |
---|
[6981] | 45 | virtual ~ShellCommandClass(); |
---|
[5170] | 46 | |
---|
| 47 | |
---|
[7388] | 48 | void registerCommand(ShellCommand* command); |
---|
| 49 | void unregisterCommand(ShellCommand* command); |
---|
| 50 | |
---|
[5170] | 51 | private: |
---|
[7221] | 52 | const std::string className; //!< The Name of the Class. This should match the ClassName of the Commands Class. |
---|
[7411] | 53 | ClassID classID; //!< The classID of this Class |
---|
[7742] | 54 | CmdList commandList; //!< A list of Commands from this Class |
---|
[7394] | 55 | |
---|
[7743] | 56 | static CmdClassList* commandClassList; //!< A list of Classes |
---|
[7374] | 57 | }; |
---|
| 58 | } |
---|
| 59 | |
---|
[5129] | 60 | #endif /* _SHELL_COMMAND_H */ |
---|