2009-08-07 13:02:36 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2009-08-07 13:02:36 +02:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2009-08-07 13:02:36 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2009-08-07 13:02:36 +02:00
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-08-07 13:02:36 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef CPPFINDREFERENCES_H
|
|
|
|
|
#define CPPFINDREFERENCES_H
|
|
|
|
|
|
2010-09-10 14:16:06 +02:00
|
|
|
#include <QtCore/QMutex>
|
2009-08-07 13:02:36 +02:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QPointer>
|
|
|
|
|
#include <QtCore/QFuture>
|
|
|
|
|
#include <QtCore/QFutureWatcher>
|
2009-09-23 17:38:36 +02:00
|
|
|
#include <utils/filesearch.h>
|
2009-09-30 13:25:40 +02:00
|
|
|
#include <cplusplus/CppDocument.h>
|
2010-03-17 12:34:29 +01:00
|
|
|
#include <cplusplus/DependencyTable.h>
|
2009-10-27 12:36:07 +01:00
|
|
|
#include <cplusplus/FindUsages.h>
|
2009-08-07 13:02:36 +02:00
|
|
|
|
2010-03-17 14:18:32 +01:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QTimer)
|
|
|
|
|
|
2009-08-07 13:02:36 +02:00
|
|
|
namespace Find {
|
2009-09-24 16:51:40 +02:00
|
|
|
class SearchResultWindow;
|
2009-10-05 16:01:50 +02:00
|
|
|
struct SearchResultItem;
|
2009-08-07 13:02:36 +02:00
|
|
|
} // end of namespace Find
|
|
|
|
|
|
2010-12-03 13:49:35 +01:00
|
|
|
namespace CPlusPlus {
|
2009-10-12 10:38:00 +02:00
|
|
|
class CppModelManagerInterface;
|
2010-12-03 13:49:35 +01:00
|
|
|
}
|
2009-08-07 13:02:36 +02:00
|
|
|
|
2010-12-03 13:49:35 +01:00
|
|
|
namespace CppTools {
|
2009-10-12 10:38:00 +02:00
|
|
|
namespace Internal {
|
2009-08-07 13:02:36 +02:00
|
|
|
|
|
|
|
|
class CppFindReferences: public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-12-03 13:49:35 +01:00
|
|
|
CppFindReferences(CPlusPlus::CppModelManagerInterface *modelManager);
|
2009-08-07 13:02:36 +02:00
|
|
|
virtual ~CppFindReferences();
|
|
|
|
|
|
2010-05-31 12:09:28 +02:00
|
|
|
QList<int> references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) const;
|
2009-09-30 13:25:40 +02:00
|
|
|
|
2009-08-07 13:02:36 +02:00
|
|
|
Q_SIGNALS:
|
|
|
|
|
void changed();
|
|
|
|
|
|
|
|
|
|
public:
|
2010-05-31 12:09:28 +02:00
|
|
|
void findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
|
2010-07-20 11:02:37 +02:00
|
|
|
void renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context,
|
|
|
|
|
const QString &replacement = QString());
|
2009-08-07 13:02:36 +02:00
|
|
|
|
2009-12-21 14:54:10 +01:00
|
|
|
void findMacroUses(const CPlusPlus::Macro ¯o);
|
|
|
|
|
|
2010-09-10 14:16:06 +02:00
|
|
|
CPlusPlus::DependencyTable updateDependencyTable(CPlusPlus::Snapshot snapshot);
|
|
|
|
|
|
2009-08-07 13:02:36 +02:00
|
|
|
private Q_SLOTS:
|
2009-12-01 17:07:35 +01:00
|
|
|
void displayResults(int first, int last);
|
2009-08-07 13:02:36 +02:00
|
|
|
void searchFinished();
|
2009-10-05 16:01:50 +02:00
|
|
|
void openEditor(const Find::SearchResultItem &item);
|
2009-10-05 18:02:46 +02:00
|
|
|
void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items);
|
2009-08-07 13:02:36 +02:00
|
|
|
|
2009-10-05 15:17:25 +02:00
|
|
|
private:
|
2010-05-31 12:09:28 +02:00
|
|
|
void findAll_helper(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
|
2010-09-10 14:16:06 +02:00
|
|
|
CPlusPlus::DependencyTable dependencyTable() const;
|
|
|
|
|
void setDependencyTable(const CPlusPlus::DependencyTable &newTable);
|
2009-10-05 15:17:25 +02:00
|
|
|
|
2009-08-07 13:02:36 +02:00
|
|
|
private:
|
2010-12-03 13:49:35 +01:00
|
|
|
QPointer<CPlusPlus::CppModelManagerInterface> _modelManager;
|
2009-08-07 13:02:36 +02:00
|
|
|
Find::SearchResultWindow *_resultWindow;
|
2009-10-27 12:01:45 +01:00
|
|
|
QFutureWatcher<CPlusPlus::Usage> m_watcher;
|
2010-09-10 14:16:06 +02:00
|
|
|
|
|
|
|
|
mutable QMutex m_depsLock;
|
2010-03-17 12:34:29 +01:00
|
|
|
CPlusPlus::DependencyTable m_deps;
|
2009-08-07 13:02:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // end of namespace Internal
|
|
|
|
|
} // end of namespace CppTools
|
|
|
|
|
|
|
|
|
|
#endif // CPPFINDREFERENCES_H
|