Changeset 7407 in orxonox.OLD for trunk/src/lib/shell/shell_completion_plugin.h
- Timestamp:
- Apr 27, 2006, 8:42:16 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_completion_plugin.h
r7406 r7407 10 10 #include <vector> 11 11 #include <string> 12 #include "multi_type.h" 12 13 13 14 namespace OrxShell 14 15 { 15 16 //! The Base of All Completors 16 class Completor 17 class CompletorPlugin 17 18 { 18 public: 19 virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) = 0; 20 virtual ~Completor() { }; 21 protected: 22 Completor(); 19 public: 20 virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const = 0; 21 virtual ~CompletorPlugin() { }; 22 23 virtual CompletorPlugin* clone() const = 0; 24 protected: 25 CompletorPlugin() {}; 26 }; 27 28 class CompletorDefault : public CompletorPlugin 29 { 30 public: 31 CompletorDefault(const MultiType* value); 32 virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const; 33 34 virtual CompletorPlugin* clone() const; 35 private: 36 const MultiType* _value; 23 37 }; 24 38 25 39 40 //! Completor that completes static Arrays of Strings. 41 class CompletorStringArray : public CompletorPlugin 42 { 43 public: 44 CompletorStringArray(const std::string* stringArray, unsigned int size) 45 : _stringArray(stringArray), _size(size) {}; 46 virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const; 26 47 27 28 //! Completor that completes static Arrays of Strings. 29 class CompletorStringArray : public Completor 30 { 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); 35 36 private: 37 const std::string* _stringArray; 38 unsigned int _size; 48 virtual CompletorPlugin* clone() const; 49 private: 50 const std::string* _stringArray; 51 unsigned int _size; 39 52 }; 40 53 41 54 42 class CompletorList : public Completor 55 class CompletorList : public CompletorPlugin 43 56 { 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; 57 public: 58 CompletorList(const std::list<std::string>* list); 59 virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const; 60 virtual CompletorPlugin* clone() const; 61 62 private: 63 const std::list<std::string>* _list; 49 64 }; 50 65 … … 52 67 53 68 //! Completor that completes FileSystem Entries. 54 class CompletorFileSystem : public Completor 69 class CompletorFileSystem : public CompletorPlugin 55 70 { 56 57 public: 58 // Where to search if the completionString is empty. 59 typedef enum 60 { 61 StartAtRoot, 62 StartAtHome, 63 StartAtDataDir, 71 public: 72 // Where to search if the completionString is empty. 73 typedef enum 74 { 75 StartAtRoot, 76 StartAtHome, 77 StartAtDataDir, 64 78 } StartDirectory; 65 79 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); 80 CompletorFileSystem(const std::string& fileExtension = "", 81 StartDirectory startDir = StartAtDataDir, 82 const std::string& subDir = ""); 83 virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const; 84 virtual CompletorPlugin* clone() const; 70 85 71 72 73 74 86 private: 87 std::string _fileExtension; 88 std::string _subDir; 89 StartDirectory _startDir; 75 90 }; 76 91 … … 79 94 80 95 //! A Templated Completor 81 template<typename CLASS> class CompletorTList : public Completor 96 template<typename CLASS> class CompletorTList : public CompletorPlugin 82 97 { 83 public: 84 CompletorTList(const std::list<CLASS*>& completionList); 85 virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) 86 {}; 98 public: 99 CompletorTList(const std::list<CLASS*>& completionList); 100 virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) 101 {}; 102 virtual CompletorPlugin* clone() const; 87 103 }; 88 104
Note: See TracChangeset
for help on using the changeset viewer.