| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2013-01-28 17:12:19 +01:00
										 |  |  | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Contact: http://www.qt-project.org/legal
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** This file is part of Qt Creator. | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | ** a written agreement between you and Digia.  For licensing terms and | 
					
						
							|  |  |  | ** conditions see http://qt.digia.com/licensing.  For further information
 | 
					
						
							|  |  |  | ** use the contact form at http://qt.digia.com/contact-us.
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ** GNU Lesser General Public License Usage | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** 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.
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** In addition, as a special exception, Digia gives you certain additional | 
					
						
							|  |  |  | ** rights.  These rights are described in the Digia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef CPPFINDREFERENCES_H
 | 
					
						
							|  |  |  | #define CPPFINDREFERENCES_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-07 20:28:04 +02:00
										 |  |  | #include <cplusplus/DependencyTable.h>
 | 
					
						
							|  |  |  | #include <cplusplus/FindUsages.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-15 10:42:41 +01:00
										 |  |  | #include <QMutex>
 | 
					
						
							|  |  |  | #include <QObject>
 | 
					
						
							|  |  |  | #include <QPointer>
 | 
					
						
							|  |  |  | #include <QFuture>
 | 
					
						
							|  |  |  | #include <QFutureWatcher>
 | 
					
						
							| 
									
										
										
										
											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-10-05 16:01:50 +02:00
										 |  |  |     struct SearchResultItem; | 
					
						
							| 
									
										
										
										
											2011-09-02 11:51:31 +02:00
										 |  |  |     class SearchResult; | 
					
						
							| 
									
										
										
										
											2011-02-04 09:52:39 +01:00
										 |  |  | } // namespace Find
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-02 11:28:11 +02:00
										 |  |  | namespace CppTools { | 
					
						
							| 
									
										
										
										
											2009-10-12 10:38:00 +02:00
										 |  |  | class CppModelManagerInterface; | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-12 10:38:00 +02:00
										 |  |  | namespace Internal { | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-20 18:45:29 +01:00
										 |  |  | class CppFindReferencesParameters | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     CPlusPlus::LookupContext context; | 
					
						
							|  |  |  |     CPlusPlus::Symbol *symbol; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | class CppFindReferences: public QObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2013-04-02 11:28:11 +02:00
										 |  |  |     CppFindReferences(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
										 |  |  | 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); | 
					
						
							| 
									
										
										
										
											2012-03-17 13:26:27 +01:00
										 |  |  |     void renameMacroUses(const CPlusPlus::Macro ¯o, const QString &replacement = QString()); | 
					
						
							| 
									
										
										
										
											2009-12-21 14:54:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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(); | 
					
						
							| 
									
										
										
										
											2011-09-09 08:46:51 +02:00
										 |  |  |     void cancel(); | 
					
						
							| 
									
										
										
										
											2012-05-25 16:45:18 +02:00
										 |  |  |     void setPaused(bool paused); | 
					
						
							| 
									
										
										
										
											2009-10-05 16:01:50 +02:00
										 |  |  |     void openEditor(const Find::SearchResultItem &item); | 
					
						
							| 
									
										
										
										
											2012-11-30 16:15:07 +01:00
										 |  |  |     void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items, bool preserveCase); | 
					
						
							| 
									
										
										
										
											2011-12-20 18:45:29 +01:00
										 |  |  |     void searchAgain(); | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-05 15:17:25 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-12-20 18:45:29 +01:00
										 |  |  |     void findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context, | 
					
						
							|  |  |  |                     const QString &replacement, bool replace); | 
					
						
							| 
									
										
										
										
											2012-03-17 13:26:27 +01:00
										 |  |  |     void findMacroUses(const CPlusPlus::Macro ¯o, const QString &replacement, | 
					
						
							|  |  |  |                        bool replace); | 
					
						
							| 
									
										
										
										
											2011-12-20 18:45:29 +01:00
										 |  |  |     void findAll_helper(Find::SearchResult *search); | 
					
						
							| 
									
										
										
										
											2010-09-10 14:16:06 +02:00
										 |  |  |     CPlusPlus::DependencyTable dependencyTable() const; | 
					
						
							|  |  |  |     void setDependencyTable(const CPlusPlus::DependencyTable &newTable); | 
					
						
							| 
									
										
										
										
											2011-12-20 10:44:13 +01:00
										 |  |  |     void createWatcher(const QFuture<CPlusPlus::Usage> &future, Find::SearchResult *search); | 
					
						
							| 
									
										
										
										
											2011-12-20 18:45:29 +01:00
										 |  |  |     bool findSymbol(CppFindReferencesParameters *parameters, | 
					
						
							|  |  |  |                     const CPlusPlus::Snapshot &snapshot); | 
					
						
							| 
									
										
										
										
											2009-10-05 15:17:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2013-04-02 11:28:11 +02:00
										 |  |  |     QPointer<CppModelManagerInterface> _modelManager; | 
					
						
							| 
									
										
										
										
											2011-12-20 10:44:13 +01:00
										 |  |  |     QMap<QFutureWatcher<CPlusPlus::Usage> *, QPointer<Find::SearchResult> > m_watchers; | 
					
						
							| 
									
										
										
										
											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
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-04 09:52:39 +01:00
										 |  |  | } // namespace Internal
 | 
					
						
							|  |  |  | } // namespace CppTools
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-20 18:45:29 +01:00
										 |  |  | Q_DECLARE_METATYPE(CppTools::Internal::CppFindReferencesParameters) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-07 13:02:36 +02:00
										 |  |  | #endif // CPPFINDREFERENCES_H
 |