Move HookManager::Hook definition in the cpp
This avoids including regex.hh in the header.
This commit is contained in:
parent
18705a0097
commit
a5ae21d70d
|
@ -13,6 +13,17 @@
|
||||||
namespace Kakoune
|
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)
|
void HookManager::add_hook(StringView hook_name, String group, Regex filter, String commands)
|
||||||
{
|
{
|
||||||
auto& hooks = m_hooks[hook_name];
|
auto& hooks = m_hooks[hook_name];
|
||||||
|
|
|
@ -4,17 +4,18 @@
|
||||||
#include "hash_map.hh"
|
#include "hash_map.hh"
|
||||||
#include "completion.hh"
|
#include "completion.hh"
|
||||||
#include "safe_ptr.hh"
|
#include "safe_ptr.hh"
|
||||||
#include "regex.hh"
|
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
class Context;
|
class Context;
|
||||||
|
class Regex;
|
||||||
|
|
||||||
class HookManager : public SafeCountable
|
class HookManager : public SafeCountable
|
||||||
{
|
{
|
||||||
public:
|
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 add_hook(StringView hook_name, String group, Regex filter, String commands);
|
||||||
void remove_hooks(StringView group);
|
void remove_hooks(StringView group);
|
||||||
|
@ -23,17 +24,11 @@ public:
|
||||||
Context& context) const;
|
Context& context) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HookManager()
|
HookManager();
|
||||||
: m_parent(nullptr) {}
|
|
||||||
// the only one allowed to construct a root hook manager
|
// the only one allowed to construct a root hook manager
|
||||||
friend class Scope;
|
friend class Scope;
|
||||||
|
|
||||||
struct Hook
|
struct Hook;
|
||||||
{
|
|
||||||
String group;
|
|
||||||
Regex filter;
|
|
||||||
String commands;
|
|
||||||
};
|
|
||||||
|
|
||||||
SafePtr<HookManager> m_parent;
|
SafePtr<HookManager> m_parent;
|
||||||
HashMap<String, Vector<std::unique_ptr<Hook>, MemoryDomain::Hooks>, MemoryDomain::Hooks> m_hooks;
|
HashMap<String, Vector<std::unique_ptr<Hook>, MemoryDomain::Hooks>, MemoryDomain::Hooks> m_hooks;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user