Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

sync

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