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