Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/shell/shell_completion_plugin.h @ 7386

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

orxonox/trunk: completions

File size: 2.1 KB
Line 
1/*!
2 * @file shell_completion_plugin.h
3 * @brief The Shell Completion Plugin
4 */
5
6#ifndef _SHELL_COMPLETION_PLUGIN_H
7#define _SHELL_COMPLETION_PLUGIN_H
8
9#include <list>
10#include <vector>
11#include <string>
12
13namespace OrxShell
14{
15  //! The Base of All Completors
16  class Completor
17  {
18    public:
19      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) = 0;
20      virtual ~Completor() { };
21
22    protected:
23      Completor();
24  };
25
26  //! Completor that completes static Arrays of Strings.
27  class CompletorStringArray : public Completor
28  {
29    public:
30      CompletorStringArray(const std::string* stringArray, unsigned int size)
31          : _stringArray(stringArray), _size(size) {};
32      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin);
33
34    private:
35      const std::string*   _stringArray;
36      unsigned int         _size;
37  };
38
39  //! Completor that completes FileSystem Entries.
40  class CompletorFileSystem : public Completor
41  {
42
43    public:
44      // Where to search if the completionString is empty.
45      typedef enum
46      {
47        StartAtRoot,
48        StartAtHome,
49        StartAtDataDir,
50    } StartDirectory;
51
52      CompletorFileSystem(const std::string& fileExtension = "",
53                          StartDirectory startDir = StartAtDataDir,
54                          const std::string& subDir = "");
55      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin);
56
57    private:
58      std::string             _fileExtension;
59      std::string             _subDir;
60      StartDirectory          _startDir;
61  };
62
63
64  //! A Templated Completor
65  template<typename CLASS> class CompletorTList : public Completor
66  {
67    public:
68      CompletorTList(const std::list<CLASS*>& completionList);
69      virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin)
70      {};
71  };
72
73
74
75
76
77  //! A class for Completing the an InputString.
78  class CompletionPlugin
79  {
80    private:
81
82    public:
83      CompletionPlugin();
84
85
86  };
87
88}
89#endif /* _SHELL_COMPLETION_PLUGIN_H */
Note: See TracBrowser for help on using the repository browser.