| [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> | 
|---|
| [7407] | 12 | #include "multi_type.h" | 
|---|
| [5779] | 13 |  | 
|---|
| [7374] | 14 | namespace OrxShell | 
|---|
| [7373] | 15 | { | 
|---|
| [7377] | 16 |   //! The Base of All Completors | 
|---|
| [7407] | 17 |   class CompletorPlugin | 
|---|
| [7374] | 18 |   { | 
|---|
| [7423] | 19 |     public: | 
|---|
 | 20 |       virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const = 0; | 
|---|
 | 21 |       virtual ~CompletorPlugin() { }; | 
|---|
| [7407] | 22 |  | 
|---|
| [7423] | 23 |       virtual CompletorPlugin* clone() const = 0; | 
|---|
 | 24 |     protected: | 
|---|
 | 25 |       CompletorPlugin() {}; | 
|---|
| [7374] | 26 |   }; | 
|---|
| [7371] | 27 |  | 
|---|
| [7407] | 28 |   class CompletorDefault : public CompletorPlugin | 
|---|
 | 29 |   { | 
|---|
| [7423] | 30 |     public: | 
|---|
 | 31 |       CompletorDefault(const MultiType* value); | 
|---|
 | 32 |       virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const; | 
|---|
| [7387] | 33 |  | 
|---|
| [7423] | 34 |       virtual CompletorPlugin* clone() const; | 
|---|
 | 35 |     private: | 
|---|
 | 36 |       const MultiType*    _value; | 
|---|
| [7407] | 37 |   }; | 
|---|
| [7387] | 38 |  | 
|---|
 | 39 |  | 
|---|
| [7377] | 40 |   //! Completor that completes static Arrays of Strings. | 
|---|
| [7407] | 41 |   class CompletorStringArray : public CompletorPlugin | 
|---|
| [7373] | 42 |   { | 
|---|
| [7423] | 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; | 
|---|
| [7374] | 47 |  | 
|---|
| [7423] | 48 |       virtual CompletorPlugin* clone() const; | 
|---|
 | 49 |     private: | 
|---|
 | 50 |       const std::string*   _stringArray; | 
|---|
 | 51 |       unsigned int         _size; | 
|---|
| [7371] | 52 |   }; | 
|---|
 | 53 |  | 
|---|
| [7387] | 54 |  | 
|---|
| [7407] | 55 |   class CompletorList : public CompletorPlugin | 
|---|
| [7387] | 56 |   { | 
|---|
| [7423] | 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; | 
|---|
| [7407] | 61 |  | 
|---|
| [7423] | 62 |     private: | 
|---|
 | 63 |       const std::list<std::string>* _list; | 
|---|
| [7387] | 64 |   }; | 
|---|
 | 65 |  | 
|---|
 | 66 |  | 
|---|
 | 67 |  | 
|---|
| [7377] | 68 |   //! Completor that completes FileSystem Entries. | 
|---|
| [7407] | 69 |   class CompletorFileSystem : public CompletorPlugin | 
|---|
| [7377] | 70 |   { | 
|---|
| [7423] | 71 |     public: | 
|---|
 | 72 |       CompletorFileSystem(const std::string& fileExtension = "", | 
|---|
 | 73 |                           const std::string& subDir = ""); | 
|---|
 | 74 |       virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) const; | 
|---|
 | 75 |       virtual CompletorPlugin* clone() const; | 
|---|
| [7377] | 76 |  | 
|---|
| [7423] | 77 |     private: | 
|---|
 | 78 |       std::string             _fileExtension; | 
|---|
 | 79 |       std::string             _subDir; | 
|---|
| [7377] | 80 |   }; | 
|---|
 | 81 |  | 
|---|
 | 82 |  | 
|---|
| [7387] | 83 |  | 
|---|
 | 84 |  | 
|---|
| [7374] | 85 |   //! A Templated Completor | 
|---|
| [7407] | 86 |   template<typename CLASS> class CompletorTList : public CompletorPlugin | 
|---|
| [7374] | 87 |   { | 
|---|
| [7423] | 88 |     public: | 
|---|
 | 89 |       CompletorTList(const std::list<CLASS*>& completionList); | 
|---|
 | 90 |       virtual void addToCompleteList(std::vector<std::string>& completionList, const std::string& completionBegin) | 
|---|
 | 91 |       {}; | 
|---|
 | 92 |       virtual CompletorPlugin* clone() const; | 
|---|
| [7374] | 93 |   }; | 
|---|
| [7373] | 94 |  | 
|---|
| [7374] | 95 | } | 
|---|
 | 96 | #endif /* _SHELL_COMPLETION_PLUGIN_H */ | 
|---|