ILocatorFilter: Remove LocatorMatcherTask typedef

Use ExecutableItem directly instead.

Add some static specifiers.

Change-Id: Ie5ef467d428f8bee7fc800241357be38c85faa15
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2024-09-19 19:26:32 +02:00
parent 52fce7a469
commit d245374da7
6 changed files with 24 additions and 25 deletions

View File

@@ -172,7 +172,7 @@ static void filterCurrentResults(QPromise<void> &promise, const LocatorStorage &
[](const Entry &entry) { return entry.entry; }));
}
static LocatorMatcherTask currentDocumentMatcher()
static ExecutableItem currentDocumentMatcher()
{
Storage<CurrentDocumentSymbolsData> resultStorage;

View File

@@ -1365,7 +1365,7 @@ static void filter(QPromise<LocatorFileCachePrivate> &promise, const LocatorStor
When this cache started a new search in meantime, the cache was invalidated or even deleted,
the update of the cache after a successful run of the task is ignored.
*/
LocatorMatcherTask LocatorFileCache::matcher() const
ExecutableItem LocatorFileCache::matcher() const
{
std::weak_ptr<LocatorFileCachePrivate> weak = d;

View File

@@ -136,8 +136,7 @@ private:
std::shared_ptr<LocatorStoragePrivate> d;
};
using LocatorMatcherTask = Tasking::GroupItem;
using LocatorMatcherTasks = QList<LocatorMatcherTask>;
using LocatorMatcherTasks = QList<Tasking::ExecutableItem>;
using LocatorMatcherTaskCreator = std::function<LocatorMatcherTasks()>;
class LocatorMatcherPrivate;
@@ -307,7 +306,7 @@ public:
std::optional<Utils::FilePaths> filePaths() const;
static FilePathsGenerator filePathsGenerator(const Utils::FilePaths &filePaths);
LocatorMatcherTask matcher() const;
Tasking::ExecutableItem matcher() const;
using MatchedEntries = std::array<LocatorFilterEntries, int(ILocatorFilter::MatchLevel::Count)>;
static Utils::FilePaths processFilePaths(const QFuture<void> &future,

View File

@@ -26,7 +26,7 @@ namespace CppEditor {
using EntryFromIndex = std::function<LocatorFilterEntry(const IndexItem::Ptr &)>;
void matchesFor(QPromise<void> &promise, const LocatorStorage &storage,
static void matchesFor(QPromise<void> &promise, const LocatorStorage &storage,
IndexItem::ItemType wantedType, const EntryFromIndex &converter)
{
const QString input = storage.input();
@@ -100,7 +100,7 @@ void matchesFor(QPromise<void> &promise, const LocatorStorage &storage,
LocatorFilterEntries()));
}
LocatorMatcherTask locatorMatcher(IndexItem::ItemType type, const EntryFromIndex &converter)
static ExecutableItem locatorMatcher(IndexItem::ItemType type, const EntryFromIndex &converter)
{
const auto onSetup = [type, converter](Async<void> &async) {
async.setConcurrentCallData(matchesFor, *LocatorStorage::storage(), type, converter);
@@ -108,7 +108,7 @@ LocatorMatcherTask locatorMatcher(IndexItem::ItemType type, const EntryFromIndex
return AsyncTask<void>(onSetup);
}
LocatorMatcherTask allSymbolsMatcher()
static ExecutableItem allSymbolsMatcher()
{
const auto converter = [](const IndexItem::Ptr &info) {
LocatorFilterEntry filterEntry;
@@ -126,7 +126,7 @@ LocatorMatcherTask allSymbolsMatcher()
return locatorMatcher(IndexItem::All, converter);
}
LocatorMatcherTask classMatcher()
static ExecutableItem classMatcher()
{
const auto converter = [](const IndexItem::Ptr &info) {
LocatorFilterEntry filterEntry;
@@ -142,7 +142,7 @@ LocatorMatcherTask classMatcher()
return locatorMatcher(IndexItem::Class, converter);
}
LocatorMatcherTask functionMatcher()
static ExecutableItem functionMatcher()
{
const auto converter = [](const IndexItem::Ptr &info) {
QString name = info->symbolName();
@@ -163,7 +163,7 @@ LocatorMatcherTask functionMatcher()
return locatorMatcher(IndexItem::Function, converter);
}
QList<IndexItem::Ptr> itemsOfCurrentDocument(const FilePath &currentFileName)
static QList<IndexItem::Ptr> itemsOfCurrentDocument(const FilePath &currentFileName)
{
if (currentFileName.isEmpty())
return {};
@@ -185,7 +185,7 @@ QList<IndexItem::Ptr> itemsOfCurrentDocument(const FilePath &currentFileName)
return results;
}
LocatorFilterEntry::HighlightInfo highlightInfo(const QRegularExpressionMatch &match,
static LocatorFilterEntry::HighlightInfo highlightInfo(const QRegularExpressionMatch &match,
LocatorFilterEntry::HighlightInfo::DataType dataType)
{
const FuzzyMatcher::HighlightingPositions positions =
@@ -194,7 +194,7 @@ LocatorFilterEntry::HighlightInfo highlightInfo(const QRegularExpressionMatch &m
return LocatorFilterEntry::HighlightInfo(positions.starts, positions.lengths, dataType);
}
void matchesForCurrentDocument(QPromise<void> &promise, const LocatorStorage &storage,
static void matchesForCurrentDocument(QPromise<void> &promise, const LocatorStorage &storage,
const FilePath &currentFileName)
{
const QString input = storage.input();
@@ -287,13 +287,13 @@ void matchesForCurrentDocument(QPromise<void> &promise, const LocatorStorage &st
[](const Entry &entry) { return entry.entry; }));
}
FilePath currentFileName()
static FilePath currentFileName()
{
IEditor *currentEditor = EditorManager::currentEditor();
return currentEditor ? currentEditor->document()->filePath() : FilePath();
}
LocatorMatcherTask currentDocumentMatcher()
static ExecutableItem currentDocumentMatcher()
{
const auto onSetup = [](Async<void> &async) {
async.setConcurrentCallData(matchesForCurrentDocument, *LocatorStorage::storage(), currentFileName());
@@ -301,7 +301,7 @@ LocatorMatcherTask currentDocumentMatcher()
return AsyncTask<void>(onSetup);
}
using MatcherCreator = std::function<Core::LocatorMatcherTask()>;
using MatcherCreator = std::function<ExecutableItem()>;
static MatcherCreator creatorForType(MatcherType type)
{

View File

@@ -28,7 +28,7 @@ QTC_DECLARE_MYTESTDATADIR("../../../tests/cpplocators/")
class CppLocatorFilterTestCase : public CppEditor::Tests::TestCase
{
public:
CppLocatorFilterTestCase(const QList<LocatorMatcherTask> &matchers,
CppLocatorFilterTestCase(const LocatorMatcherTasks &matchers,
const QString &fileName,
const QString &searchText,
const ResultDataList &expectedResults)
@@ -54,7 +54,7 @@ class CppCurrentDocumentFilterTestCase : public CppEditor::Tests::TestCase
{
public:
CppCurrentDocumentFilterTestCase(const FilePath &filePath,
const QList<LocatorMatcherTask> &matchers,
const LocatorMatcherTasks &matchers,
const ResultDataList &expectedResults,
const QString &searchText = QString())
{

View File

@@ -20,7 +20,7 @@ using namespace Utils;
namespace LanguageClient {
void filterResults(QPromise<void> &promise, const LocatorStorage &storage, Client *client,
static void filterResults(QPromise<void> &promise, const LocatorStorage &storage, Client *client,
const QList<SymbolInformation> &results, const QList<SymbolKind> &filter)
{
const auto doFilter = [&](const SymbolInformation &info) {
@@ -42,7 +42,7 @@ void filterResults(QPromise<void> &promise, const LocatorStorage &storage, Clien
storage.reportOutput(Utils::transform(filteredResults, generateEntry));
}
LocatorMatcherTask locatorMatcher(Client *client, int maxResultCount,
static ExecutableItem locatorMatcher(Client *client, int maxResultCount,
const QList<SymbolKind> &filter)
{
Storage<QList<SymbolInformation>> resultStorage;
@@ -79,17 +79,17 @@ LocatorMatcherTask locatorMatcher(Client *client, int maxResultCount,
return root;
}
LocatorMatcherTask allSymbolsMatcher(Client *client, int maxResultCount)
static ExecutableItem allSymbolsMatcher(Client *client, int maxResultCount)
{
return locatorMatcher(client, maxResultCount, {});
}
LocatorMatcherTask classMatcher(Client *client, int maxResultCount)
static ExecutableItem classMatcher(Client *client, int maxResultCount)
{
return locatorMatcher(client, maxResultCount, {SymbolKind::Class, SymbolKind::Struct});
}
LocatorMatcherTask functionMatcher(Client *client, int maxResultCount)
static ExecutableItem functionMatcher(Client *client, int maxResultCount)
{
return locatorMatcher(client, maxResultCount,
{SymbolKind::Method, SymbolKind::Function, SymbolKind::Constructor});
@@ -111,7 +111,7 @@ static void filterCurrentResults(QPromise<void> &promise, const LocatorStorage &
docSymbolModifier));
}
LocatorMatcherTask currentDocumentMatcher()
static ExecutableItem currentDocumentMatcher()
{
Storage<CurrentDocumentSymbolsData> resultStorage;
@@ -132,7 +132,7 @@ LocatorMatcherTask currentDocumentMatcher()
return root;
}
using MatcherCreator = std::function<Core::LocatorMatcherTask(Client *, int)>;
using MatcherCreator = std::function<ExecutableItem(Client *, int)>;
static MatcherCreator creatorForType(MatcherType type)
{