From e7377daf2fe3b759fbbf7e57f88c412c3b1cf011 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 24 Oct 2024 10:56:19 +0200 Subject: `make format` --- mwe/events/include/eventHandler.h | 50 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'mwe/events/include/eventHandler.h') diff --git a/mwe/events/include/eventHandler.h b/mwe/events/include/eventHandler.h index e5b99d6..7414801 100644 --- a/mwe/events/include/eventHandler.h +++ b/mwe/events/include/eventHandler.h @@ -4,45 +4,43 @@ #include #include -template -using EventHandler = std::function; +template +using EventHandler = std::function; class IEventHandlerWrapper { public: - virtual ~IEventHandlerWrapper() = default; + virtual ~IEventHandlerWrapper() = default; - void exec(const Event& e); + void exec(const Event & e); - virtual std::string getType() const = 0; - virtual bool isDestroyOnSuccess() const = 0; + virtual std::string getType() const = 0; + virtual bool isDestroyOnSuccess() const = 0; private: - virtual void call(const Event& e) = 0; + virtual void call(const Event & e) = 0; }; -template +template class EventHandlerWrapper : public IEventHandlerWrapper { public: - explicit EventHandlerWrapper(const EventHandler& handler, const bool destroyOnSuccess = false) - : m_handler(handler) - , m_handlerType(m_handler.target_type().name()) - , m_destroyOnSuccess(destroyOnSuccess) - { + explicit EventHandlerWrapper(const EventHandler & handler, + const bool destroyOnSuccess = false) + : m_handler(handler), m_handlerType(m_handler.target_type().name()), + m_destroyOnSuccess(destroyOnSuccess) { // std::cout << m_handlerType << std::endl; } private: - void call(const Event& e) override - { - if (e.getEventType() == EventType::getStaticEventType()) { - m_handler(static_cast(e)); - } - } - - std::string getType() const override { return m_handlerType; } - bool isDestroyOnSuccess() const { return m_destroyOnSuccess; } - - EventHandler m_handler; - const std::string m_handlerType; - bool m_destroyOnSuccess { false }; + void call(const Event & e) override { + if (e.getEventType() == EventType::getStaticEventType()) { + m_handler(static_cast(e)); + } + } + + std::string getType() const override { return m_handlerType; } + bool isDestroyOnSuccess() const { return m_destroyOnSuccess; } + + EventHandler m_handler; + const std::string m_handlerType; + bool m_destroyOnSuccess{false}; }; -- cgit v1.2.3