From bdb4e48ebf867d8790f025a4dd2385da71ea126d Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 7 Dec 2009 12:36:16 +0100 Subject: [PATCH] Store the working list in a QHash. --- src/plugins/cpptools/cppfindreferences.cpp | 10 +++++----- src/plugins/cpptools/cppmodelmanager.cpp | 18 +++++++++--------- src/plugins/cpptools/cppmodelmanager.h | 16 ++++++++-------- .../cpptools/cppmodelmanagerinterface.h | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 4d167039634..b21dd56e1c7 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -68,12 +68,12 @@ namespace { class ProcessFile: public std::unary_function > { - const QMap workingList; + const QHash workingList; const Snapshot snapshot; Symbol *symbol; public: - ProcessFile(const QMap workingList, + ProcessFile(const QHash workingList, const Snapshot snapshot, Symbol *symbol) : workingList(workingList), snapshot(snapshot), symbol(symbol) @@ -168,7 +168,7 @@ QList CppFindReferences::references(Symbol *symbol, } static void find_helper(QFutureInterface &future, - const QMap wl, + const QHash workingList, Snapshot snapshot, Symbol *symbol) { @@ -199,7 +199,7 @@ static void find_helper(QFutureInterface &future, future.setProgressRange(0, files.size()); - ProcessFile process(wl, snapshot, symbol); + ProcessFile process(workingList, snapshot, symbol); UpdateUI reduce(&future); QtConcurrent::blockingMappedReduced > (files, process, reduce); @@ -243,7 +243,7 @@ void CppFindReferences::findAll_helper(Symbol *symbol) _resultWindow->popup(true); const Snapshot snapshot = _modelManager->snapshot(); - const QMap wl = _modelManager->workingCopy(); + const QHash wl = _modelManager->workingCopy(); Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 37da79ee9f8..204d170ce01 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -172,7 +172,7 @@ public: virtual ~CppPreprocessor(); void setRevision(unsigned revision); - void setWorkingCopy(const QMap &workingCopy); + void setWorkingCopy(const QHash &workingCopy); void setIncludePaths(const QStringList &includePaths); void setFrameworkPaths(const QStringList &frameworkPaths); void setProjectFiles(const QStringList &files); @@ -216,7 +216,7 @@ private: Preprocessor preprocess; QStringList m_includePaths; QStringList m_systemIncludePaths; - QMap m_workingCopy; + QHash m_workingCopy; QStringList m_projectFiles; QStringList m_frameworkPaths; QSet m_included; @@ -242,7 +242,7 @@ CppPreprocessor::~CppPreprocessor() void CppPreprocessor::setRevision(unsigned revision) { m_revision = revision; } -void CppPreprocessor::setWorkingCopy(const QMap &workingCopy) +void CppPreprocessor::setWorkingCopy(const QHash &workingCopy) { m_workingCopy = workingCopy; } void CppPreprocessor::setIncludePaths(const QStringList &includePaths) @@ -264,13 +264,13 @@ class Process: public std::unary_function { QPointer _modelManager; Snapshot _snapshot; - QMap _workingCopy; + QHash _workingCopy; Document::Ptr _doc; public: Process(QPointer modelManager, Snapshot snapshot, - const QMap &workingCopy) + const QHash &workingCopy) : _modelManager(modelManager), _snapshot(snapshot), _workingCopy(workingCopy) @@ -789,9 +789,9 @@ void CppModelManager::renameUsages(CPlusPlus::Symbol *symbol) m_findReferences->renameUsages(symbol); } -QMap CppModelManager::buildWorkingCopyList() +QHash CppModelManager::buildWorkingCopyList() { - QMap workingCopy; + QHash workingCopy; QMapIterator it(m_editorSupport); while (it.hasNext()) { it.next(); @@ -815,7 +815,7 @@ QMap CppModelManager::buildWorkingCopyList() return workingCopy; } -QMap CppModelManager::workingCopy() const +QHash CppModelManager::workingCopy() const { return const_cast(this)->buildWorkingCopyList(); } @@ -870,7 +870,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles) { if (! sourceFiles.isEmpty() && m_indexerEnabled) { - const QMap workingCopy = buildWorkingCopyList(); + const QHash workingCopy = buildWorkingCopyList(); CppPreprocessor *preproc = new CppPreprocessor(this); preproc->setRevision(++m_revision); diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index ded376738f7..6b474a05614 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -36,12 +36,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // for QTextEdit::ExtraSelection namespace Core { class ICore; @@ -73,7 +73,7 @@ public: virtual ~CppModelManager(); virtual void updateSourceFiles(const QStringList &sourceFiles); - virtual QMap workingCopy() const; + virtual QHash workingCopy() const; virtual QList projectInfos() const; virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const; @@ -131,7 +131,7 @@ private Q_SLOTS: void updateEditorSelections(); private: - QMap buildWorkingCopyList(); + QHash buildWorkingCopyList(); QStringList projectFiles() { diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index 2d3b488ea0e..b8c3f7308a9 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -84,7 +84,7 @@ public: static CppModelManagerInterface *instance(); - virtual QMap workingCopy() const = 0; + virtual QHash workingCopy() const = 0; virtual CPlusPlus::Snapshot snapshot() const = 0; virtual QList projectInfos() const = 0;