diff options
Diffstat (limited to 'src/crepe/api/EventManager.hpp')
-rw-r--r-- | src/crepe/api/EventManager.hpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/crepe/api/EventManager.hpp b/src/crepe/api/EventManager.hpp index 1e505f4..d901492 100644 --- a/src/crepe/api/EventManager.hpp +++ b/src/crepe/api/EventManager.hpp @@ -4,7 +4,8 @@ namespace crepe { template <typename EventType> void EventManager::subscribe(EventHandler<EventType> && callback, int channel) { - using HandlersMap = std::unordered_map<int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; + using HandlersMap = std::unordered_map< + int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; using HandlersVec = std::vector<std::unique_ptr<IEventHandlerWrapper>>; std::type_index event_type = typeid(EventType); @@ -29,7 +30,8 @@ template <typename EventType> void EventManager::queue_event(EventType && event, int channel) { std::type_index event_type = std::type_index(typeid(EventType)); - auto event_ptr = std::make_unique<EventType>(std::forward<EventType>(event)); + auto event_ptr + = std::make_unique<EventType>(std::forward<EventType>(event)); std::tuple<std::unique_ptr<Event>, int, std::type_index> tuple( std::move(event_ptr), channel, event_type); @@ -38,7 +40,8 @@ void EventManager::queue_event(EventType && event, int channel) { template <typename EventType> void EventManager::trigger_event(const EventType & event, int channel) { - using HandlersMap = std::unordered_map<int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; + using HandlersMap = std::unordered_map< + int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; using HandlersVec = std::vector<std::unique_ptr<IEventHandlerWrapper>>; std::type_index event_type = std::type_index(typeid(EventType)); @@ -68,8 +71,10 @@ void EventManager::trigger_event(const EventType & event, int channel) { } template <typename EventType> -void EventManager::unsubscribe(const EventHandler<EventType> & callback, int channel) { - using HandlersMap = std::unordered_map<int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; +void EventManager::unsubscribe(const EventHandler<EventType> & callback, + int channel) { + using HandlersMap = std::unordered_map< + int, std::vector<std::unique_ptr<IEventHandlerWrapper>>>; using HandlersVec = std::vector<std::unique_ptr<IEventHandlerWrapper>>; std::type_index event_type(typeid(EventType)); |