home/src/highlighter.hh

39 lines
1.1 KiB
C++
Raw Normal View History

#ifndef highlighter_hh_INCLUDED
#define highlighter_hh_INCLUDED
2013-04-09 20:05:40 +02:00
#include "function_group.hh"
#include "function_registry.hh"
#include "memoryview.hh"
#include "string.hh"
#include "utils.hh"
2013-04-09 20:05:40 +02:00
#include <functional>
namespace Kakoune
{
class DisplayBuffer;
class Window;
// An Highlighter is a function which mutates a DisplayBuffer in order to
// change the visual representation of a file. It could be changing text
// color, adding information text (line numbering for example) or replacing
// buffer content (folding for example)
2013-05-23 13:39:00 +02:00
typedef std::function<void (const Window& window, DisplayBuffer& display_buffer)> HighlighterFunc;
typedef std::pair<String, HighlighterFunc> HighlighterAndId;
typedef memoryview<String> HighlighterParameters;
2013-07-26 01:17:12 +02:00
using HighlighterFactory = std::function<HighlighterAndId (HighlighterParameters params,
Window& window)>;
2013-05-23 13:39:00 +02:00
using HighlighterGroup = FunctionGroup<const Window&, DisplayBuffer&>;
struct HighlighterRegistry : FunctionRegistry<HighlighterFactory>,
Singleton<HighlighterRegistry>
{};
}
#endif // highlighter_hh_INCLUDED