aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangcodemodel/clangdfindreferences.h
blob: e110b355434bb02a2f5d4dea1261c2f76fc680a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <cppeditor/cursorineditor.h>
#include <utils/link.h>
#include <utils/searchresultitem.h>

#include <QObject>

#include <optional>

QT_BEGIN_NAMESPACE
class QTextCursor;
QT_END_NAMESPACE

namespace Core { class SearchResult; }
namespace TextEditor { class TextDocument; }

namespace ClangCodeModel::Internal {
class ClangdClient;

class ClangdFindReferences : public QObject
{
    Q_OBJECT
public:
    ClangdFindReferences(ClangdClient *client, TextEditor::TextDocument *document,
                         const QTextCursor &cursor, const QString &searchTerm,
                         const std::optional<QString> &replacement,
                         const std::function<void()> &callback,
                         bool categorize);
    ClangdFindReferences(ClangdClient *client, const Utils::Link &link, Core::SearchResult *search,
                         const Utils::LinkHandler &callback);
    ~ClangdFindReferences();

signals:
    void foundReferences(const Utils::SearchResultItems &items);
    void done();

private:
    class Private;
    class CheckUnusedData;
    Private * const d;
};

class ClangdFindLocalReferences : public QObject
{
    Q_OBJECT
public:
    explicit ClangdFindLocalReferences(ClangdClient *client, TextEditor::TextDocument *document,
                                       const QTextCursor &cursor,
                                       const CppEditor::RenameCallback &callback);
    ~ClangdFindLocalReferences();

signals:
    void done();

private:
    class Private;
    Private * const d;
};

} // namespace ClangCodeModel::Internal