Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5779 was 5779, checked in by bensch, 18 years ago

orxonox/trunk: ClassList is now in std::list style
ShellCommand is now in std::list style

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