Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: autocompletion now also works for Static Function-commandos

File size: 2.0 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
17//! an enumerator for different types the Shell can complete.
18typedef 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)
27struct 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 ...
33class 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, const char* className);
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, SHELLC_TYPE type);
51  bool addToCompleteList(const tList<BaseObject>* inputList, const char* completionBegin, SHELLC_TYPE type);
52  void emptyCompletionList();
53
54  static const char* ShellCompletion::typeToString(SHELLC_TYPE type);
55
56 private:
57   tList<ShellC_Element>*   completionList;          //!< A list of completions, that are io.
58   ShellInput*              input;                   //!< the input this completion works on.
59};
60
61#endif /* _SHELL_COMPLETION_H */
Note: See TracBrowser for help on using the repository browser.