Commit ad59bc17 authored by Igor Kushnir's avatar Igor Kushnir Committed by Milian Wolff
Browse files

Enforce singleton-ness of classes with static self()

Prevent accidental construction, copying or moving of these classes by
making their default constructors private, deleting their copy and move
operations.
parent cb418481
......@@ -30,8 +30,8 @@ class ClassModelNodesController
{
Q_OBJECT
public:
ClassModelNodesController();
public:
~ClassModelNodesController() override;
static ClassModelNodesController& self();
......
......@@ -51,8 +51,8 @@ struct CodeModelItem
class KDEVPLATFORMLANGUAGE_EXPORT CodeModel
{
Q_DISABLE_COPY_MOVE(CodeModel)
public:
CodeModel();
public:
/**
* There can only be one item for each identifier.
* If an item with this identifier already exists, the kind is updated.
......
......@@ -26,8 +26,8 @@ class IndexedDUContext;
class KDEVPLATFORMLANGUAGE_EXPORT Importers
{
Q_DISABLE_COPY_MOVE(Importers)
public:
Importers();
public:
/**
* Adds a top-context to the users-list of the given id
* */
......
......@@ -92,10 +92,9 @@ struct KDEVPLATFORMLANGUAGE_EXPORT RecursiveImportCacheRepository
* */
class KDEVPLATFORMLANGUAGE_EXPORT PersistentSymbolTable
{
public:
/// Constructor.
Q_DISABLE_COPY_MOVE(PersistentSymbolTable)
PersistentSymbolTable();
/// Destructor.
public:
~PersistentSymbolTable();
///Adds declaration @p declaration with id @p id to the symbol table
......
......@@ -74,6 +74,7 @@ public:
bool recursive = true);
private:
Q_DISABLE_COPY_MOVE(SpecializationStore)
SpecializationStore();
~SpecializationStore();
QHash<DeclarationId, IndexedInstantiationInformation> m_specializations;
......
......@@ -122,6 +122,8 @@ public:
*/
class KDEVPLATFORMLANGUAGE_EXPORT TypeSystem
{
Q_DISABLE_COPY_MOVE(TypeSystem)
TypeSystem() = default;
public:
/**
* Register a new AbstractType subclass.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment