Small naming tweak in HookManager

This commit is contained in:
Maxime Coste 2017-02-19 11:52:31 +00:00
parent c3af384c70
commit 38102595ef
2 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ namespace Kakoune
void HookManager::add_hook(StringView hook_name, String group, HookFunc hook) void HookManager::add_hook(StringView hook_name, String group, HookFunc hook)
{ {
auto& hooks = m_hook[hook_name]; auto& hooks = m_hooks[hook_name];
hooks.append({std::move(group), std::move(hook)}); hooks.append({std::move(group), std::move(hook)});
} }
@ -21,14 +21,14 @@ void HookManager::remove_hooks(StringView group)
{ {
if (group.empty()) if (group.empty())
throw runtime_error("invalid id"); throw runtime_error("invalid id");
for (auto& hooks : m_hook) for (auto& hooks : m_hooks)
hooks.value.remove_all(group); hooks.value.remove_all(group);
} }
CandidateList HookManager::complete_hook_group(StringView prefix, ByteCount pos_in_token) CandidateList HookManager::complete_hook_group(StringView prefix, ByteCount pos_in_token)
{ {
CandidateList res; CandidateList res;
for (auto& list : m_hook) for (auto& list : m_hooks)
{ {
auto container = list.value | transform(decltype(list.value)::get_id); auto container = list.value | transform(decltype(list.value)::get_id);
for (auto& c : complete(prefix, pos_in_token, container)) for (auto& c : complete(prefix, pos_in_token, container))
@ -49,8 +49,8 @@ void HookManager::run_hook(StringView hook_name,
if (m_parent) if (m_parent)
m_parent->run_hook(hook_name, param, context); m_parent->run_hook(hook_name, param, context);
auto hook_list_it = m_hook.find(hook_name); auto hook_list_it = m_hooks.find(hook_name);
if (hook_list_it == m_hook.end()) if (hook_list_it == m_hooks.end())
return; return;
if (contains(m_running_hooks, std::make_pair(hook_name, param))) if (contains(m_running_hooks, std::make_pair(hook_name, param)))

View File

@ -29,7 +29,7 @@ private:
friend class Scope; friend class Scope;
SafePtr<HookManager> m_parent; SafePtr<HookManager> m_parent;
IdMap<IdMap<HookFunc, MemoryDomain::Hooks>, MemoryDomain::Hooks> m_hook; IdMap<IdMap<HookFunc, MemoryDomain::Hooks>, MemoryDomain::Hooks> m_hooks;
mutable Vector<std::pair<StringView, StringView>, MemoryDomain::Hooks> m_running_hooks; mutable Vector<std::pair<StringView, StringView>, MemoryDomain::Hooks> m_running_hooks;
}; };