aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/EventManager.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-16 15:26:48 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-16 15:26:48 +0100
commit8209678e20605936b2ce58331c1a65d8f23fee91 (patch)
tree6a8c1e236eb1cee716a6a17bc504af3ac29555b6 /src/crepe/api/EventManager.cpp
parent027e67b32a9cca3cac4a186e73fdcc42faeab8c4 (diff)
make format
Diffstat (limited to 'src/crepe/api/EventManager.cpp')
-rw-r--r--src/crepe/api/EventManager.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/crepe/api/EventManager.cpp b/src/crepe/api/EventManager.cpp
index a04f08b..7f47938 100644
--- a/src/crepe/api/EventManager.cpp
+++ b/src/crepe/api/EventManager.cpp
@@ -8,10 +8,12 @@ EventManager & EventManager::get_instance() {
}
void EventManager::dispatch_events() {
- 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>>;
- for (auto event_it = this->events_queue.begin(); event_it != this->events_queue.end();) {
+ for (auto event_it = this->events_queue.begin();
+ event_it != this->events_queue.end();) {
std::unique_ptr<Event> & event = std::get<0>(*event_it);
int channel = std::get<1>(*event_it);
std::type_index event_type = std::get<2>(*event_it);
@@ -25,7 +27,8 @@ void EventManager::dispatch_events() {
auto handlers = handlers_map.find(channel);
if (handlers != handlers_map.end()) {
HandlersVec & callbacks = handlers->second;
- for (auto handler_it = callbacks.begin(); handler_it != callbacks.end(); ++handler_it) {
+ for (auto handler_it = callbacks.begin();
+ handler_it != callbacks.end(); ++handler_it) {
if ((*handler_it)->exec(*event)) {
event_it = events_queue.erase(event_it);
event_handled = true;
@@ -39,7 +42,8 @@ void EventManager::dispatch_events() {
auto handlers_it = this->subscribers.find(event_type);
if (handlers_it != this->subscribers.end()) {
HandlersVec & handlers = handlers_it->second;
- for (auto handler_it = handlers.begin(); handler_it != handlers.end(); ++handler_it) {
+ for (auto handler_it = handlers.begin();
+ handler_it != handlers.end(); ++handler_it) {
// remove event from queue since and continue when callback returns true
if ((*handler_it)->exec(*event)) {
event_it = this->events_queue.erase(event_it);
@@ -55,4 +59,3 @@ void EventManager::dispatch_events() {
}
}
}
-