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