Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: todo-list

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