home/src/highlighter_registry.hh

41 lines
1.1 KiB
C++
Raw Normal View History

#ifndef highlighter_registry_h_INCLUDED
#define highlighter_registry_h_INCLUDED
#include <string>
#include <unordered_map>
#include "highlighter.hh"
#include "utils.hh"
#include "completion.hh"
namespace Kakoune
{
class Window;
typedef std::vector<std::string> HighlighterParameters;
typedef std::function<HighlighterAndId (Window& window,
const HighlighterParameters& params)> HighlighterFactory;
class HighlighterRegistry : public Singleton<HighlighterRegistry>
{
public:
void register_factory(const std::string& name,
const HighlighterFactory& factory);
void add_highlighter_to_window(Window& window,
const std::string& factory_name,
const HighlighterParameters& parameters);
CandidateList complete_highlighter(const std::string& prefix,
size_t cursor_pos);
private:
std::unordered_map<std::string, HighlighterFactory> m_factories;
};
}
#endif // highlighter_registry_h_INCLUDED