Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: shell without tList now

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