summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-10-02 14:20:36 +0800
committerMaxime Coste <mawww@kakoune.org>2017-10-06 13:58:04 +0800
commita5ae21d70d91939b9b050d8edea49d6034893935 (patch)
tree0c746f91cebff9151e7dab933bc759b48eeb597a
parent18705a009707dead4a0560b3fcb976ac3e733764 (diff)
Move HookManager::Hook definition in the cpp
This avoids including regex.hh in the header.
-rw-r--r--src/hook_manager.cc11
-rw-r--r--src/hook_manager.hh15
2 files changed, 16 insertions, 10 deletions
diff --git a/src/hook_manager.cc b/src/hook_manager.cc
index 5e538681..b08377e5 100644
--- a/src/hook_manager.cc
+++ b/src/hook_manager.cc
@@ -13,6 +13,17 @@
namespace Kakoune
{
+struct HookManager::Hook
+{
+ String group;
+ Regex filter;
+ String commands;
+};
+
+HookManager::HookManager() : m_parent(nullptr) {}
+HookManager::HookManager(HookManager& parent) : SafeCountable{}, m_parent(&parent) {}
+HookManager::~HookManager() = default;
+
void HookManager::add_hook(StringView hook_name, String group, Regex filter, String commands)
{
auto& hooks = m_hooks[hook_name];
diff --git a/src/hook_manager.hh b/src/hook_manager.hh
index 66baecf3..215cdeb8 100644
--- a/src/hook_manager.hh
+++ b/src/hook_manager.hh
@@ -4,17 +4,18 @@
#include "hash_map.hh"
#include "completion.hh"
#include "safe_ptr.hh"
-#include "regex.hh"
namespace Kakoune
{
class Context;
+class Regex;
class HookManager : public SafeCountable
{
public:
- HookManager(HookManager& parent) : SafeCountable{}, m_parent(&parent) {}
+ HookManager(HookManager& parent);
+ ~HookManager();
void add_hook(StringView hook_name, String group, Regex filter, String commands);
void remove_hooks(StringView group);
@@ -23,17 +24,11 @@ public:
Context& context) const;
private:
- HookManager()
- : m_parent(nullptr) {}
+ HookManager();
// the only one allowed to construct a root hook manager
friend class Scope;
- struct Hook
- {
- String group;
- Regex filter;
- String commands;
- };
+ struct Hook;
SafePtr<HookManager> m_parent;
HashMap<String, Vector<std::unique_ptr<Hook>, MemoryDomain::Hooks>, MemoryDomain::Hooks> m_hooks;