diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-06-10 19:58:02 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-06-10 19:58:02 +0100 |
| commit | 479c31b571513b068aaa5881eec3624d3ac8cd1b (patch) | |
| tree | 1ad6038aeda8daa04db24e638984327f86a140ef /src/highlighter_group.hh | |
| parent | 3791e74743c65f384893207d91f693a5c33343cd (diff) | |
Replace FunctionGroup template with HighlighterGroup class
Diffstat (limited to 'src/highlighter_group.hh')
| -rw-r--r-- | src/highlighter_group.hh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/highlighter_group.hh b/src/highlighter_group.hh new file mode 100644 index 00000000..8445e445 --- /dev/null +++ b/src/highlighter_group.hh @@ -0,0 +1,41 @@ +#ifndef highlighter_group_hh_INCLUDED +#define highlighter_group_hh_INCLUDED + +#include "exception.hh" +#include "id_map.hh" +#include "highlighter.hh" +#include "utils.hh" + +namespace Kakoune +{ + +struct group_not_found : public runtime_error +{ + using runtime_error::runtime_error; +}; + +class HighlighterGroup +{ +public: + void operator()(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer); + + void append(HighlighterAndId&& hl); + void remove(StringView id); + + HighlighterGroup& get_group(StringView path, Codepoint path_separator = 0); + + CandidateList complete_id(StringView prefix, ByteCount cursor_pos) const; + CandidateList complete_group_id(StringView prefix, ByteCount cursor_pos) const; + +private: + id_map<HighlighterFunc> m_highlighters; +}; + +struct DefinedHighlighters : public HighlighterGroup, + public Singleton<DefinedHighlighters> +{ +}; + +} + +#endif // highlighter_group_hh_INCLUDED |
