From 99791f5edfebea1bb5e9c6cb4cdbc208ec5f8fb7 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 8 May 2022 14:42:44 +0200 Subject: [PATCH] Format OnLeavingScope --- wumsloader/src/utils/OnLeavingScope.h | 57 +++++++++++---------------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/wumsloader/src/utils/OnLeavingScope.h b/wumsloader/src/utils/OnLeavingScope.h index 2eb97f6..e92e6ca 100644 --- a/wumsloader/src/utils/OnLeavingScope.h +++ b/wumsloader/src/utils/OnLeavingScope.h @@ -46,8 +46,8 @@ #ifndef CRASCIT_ONLEAVINGSCOPE_H #define CRASCIT_ONLEAVINGSCOPE_H -#include #include +#include /** @@ -61,40 +61,32 @@ * function instead. */ template -class OnLeavingScope -{ +class OnLeavingScope { public: - // Prevent copying - OnLeavingScope(const OnLeavingScope&) = delete; - OnLeavingScope& operator=(const OnLeavingScope&) = delete; + // Prevent copying + OnLeavingScope(const OnLeavingScope &) = delete; + OnLeavingScope &operator=(const OnLeavingScope &) = delete; - // Allow moving - OnLeavingScope(OnLeavingScope&& other) : - m_func(std::move(other.m_func)), - m_owner(other.m_owner) - { - other.m_owner = false; - } + // Allow moving + OnLeavingScope(OnLeavingScope &&other) : m_func(std::move(other.m_func)), + m_owner(other.m_owner) { + other.m_owner = false; + } - OnLeavingScope(const Func& f) : - m_func(f), - m_owner(true) - { - } - OnLeavingScope(Func&& f) : - m_func(std::move(f)), - m_owner(true) - { - } - ~OnLeavingScope() - { - if (m_owner) - m_func(); - } + OnLeavingScope(const Func &f) : m_func(f), + m_owner(true) { + } + OnLeavingScope(Func &&f) : m_func(std::move(f)), + m_owner(true) { + } + ~OnLeavingScope() { + if (m_owner) + m_func(); + } private: - Func m_func; - bool m_owner; + Func m_func; + bool m_owner; }; @@ -114,9 +106,8 @@ private: * from the object passed as the function argument. */ template -OnLeavingScope::type> onLeavingScope(Func&& f) -{ - return OnLeavingScope::type>(std::forward(f)); +OnLeavingScope::type> onLeavingScope(Func &&f) { + return OnLeavingScope::type>(std::forward(f)); } #endif // CRASCIT_ONLEAVINGSCOPE_H