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