2014-06-10 22:58:02 +04:00
|
|
|
#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
|
|
|
|
{
|
|
|
|
|
2014-10-22 03:20:09 +04:00
|
|
|
struct child_not_found : public runtime_error
|
2014-06-10 22:58:02 +04:00
|
|
|
{
|
|
|
|
using runtime_error::runtime_error;
|
|
|
|
};
|
|
|
|
|
2014-10-22 03:20:09 +04:00
|
|
|
class HighlighterGroup : public Highlighter
|
2014-06-10 22:58:02 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-12-02 22:56:17 +03:00
|
|
|
void highlight(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange range) override;
|
2014-06-10 22:58:02 +04:00
|
|
|
|
2015-05-25 15:54:18 +03:00
|
|
|
bool has_children() const override { return true; }
|
2014-10-22 03:20:09 +04:00
|
|
|
void add_child(HighlighterAndId&& hl) override;
|
|
|
|
void remove_child(StringView id) override;
|
2014-06-10 22:58:02 +04:00
|
|
|
|
2014-10-22 03:20:09 +04:00
|
|
|
Highlighter& get_child(StringView path) override;
|
2014-06-10 22:58:02 +04:00
|
|
|
|
2014-10-22 03:20:09 +04:00
|
|
|
Completions complete_child(StringView path, ByteCount cursor_pos, bool group) const override;
|
2014-06-10 22:58:02 +04:00
|
|
|
|
|
|
|
private:
|
2015-01-12 16:24:30 +03:00
|
|
|
using HighlighterMap = IdMap<std::unique_ptr<Highlighter>, MemoryDomain::Highlight>;
|
2014-10-22 03:20:09 +04:00
|
|
|
HighlighterMap m_highlighters;
|
2014-06-11 00:35:03 +04:00
|
|
|
};
|
|
|
|
|
2014-06-10 22:58:02 +04:00
|
|
|
struct DefinedHighlighters : public HighlighterGroup,
|
|
|
|
public Singleton<DefinedHighlighters>
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // highlighter_group_hh_INCLUDED
|