Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/resources/src/lib/shell/shell_completion.h @ 8453

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

orxonox/trunk: more std::string

File size: 2.3 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#include <string>
14
15// FORWARD DECLARATION
16class BaseObject;
17class ShellInput;
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  std::string     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 std::string& classBegin);
46//  long classMatch(const char* input, unsigned int* length);
47  bool objectComplete(const std::string& objectBegin, long classID);
48//  bool objectMatch(const char* objectBegin, long classID, unsigned int* length);
49  bool functionComplete(const std::string& functionBegin, const std::string& className);
50//  bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
51  bool aliasComplete(const std::string& aliasBegin);
52
53  bool generalComplete(const std::string& begin, const std::string& displayAs = "%s",
54                       const std::string& addBack = "", const std::string& addFront = "");
55
56  bool addToCompleteList(const std::list<std::string>* inputList, const std::string& completionBegin, SHELLC_TYPE type);
57  bool addToCompleteList(const std::list<BaseObject*>* inputList, const std::string& completionBegin, SHELLC_TYPE type);
58  void emptyCompletionList();
59
60  static const char* ShellCompletion::typeToString(SHELLC_TYPE type);
61
62 private:
63   std::list<ShellC_Element>    completionList;          //!< A list of completions, that are io.
64   ShellInput*                  input;                   //!< the input this completion works on.
65};
66
67#endif /* _SHELL_COMPLETION_H */
Note: See TracBrowser for help on using the repository browser.