From ceabe013be9062458a9adbd4d4d4ac98ef09039b Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Wed, 21 Aug 2019 11:31:25 +0200 Subject: [PATCH] code style changes to signals --- libsrc/core/signal.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libsrc/core/signal.hpp b/libsrc/core/signal.hpp index d414d14e..082dd32b 100644 --- a/libsrc/core/signal.hpp +++ b/libsrc/core/signal.hpp @@ -16,7 +16,7 @@ namespace ngcore Signal() : is_emitting(true) {} template - void connect(Cls* self, FUNC f) + void Connect(Cls* self, FUNC f) { auto ptr = self->weak_from_this(); auto func = [ptr, f](ParameterTypes... args) @@ -29,14 +29,19 @@ namespace ngcore funcs.push_back(func); } - inline void emit(ParameterTypes ...args) + inline void Emit(ParameterTypes ...args) { if(is_emitting) funcs.remove_if([&](auto& f){ return !f(args...); }); } - inline void setEmitting(bool emitting) { is_emitting = emitting; } - inline bool getEmitting() const { return is_emitting; } + inline bool SetEmitting(bool emitting) + { + bool was_emitting = is_emitting; + is_emitting = emitting; + return was_emitting; + } + inline bool GetEmitting() const { return is_emitting; } }; } // namespace ngcore