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