Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/shell/shell_completion.h @ 5194

Last change on this file since 5194 was 5194, checked in by bensch, 19 years ago

orxonox/trunk: shell now also autocompletes Commands

File size: 1.7 KB
Line 
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
10class BaseObject;
11class ShellInput;
12template<class T> class tList;
13#ifndef NULL
14#define NULL 0            //!< a pointer to NULL
15#endif
16
17typedef enum {
18  SHELLC_NONE        = 0,
19  SHELLC_CLASS       = 1,
20  SHELLC_OBJECT      = 2,
21  SHELLC_FUNCTION    = 4,
22  SHELLC_ALIAS       = 8,
23} SHELLC_TYPE;
24
25struct ShellC_Element{
26  const char*     name;     //!<
27  SHELLC_TYPE     type;
28};
29
30//! A class for ...
31class ShellCompletion {
32
33 public:
34  ShellCompletion(ShellInput* input = NULL);
35  virtual ~ShellCompletion();
36
37  bool autoComplete(ShellInput* input = NULL);
38  bool classComplete(const char* classBegin);
39  long classMatch(const char* input, unsigned int* length);
40  bool objectComplete(const char* objectBegin, long classID);
41  bool objectMatch(const char* objectBegin, long classID, unsigned int* length);
42  bool functionComplete(const char* functionBegin, long classID);
43  bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
44
45  bool generalComplete(const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
46
47  bool addToCompleteList(const tList<const char>* inputList, const char* completionBegin);
48  bool addToCompleteList(const tList<BaseObject>* inputList, const char* completionBegin);
49  void emptyCompletionList();
50//    const tList<const char>* createCompleteList(const tList<ShellCommandBase>* inputList, const char* completionBegin);
51
52
53 private:
54   tList<ShellC_Element>*   completionList;          //!< A list of completions, that are io.
55   ShellInput*              input;
56};
57
58#endif /* _SHELL_COMPLETION_H */
Note: See TracBrowser for help on using the repository browser.