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 | typedef enum { |
---|
18 | SHELLC_CLASS, |
---|
19 | SHELLC_OBJECT, |
---|
20 | SHELLC_FUNCTION, |
---|
21 | SHELLC_ALIAS, |
---|
22 | } SHELL_CTYPE; |
---|
23 | |
---|
24 | struct ShellC_Element{ |
---|
25 | const char* name; //!< |
---|
26 | SHELL_CTYPE type; |
---|
27 | }; |
---|
28 | |
---|
29 | //! A class for ... |
---|
30 | class ShellCompletion { |
---|
31 | |
---|
32 | public: |
---|
33 | ShellCompletion(ShellInput* input = NULL); |
---|
34 | virtual ~ShellCompletion(); |
---|
35 | |
---|
36 | bool autoComplete(ShellInput* input = NULL); |
---|
37 | bool classComplete(const char* classBegin); |
---|
38 | long classMatch(const char* input, unsigned int* length); |
---|
39 | bool objectComplete(const char* objectBegin, long classID); |
---|
40 | bool objectMatch(const char* objectBegin, long classID, unsigned int* length); |
---|
41 | bool functionComplete(const char* functionBegin); |
---|
42 | bool functionMatch(const char* functionBegin, long classID, unsigned int* length); |
---|
43 | |
---|
44 | bool generalComplete(const tList<ShellC_Element>* stringList, const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL); |
---|
45 | |
---|
46 | const tList<ShellC_Element>* addToCompleteList(const tList<const char>* inputList, const char* completionBegin); |
---|
47 | const tList<ShellC_Element>* addToCompleteList(const tList<BaseObject>* inputList, const char* completionBegin); |
---|
48 | void emptyCompletionList(); |
---|
49 | // const tList<const char>* createCompleteList(const tList<ShellCommandBase>* inputList, const char* completionBegin); |
---|
50 | |
---|
51 | |
---|
52 | private: |
---|
53 | tList<ShellC_Element>* completionList; //!< A list of completions, that are io. |
---|
54 | ShellInput* input; |
---|
55 | }; |
---|
56 | |
---|
57 | #endif /* _SHELL_COMPLETION_H */ |
---|