From 6e7003c73110cf9ad7e4c72de703dfdc2292d8ca Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Sat, 16 Nov 2024 13:55:47 +0100 Subject: added hpp files and auto --- src/crepe/api/EventHandler.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/crepe/api/EventHandler.hpp (limited to 'src/crepe/api/EventHandler.hpp') diff --git a/src/crepe/api/EventHandler.hpp b/src/crepe/api/EventHandler.hpp new file mode 100644 index 0000000..1b5702e --- /dev/null +++ b/src/crepe/api/EventHandler.hpp @@ -0,0 +1,25 @@ + +#include + +#include "EventHandler.h" + +namespace crepe { + +// Implementation of EventHandlerWrapper constructor +template +EventHandlerWrapper::EventHandlerWrapper(const EventHandler & handler) + : m_handler(handler), m_handler_type(m_handler.target_type().name()) {} + +// Implementation of EventHandlerWrapper::call +template +bool EventHandlerWrapper::call(const Event & e) { + return m_handler(static_cast(e)); +} + +// Implementation of EventHandlerWrapper::get_type +template +std::string EventHandlerWrapper::get_type() const { + return m_handler_type; +} + +} //namespace crepe -- cgit v1.2.3