From af42073830087d97385e507f27f601e8769541b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 4 May 2016 14:16:40 +0200 Subject: Style fix Move all constructors at the top of classes --- louloulibs/utils/scopeguard.hpp | 10 ++++++---- louloulibs/utils/timed_events.cpp | 4 ---- louloulibs/utils/timed_events.hpp | 25 ++++++++++++++----------- louloulibs/utils/timed_events_manager.cpp | 8 -------- 4 files changed, 20 insertions(+), 27 deletions(-) (limited to 'louloulibs/utils') diff --git a/louloulibs/utils/scopeguard.hpp b/louloulibs/utils/scopeguard.hpp index df78831..fed40ff 100644 --- a/louloulibs/utils/scopeguard.hpp +++ b/louloulibs/utils/scopeguard.hpp @@ -40,6 +40,12 @@ public: { this->add_callback(std::move(func)); } + + ScopeGuard(const ScopeGuard&) = delete; + ScopeGuard& operator=(ScopeGuard&&) = delete; + ScopeGuard(ScopeGuard&&) = delete; + ScopeGuard& operator=(const ScopeGuard&) = delete; + /** * default constructor, the scope guard is enabled but empty, use * add_callback() @@ -78,10 +84,6 @@ private: bool enabled; std::vector> callbacks; - ScopeGuard(const ScopeGuard&) = delete; - ScopeGuard& operator=(ScopeGuard&&) = delete; - ScopeGuard(ScopeGuard&&) = delete; - ScopeGuard& operator=(const ScopeGuard&) = delete; }; } diff --git a/louloulibs/utils/timed_events.cpp b/louloulibs/utils/timed_events.cpp index 5010a3f..930380b 100644 --- a/louloulibs/utils/timed_events.cpp +++ b/louloulibs/utils/timed_events.cpp @@ -29,10 +29,6 @@ TimedEvent::TimedEvent(TimedEvent&& other): { } -TimedEvent::~TimedEvent() -{ -} - bool TimedEvent::is_after(const TimedEvent& other) const { return this->is_after(other.time_point); diff --git a/louloulibs/utils/timed_events.hpp b/louloulibs/utils/timed_events.hpp index 4e2800c..c3dfc40 100644 --- a/louloulibs/utils/timed_events.hpp +++ b/louloulibs/utils/timed_events.hpp @@ -31,7 +31,12 @@ public: std::function callback, const std::string& name=""); explicit TimedEvent(TimedEvent&&); - ~TimedEvent(); + ~TimedEvent() = default; + + TimedEvent(const TimedEvent&) = delete; + TimedEvent& operator=(const TimedEvent&) = delete; + TimedEvent& operator=(TimedEvent&&) = delete; + /** * Whether or not this event happens after the other one. */ @@ -70,10 +75,6 @@ private: * unique. */ const std::string name; - - TimedEvent(const TimedEvent&) = delete; - TimedEvent& operator=(const TimedEvent&) = delete; - TimedEvent& operator=(TimedEvent&&) = delete; }; /** @@ -84,7 +85,13 @@ private: class TimedEventsManager { public: - ~TimedEventsManager(); + ~TimedEventsManager() = default; + + TimedEventsManager(const TimedEventsManager&) = delete; + TimedEventsManager(TimedEventsManager&&) = delete; + TimedEventsManager& operator=(const TimedEventsManager&) = delete; + TimedEventsManager& operator=(TimedEventsManager&&) = delete; + /** * Return the unique instance of this class */ @@ -121,12 +128,8 @@ public: std::size_t size() const; private: - explicit TimedEventsManager(); std::list events; - TimedEventsManager(const TimedEventsManager&) = delete; - TimedEventsManager(TimedEventsManager&&) = delete; - TimedEventsManager& operator=(const TimedEventsManager&) = delete; - TimedEventsManager& operator=(TimedEventsManager&&) = delete; + explicit TimedEventsManager() = default; }; #endif // TIMED_EVENTS_HPP diff --git a/louloulibs/utils/timed_events_manager.cpp b/louloulibs/utils/timed_events_manager.cpp index 2c75e48..b90a237 100644 --- a/louloulibs/utils/timed_events_manager.cpp +++ b/louloulibs/utils/timed_events_manager.cpp @@ -6,14 +6,6 @@ TimedEventsManager& TimedEventsManager::instance() return inst; } -TimedEventsManager::TimedEventsManager() -{ -} - -TimedEventsManager::~TimedEventsManager() -{ -} - void TimedEventsManager::add_event(TimedEvent&& event) { for (auto it = this->events.begin(); it != this->events.end(); ++it) -- cgit v1.2.3