forked from qt-creator/qt-creator
SymbolSearcher: Flatten class hierarchy
Don't make SymbolSearcher a pure virtual class as there is only one subclass. Change-Id: I85a9d0fd3574e29620c1e6bfdb3b3421e19a4f76 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -27,12 +27,12 @@ namespace CppEditor {
|
||||
|
||||
static Q_LOGGING_CATEGORY(indexerLog, "qtc.cppeditor.indexer", QtWarningMsg)
|
||||
|
||||
SymbolSearcher::SymbolSearcher(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
SymbolSearcher::~SymbolSearcher() = default;
|
||||
SymbolSearcher::SymbolSearcher(const SymbolSearcher::Parameters ¶meters,
|
||||
const QSet<QString> &fileNames)
|
||||
: m_snapshot(CppModelManager::instance()->snapshot())
|
||||
, m_parameters(parameters)
|
||||
, m_fileNames(fileNames)
|
||||
{}
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -241,21 +241,8 @@ void parse(QFutureInterface<void> &indexingFuture, const ParseParams params)
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
class BuiltinSymbolSearcher: public SymbolSearcher
|
||||
void SymbolSearcher::runSearch(QFutureInterface<Core::SearchResultItem> &future)
|
||||
{
|
||||
public:
|
||||
BuiltinSymbolSearcher(const CPlusPlus::Snapshot &snapshot,
|
||||
const Parameters ¶meters, const QSet<QString> &fileNames)
|
||||
: m_snapshot(snapshot)
|
||||
, m_parameters(parameters)
|
||||
, m_fileNames(fileNames)
|
||||
{}
|
||||
|
||||
~BuiltinSymbolSearcher() override = default;
|
||||
|
||||
void runSearch(QFutureInterface<Core::SearchResultItem> &future) override
|
||||
{
|
||||
future.setProgressRange(0, m_snapshot.size());
|
||||
future.setProgressValue(0);
|
||||
int progress = 0;
|
||||
@@ -311,13 +298,7 @@ public:
|
||||
}
|
||||
if (future.isPaused())
|
||||
future.waitForResume();
|
||||
}
|
||||
|
||||
private:
|
||||
const CPlusPlus::Snapshot m_snapshot;
|
||||
const Parameters m_parameters;
|
||||
const QSet<QString> m_fileNames;
|
||||
};
|
||||
}
|
||||
|
||||
CppIndexingSupport::CppIndexingSupport()
|
||||
{
|
||||
@@ -356,7 +337,7 @@ QFuture<void> CppIndexingSupport::refreshSourceFiles(const QSet<QString> &source
|
||||
SymbolSearcher *CppIndexingSupport::createSymbolSearcher(
|
||||
const SymbolSearcher::Parameters ¶meters, const QSet<QString> &fileNames)
|
||||
{
|
||||
return new BuiltinSymbolSearcher(CppModelManager::instance()->snapshot(), parameters, fileNames);
|
||||
return new SymbolSearcher(parameters, fileNames);
|
||||
}
|
||||
|
||||
} // namespace CppEditor
|
||||
|
@@ -7,11 +7,9 @@
|
||||
|
||||
#include "cppmodelmanager.h"
|
||||
|
||||
#include <coreplugin/find/textfindconstants.h>
|
||||
#include <utils/futuresynchronizer.h>
|
||||
|
||||
#include <QFuture>
|
||||
#include <QStringList>
|
||||
|
||||
namespace Core { class SearchResultItem; }
|
||||
|
||||
@@ -45,11 +43,13 @@ public:
|
||||
SearchScope scope;
|
||||
};
|
||||
|
||||
SymbolSearcher(const SymbolSearcher::Parameters ¶meters, const QSet<QString> &fileNames);
|
||||
void runSearch(QFutureInterface<Core::SearchResultItem> &future);
|
||||
|
||||
public:
|
||||
SymbolSearcher(QObject *parent = nullptr);
|
||||
~SymbolSearcher() override = 0;
|
||||
virtual void runSearch(QFutureInterface<Core::SearchResultItem> &future) = 0;
|
||||
private:
|
||||
const CPlusPlus::Snapshot m_snapshot;
|
||||
const Parameters m_parameters;
|
||||
const QSet<QString> m_fileNames;
|
||||
};
|
||||
|
||||
class CPPEDITOR_EXPORT CppIndexingSupport
|
||||
|
Reference in New Issue
Block a user