-
Notifications
You must be signed in to change notification settings - Fork 715
/
scope.hh
69 lines (57 loc) · 2.07 KB
/
scope.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef scope_hh_INCLUDED
#define scope_hh_INCLUDED
#include "alias_registry.hh"
#include "face_registry.hh"
#include "highlighter_group.hh"
#include "hook_manager.hh"
#include "keymap_manager.hh"
#include "option_manager.hh"
#include "utils.hh"
namespace Kakoune
{
class Scope
{
public:
Scope(Scope& parent)
: m_options(parent.options()),
m_hooks(parent.hooks()),
m_keymaps(parent.keymaps()),
m_aliases(parent.aliases()),
m_faces(parent.faces()),
m_highlighters(parent.highlighters()) {}
OptionManager& options() { return m_options; }
const OptionManager& options() const { return m_options; }
HookManager& hooks() { return m_hooks; }
const HookManager& hooks() const { return m_hooks; }
KeymapManager& keymaps() { return m_keymaps; }
const KeymapManager& keymaps() const { return m_keymaps; }
AliasRegistry& aliases() { return m_aliases; }
const AliasRegistry& aliases() const { return m_aliases; }
FaceRegistry& faces() { return m_faces; }
const FaceRegistry& faces() const { return m_faces; }
Highlighters& highlighters() { return m_highlighters; }
const Highlighters& highlighters() const { return m_highlighters; }
void reparent(Scope& parent);
private:
friend class GlobalScope;
Scope() = default;
OptionManager m_options;
HookManager m_hooks;
KeymapManager m_keymaps;
AliasRegistry m_aliases;
FaceRegistry m_faces;
Highlighters m_highlighters;
};
class GlobalScope : public Scope, public OptionManagerWatcher, public Singleton<GlobalScope>
{
public:
GlobalScope();
~GlobalScope();
OptionsRegistry& option_registry() { return m_option_registry; }
const OptionsRegistry& option_registry() const { return m_option_registry; }
private:
void on_option_changed(const Option& option) override;
OptionsRegistry m_option_registry;
};
}
#endif // scope_hh_INCLUDED