mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 14:39:01 +01:00
Apply suggestions from code review
Co-authored-by: Mai <mathew1800@gmail.com>
This commit is contained in:
parent
05fad53fa0
commit
43b6a49012
@ -46,7 +46,7 @@ private:
|
|||||||
struct HookImpl : public HookBase
|
struct HookImpl : public HookBase
|
||||||
{
|
{
|
||||||
~HookImpl() override { Event::Remove(this); }
|
~HookImpl() override { Event::Remove(this); }
|
||||||
HookImpl(CallbackType callback, std::string name) : m_fn(callback), m_name(name) {}
|
HookImpl(CallbackType callback, std::string name) : m_fn(std::move(callback)), m_name(std::move(name)) {}
|
||||||
CallbackType m_fn;
|
CallbackType m_fn;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
};
|
};
|
||||||
@ -56,12 +56,12 @@ public:
|
|||||||
static EventHook Register(CallbackType callback, std::string name)
|
static EventHook Register(CallbackType callback, std::string name)
|
||||||
{
|
{
|
||||||
DEBUG_LOG_FMT(COMMON, "Registering {} handler at {} event hook", name, EventName.value);
|
DEBUG_LOG_FMT(COMMON, "Registering {} handler at {} event hook", name, EventName.value);
|
||||||
auto handle = std::make_unique<HookImpl>(callback, name);
|
auto handle = std::make_unique<HookImpl>(callback, std::move(name));
|
||||||
m_listeners.push_back(handle.get());
|
m_listeners.push_back(handle.get());
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Trigger(CallbackArgs... args)
|
static void Trigger(const CallbackArgs&... args)
|
||||||
{
|
{
|
||||||
for (auto& handle : m_listeners)
|
for (auto& handle : m_listeners)
|
||||||
handle->m_fn(args...);
|
handle->m_fn(args...);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user