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

Remove useless empty *Private classes

Several recent commits ported CodeModel, Importers, Uses and Definitions
to LockedItemRepository::op pattern. These commits made the
corresponding private classes empty and d-pointers redundant. KDevelop's
binary compatibility is not very important, while the code is shorter
and simpler now. The private classes are unlikely to be resurrected any
time soon.

Disable copying and moving these classes as they are meant to be
singletons. Copy and move operations were deleted before this commit due
to QScopedPointer d_ptr data members, which are now gone.
parent dcbc28a7
......@@ -181,18 +181,11 @@ public:
}
};
class CodeModelPrivate
{
};
CodeModel::CodeModel()
: d_ptr(nullptr)
{
ItemRepositoryFor<CodeModel>::init();
}
CodeModel::~CodeModel() = default;
void CodeModel::addItem(const IndexedString& file, const IndexedQualifiedIdentifier& id, CodeModelItem::Kind kind)
{
ifDebug(qCDebug(LANGUAGE) << "addItem" << file.str() << id.identifier().toString() << id.index; )
......
......@@ -9,8 +9,6 @@
#include "identifier.h"
#include <QScopedPointer>
namespace KDevelop {
class Declaration;
class IndexedDeclaration;
......@@ -18,7 +16,6 @@ class DeclarationId;
class TopDUContext;
class QualifiedIdentifier;
class IndexedString;
class CodeModelPrivate;
struct CodeModelItem
{
......@@ -53,10 +50,9 @@ struct CodeModelItem
*/
class KDEVPLATFORMLANGUAGE_EXPORT CodeModel
{
Q_DISABLE_COPY_MOVE(CodeModel)
public:
CodeModel();
~CodeModel();
/**
* There can only be one item for each identifier.
* If an item with this identifier already exists, the kind is updated.
......@@ -81,10 +77,6 @@ public:
void items(const IndexedString& file, uint& count, const CodeModelItem*& items) const;
static CodeModel& self();
private:
const QScopedPointer<class CodeModelPrivate> d_ptr;
Q_DECLARE_PRIVATE(CodeModel)
};
}
......
......@@ -164,18 +164,11 @@ public:
static void init() { repo(); }
};
class DefinitionsPrivate
{
};
Definitions::Definitions()
: d_ptr(nullptr)
{
ItemRepositoryFor<DefinitionsItem>::init();
}
Definitions::~Definitions() = default;
void Definitions::addDefinition(const DeclarationId& id, const IndexedDeclaration& definition)
{
DefinitionsItem item;
......
......@@ -11,8 +11,6 @@
#include <language/languageexport.h>
#include <util/kdevvarlengtharray.h>
#include <QScopedPointer>
class QTextStream;
namespace KDevelop {
......@@ -20,18 +18,15 @@ class Declaration;
class IndexedDeclaration;
class DeclarationId;
class TopDUContext;
class DefinitionsPrivate;
/**
* Global mapping of one Declaration-Ids to multiple Definitions, protected through DUChainLock.
* */
class KDEVPLATFORMLANGUAGE_EXPORT Definitions
{
Q_DISABLE_COPY_MOVE(Definitions)
public:
/// Constructor.
Definitions();
/// Destructor.
~Definitions();
/**
* Assigns @param definition to the given @p id
* */
......@@ -44,10 +39,6 @@ public:
/// Dump contents of the definitions repository to stream @p out
void dump(const QTextStream& out);
private:
const QScopedPointer<class DefinitionsPrivate> d_ptr;
Q_DECLARE_PRIVATE(Definitions)
};
}
......
......@@ -120,18 +120,11 @@ public:
static void init() { repo(); }
};
class ImportersPrivate
{
};
Importers::Importers()
: d_ptr(nullptr)
{
ItemRepositoryFor<ImportersItem>::init();
}
Importers::~Importers() = default;
void Importers::addImporter(const DeclarationId& id, const IndexedDUContext& use)
{
ImportersItem item;
......
......@@ -10,12 +10,9 @@
#include <language/languageexport.h>
#include "declarationid.h"
#include <QScopedPointer>
namespace KDevelop {
class DeclarationId;
class IndexedDUContext;
class ImportersPrivate;
/**
* Global mapping of Declaration-Ids to contexts that import the associated context, protected through DUChainLock.
......@@ -28,11 +25,9 @@ class ImportersPrivate;
* */
class KDEVPLATFORMLANGUAGE_EXPORT Importers
{
Q_DISABLE_COPY_MOVE(Importers)
public:
/// Constructor.
Importers();
/// Destructor.
~Importers();
/**
* Adds a top-context to the users-list of the given id
* */
......@@ -46,10 +41,6 @@ public:
KDevVarLengthArray<IndexedDUContext> importers(const DeclarationId& id) const;
static Importers& self();
private:
const QScopedPointer<class ImportersPrivate> d_ptr;
Q_DECLARE_PRIVATE(Importers)
};
}
......
......@@ -119,18 +119,11 @@ public:
static void init() { repo(); }
};
class UsesPrivate
{
};
Uses::Uses()
: d_ptr(nullptr)
{
ItemRepositoryFor<UsesItem>::init();
}
Uses::~Uses() = default;
void Uses::addUse(const DeclarationId& id, const IndexedTopDUContext& use)
{
UsesItem item;
......
......@@ -10,12 +10,9 @@
#include <language/languageexport.h>
#include <util/kdevvarlengtharray.h>
#include <QScopedPointer>
namespace KDevelop {
class DeclarationId;
class IndexedTopDUContext;
class UsesPrivate;
/**
* Global mapping of Declaration-Ids to top-contexts, protected through DUChainLock.
......@@ -24,11 +21,9 @@ class UsesPrivate;
* */
class KDEVPLATFORMLANGUAGE_EXPORT Uses
{
Q_DISABLE_COPY_MOVE(Uses)
public:
/// Constructor.
Uses();
/// Destructor.
~Uses();
/**
* Adds a top-context to the users-list of the given id
* */
......@@ -44,10 +39,6 @@ public:
///Gets the top-contexts of all users assigned to the declaration-id
KDevVarLengthArray<IndexedTopDUContext> uses(const DeclarationId& id) const;
private:
const QScopedPointer<class UsesPrivate> d_ptr;
Q_DECLARE_PRIVATE(Uses)
};
}
......
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