X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fsingleton.h;h=d051b4c96040e005ae7082d1fe034b1ec12979e0;hb=8f92b3f08df9f4eb8fd243ccec6aa9d4b563ec23;hp=a3c96524e9f230703192b0ddad2c00af7046fb2a;hpb=92fc8c5b119111a35ab8423c3cbde5b2a022badf;p=quassel.git diff --git a/src/common/singleton.h b/src/common/singleton.h index a3c96524..d051b4c9 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-2019 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(); }