X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fsingleton.h;h=49074708b71f9a9a2d64ad666d7ef6102fd623e4;hb=e14649614fbbf9b386505a5d782b88b1ac313c1f;hp=a3c96524e9f230703192b0ddad2c00af7046fb2a;hpb=92fc8c5b119111a35ab8423c3cbde5b2a022badf;p=quassel.git diff --git a/src/common/singleton.h b/src/common/singleton.h index a3c96524..49074708 100644 --- a/src/common/singleton.h +++ b/src/common/singleton.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -40,9 +40,9 @@ namespace detail { // We need to export the function on anything not using Windows DLLs, otherwise local static members don't // work across library boundaries. template -QUASSEL_SINGLETON_EXPORT T *getOrSetInstance(T *instance = nullptr, bool destroyed = false) +QUASSEL_SINGLETON_EXPORT T* getOrSetInstance(T* instance = nullptr, bool destroyed = false) { - static T *_instance = instance; + static T* _instance = instance; static bool _destroyed = destroyed; if (destroyed) { @@ -93,16 +93,16 @@ public: * * @param instance Pointer to the instance being created, i.e. the 'this' pointer of the parent class */ - Singleton(T *instance) + Singleton(T* instance) { detail::getOrSetInstance(instance); } // Satisfy Rule of Five - Singleton(const Singleton &) = delete; - Singleton(Singleton &&) = delete; - Singleton &operator=(const Singleton &) = delete; - Singleton &operator=(Singleton &&) = delete; + Singleton(const Singleton&) = delete; + Singleton(Singleton&&) = delete; + Singleton& operator=(const Singleton&) = delete; + Singleton& operator=(Singleton&&) = delete; /** * Destructor. @@ -122,7 +122,7 @@ public: * * @returns A pointer to the instance */ - static T *instance() + static T* instance() { return detail::getOrSetInstance(); }