| [4838] | 1 | /*! | 
|---|
| [5170] | 2 | * @file shell_completion.h | 
|---|
|  | 3 | * @brief The Shell Completion Tasks | 
|---|
| [5371] | 4 | * | 
|---|
|  | 5 | * @todo if the second string is a Command, the third should not be completed! | 
|---|
|  | 6 | * @todo also make some completion for registered (or special) Types | 
|---|
| [3245] | 7 | */ | 
|---|
| [1853] | 8 |  | 
|---|
| [5170] | 9 | #ifndef _SHELL_COMPLETION_H | 
|---|
|  | 10 | #define _SHELL_COMPLETION_H | 
|---|
| [1853] | 11 |  | 
|---|
| [5779] | 12 | #include <list> | 
|---|
|  | 13 |  | 
|---|
| [4838] | 14 | // FORWARD DECLARATION | 
|---|
| [5178] | 15 | class BaseObject; | 
|---|
| [5181] | 16 | class ShellInput; | 
|---|
| [5178] | 17 | #ifndef NULL | 
|---|
|  | 18 | #define NULL 0            //!< a pointer to NULL | 
|---|
|  | 19 | #endif | 
|---|
| [3543] | 20 |  | 
|---|
| [5197] | 21 | //! an enumerator for different types the Shell can complete. | 
|---|
| [5187] | 22 | typedef enum { | 
|---|
| [5193] | 23 | SHELLC_NONE        = 0, | 
|---|
|  | 24 | SHELLC_CLASS       = 1, | 
|---|
|  | 25 | SHELLC_OBJECT      = 2, | 
|---|
|  | 26 | SHELLC_FUNCTION    = 4, | 
|---|
|  | 27 | SHELLC_ALIAS       = 8, | 
|---|
| [5192] | 28 | } SHELLC_TYPE; | 
|---|
| [5187] | 29 |  | 
|---|
| [5197] | 30 | //! A struct for ShellElements (these are used as containers to identify an Input for what it is) | 
|---|
| [5187] | 31 | struct ShellC_Element{ | 
|---|
| [5197] | 32 | const char*     name;     //!< the Name of the Element to be completed. | 
|---|
|  | 33 | SHELLC_TYPE     type;     //!< the type of the Element | 
|---|
| [5187] | 34 | }; | 
|---|
|  | 35 |  | 
|---|
| [3955] | 36 | //! A class for ... | 
|---|
| [5170] | 37 | class ShellCompletion { | 
|---|
| [1853] | 38 |  | 
|---|
| [1904] | 39 | public: | 
|---|
| [5182] | 40 | ShellCompletion(ShellInput* input = NULL); | 
|---|
| [5170] | 41 | virtual ~ShellCompletion(); | 
|---|
| [1853] | 42 |  | 
|---|
| [5184] | 43 | bool autoComplete(ShellInput* input = NULL); | 
|---|
| [5178] | 44 | bool classComplete(const char* classBegin); | 
|---|
| [5197] | 45 | //  long classMatch(const char* input, unsigned int* length); | 
|---|
| [5178] | 46 | bool objectComplete(const char* objectBegin, long classID); | 
|---|
| [5197] | 47 | //  bool objectMatch(const char* objectBegin, long classID, unsigned int* length); | 
|---|
| [5330] | 48 | bool functionComplete(const char* functionBegin, const char* className); | 
|---|
| [5197] | 49 | //  bool functionMatch(const char* functionBegin, long classID, unsigned int* length); | 
|---|
| [5195] | 50 | bool aliasComplete(const char* aliasBegin); | 
|---|
| [3245] | 51 |  | 
|---|
| [5192] | 52 | bool generalComplete(const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL); | 
|---|
| [5178] | 53 |  | 
|---|
| [5779] | 54 | bool addToCompleteList(const std::list<const char*>* inputList, const char* completionBegin, SHELLC_TYPE type); | 
|---|
|  | 55 | bool addToCompleteList(const std::list<BaseObject*>* inputList, const char* completionBegin, SHELLC_TYPE type); | 
|---|
| [5187] | 56 | void emptyCompletionList(); | 
|---|
| [5178] | 57 |  | 
|---|
| [5245] | 58 | static const char* ShellCompletion::typeToString(SHELLC_TYPE type); | 
|---|
|  | 59 |  | 
|---|
| [3245] | 60 | private: | 
|---|
| [5780] | 61 | std::list<ShellC_Element>    completionList;          //!< A list of completions, that are io. | 
|---|
| [5779] | 62 | ShellInput*                  input;                   //!< the input this completion works on. | 
|---|
| [1853] | 63 | }; | 
|---|
|  | 64 |  | 
|---|
| [5170] | 65 | #endif /* _SHELL_COMPLETION_H */ | 
|---|