blob: 085a5ea6459c8af345046260c3092492c46025eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SINGLETON_H
#define SINGLETON_H
QT_BEGIN_NAMESPACE
/*!
\class Singleton
\internal
Class template for singleton objects in QDoc.
*/
template<typename T>
class Singleton
{
public:
Singleton(const Singleton &) = delete;
Singleton &operator=(const Singleton &) = delete;
static T &instance()
{
static T s_instance {};
return s_instance;
}
protected:
Singleton() = default;
};
QT_END_NAMESPACE
#endif // SINGLETON_H
|