/***************************************************************************
- * 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 *
// We need to export the function on anything not using Windows DLLs, otherwise local static members don't
// work across library boundaries.
template<typename T>
-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) {
*
* @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<T>(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.
*
* @returns A pointer to the instance
*/
- static T *instance()
+ static T* instance()
{
return detail::getOrSetInstance<T>();
}