diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-07-11 00:27:04 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-07-11 00:27:43 +0100 |
| commit | a32b49acd12538c27bf4f9abb8acd133e8cf2ee8 (patch) | |
| tree | d1990535a90aa77fe6754f777e5f1c1c261e0ca8 /src/face_registry.hh | |
| parent | 42611aef1e84b7dc13735021b8d0b68fedb86d60 (diff) | |
Rename ColorPair to Face and ColorRegistry to FaceRegistry
Face also stores the attributes
Diffstat (limited to 'src/face_registry.hh')
| -rw-r--r-- | src/face_registry.hh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/face_registry.hh b/src/face_registry.hh new file mode 100644 index 00000000..c09f04f7 --- /dev/null +++ b/src/face_registry.hh @@ -0,0 +1,36 @@ +#ifndef face_registry_hh_INCLUDED +#define face_registry_hh_INCLUDED + +#include "face.hh" +#include "utils.hh" +#include "completion.hh" + +#include <unordered_map> + +namespace Kakoune +{ + +class FaceRegistry : public Singleton<FaceRegistry> +{ +public: + FaceRegistry(); + + const Face& operator[](const String& facedesc); + void register_alias(const String& name, const String& facedesc, + bool override = false); + + CandidateList complete_alias_name(StringView prefix, + ByteCount cursor_pos) const; +private: + std::unordered_map<String, Face> m_aliases; +}; + +inline const Face& get_face(const String& facedesc) +{ + return FaceRegistry::instance()[facedesc]; +} + +} + +#endif // face_registry_hh_INCLUDED + |
