cppfindreferences.h 2.89 KB
Newer Older
Roberto Raggi's avatar
Roberto Raggi committed
1
2
3
4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
Roberto Raggi's avatar
Roberto Raggi committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
con's avatar
con committed
26
** contact the sales department at http://qt.nokia.com/contact.
Roberto Raggi's avatar
Roberto Raggi committed
27
28
29
30
31
32
33
34
35
36
**
**************************************************************************/

#ifndef CPPFINDREFERENCES_H
#define CPPFINDREFERENCES_H

#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QFuture>
#include <QtCore/QFutureWatcher>
37
#include <utils/filesearch.h>
38
#include <cplusplus/CppDocument.h>
39
#include <cplusplus/DependencyTable.h>
Friedemann Kleint's avatar
Friedemann Kleint committed
40
#include <cplusplus/FindUsages.h>
Roberto Raggi's avatar
Roberto Raggi committed
41

42
43
QT_FORWARD_DECLARE_CLASS(QTimer)

Roberto Raggi's avatar
Roberto Raggi committed
44
namespace Find {
45
    class SearchResultWindow;
46
    struct SearchResultItem;
Roberto Raggi's avatar
Roberto Raggi committed
47
48
49
} // end of namespace Find

namespace CppTools {
50
class CppModelManagerInterface;
Roberto Raggi's avatar
Roberto Raggi committed
51

52
namespace Internal {
Roberto Raggi's avatar
Roberto Raggi committed
53
54
55
56
57
58

class CppFindReferences: public QObject
{
    Q_OBJECT

public:
59
    CppFindReferences(CppModelManagerInterface *modelManager);
Roberto Raggi's avatar
Roberto Raggi committed
60
61
    virtual ~CppFindReferences();

62
    QList<int> references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) const;
63

Roberto Raggi's avatar
Roberto Raggi committed
64
65
66
67
Q_SIGNALS:
    void changed();

public:
68
69
    void findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
    void renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
Roberto Raggi's avatar
Roberto Raggi committed
70

Christian Kamm's avatar
Christian Kamm committed
71
72
    void findMacroUses(const CPlusPlus::Macro &macro);

Roberto Raggi's avatar
Roberto Raggi committed
73
private Q_SLOTS:
Roberto Raggi's avatar
Roberto Raggi committed
74
    void displayResults(int first, int last);
Roberto Raggi's avatar
Roberto Raggi committed
75
    void searchFinished();
76
    void openEditor(const Find::SearchResultItem &item);
Roberto Raggi's avatar
Roberto Raggi committed
77
    void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items);
78
    void updateDependencyTable();
Roberto Raggi's avatar
Roberto Raggi committed
79

80
private:
81
    void findAll_helper(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
82

Roberto Raggi's avatar
Roberto Raggi committed
83
private:
84
    QPointer<CppModelManagerInterface> _modelManager;
Roberto Raggi's avatar
Roberto Raggi committed
85
    Find::SearchResultWindow *_resultWindow;
86
    QFutureWatcher<CPlusPlus::Usage> m_watcher;
87
    CPlusPlus::DependencyTable m_deps;
Roberto Raggi's avatar
Roberto Raggi committed
88
89
90
91
92
93
};

} // end of namespace Internal
} // end of namespace CppTools

#endif // CPPFINDREFERENCES_H