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)
|
static Q_LOGGING_CATEGORY(indexerLog, "qtc.cppeditor.indexer", QtWarningMsg)
|
||||||
|
|
||||||
SymbolSearcher::SymbolSearcher(QObject *parent)
|
SymbolSearcher::SymbolSearcher(const SymbolSearcher::Parameters ¶meters,
|
||||||
: QObject(parent)
|
const QSet<QString> &fileNames)
|
||||||
{
|
: m_snapshot(CppModelManager::instance()->snapshot())
|
||||||
}
|
, m_parameters(parameters)
|
||||||
|
, m_fileNames(fileNames)
|
||||||
SymbolSearcher::~SymbolSearcher() = default;
|
{}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -241,21 +241,8 @@ void parse(QFutureInterface<void> &indexingFuture, const ParseParams params)
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
void SymbolSearcher::runSearch(QFutureInterface<Core::SearchResultItem> &future)
|
||||||
class BuiltinSymbolSearcher: public SymbolSearcher
|
|
||||||
{
|
{
|
||||||
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.setProgressRange(0, m_snapshot.size());
|
||||||
future.setProgressValue(0);
|
future.setProgressValue(0);
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
@@ -311,13 +298,7 @@ public:
|
|||||||
}
|
}
|
||||||
if (future.isPaused())
|
if (future.isPaused())
|
||||||
future.waitForResume();
|
future.waitForResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
const CPlusPlus::Snapshot m_snapshot;
|
|
||||||
const Parameters m_parameters;
|
|
||||||
const QSet<QString> m_fileNames;
|
|
||||||
};
|
|
||||||
|
|
||||||
CppIndexingSupport::CppIndexingSupport()
|
CppIndexingSupport::CppIndexingSupport()
|
||||||
{
|
{
|
||||||
@@ -356,7 +337,7 @@ QFuture<void> CppIndexingSupport::refreshSourceFiles(const QSet<QString> &source
|
|||||||
SymbolSearcher *CppIndexingSupport::createSymbolSearcher(
|
SymbolSearcher *CppIndexingSupport::createSymbolSearcher(
|
||||||
const SymbolSearcher::Parameters ¶meters, const QSet<QString> &fileNames)
|
const SymbolSearcher::Parameters ¶meters, const QSet<QString> &fileNames)
|
||||||
{
|
{
|
||||||
return new BuiltinSymbolSearcher(CppModelManager::instance()->snapshot(), parameters, fileNames);
|
return new SymbolSearcher(parameters, fileNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
@@ -7,11 +7,9 @@
|
|||||||
|
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
|
|
||||||
#include <coreplugin/find/textfindconstants.h>
|
|
||||||
#include <utils/futuresynchronizer.h>
|
#include <utils/futuresynchronizer.h>
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace Core { class SearchResultItem; }
|
namespace Core { class SearchResultItem; }
|
||||||
|
|
||||||
@@ -45,11 +43,13 @@ public:
|
|||||||
SearchScope scope;
|
SearchScope scope;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SymbolSearcher(const SymbolSearcher::Parameters ¶meters, const QSet<QString> &fileNames);
|
||||||
|
void runSearch(QFutureInterface<Core::SearchResultItem> &future);
|
||||||
|
|
||||||
public:
|
private:
|
||||||
SymbolSearcher(QObject *parent = nullptr);
|
const CPlusPlus::Snapshot m_snapshot;
|
||||||
~SymbolSearcher() override = 0;
|
const Parameters m_parameters;
|
||||||
virtual void runSearch(QFutureInterface<Core::SearchResultItem> &future) = 0;
|
const QSet<QString> m_fileNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppIndexingSupport
|
class CPPEDITOR_EXPORT CppIndexingSupport
|
||||||
|
Reference in New Issue
Block a user