Commit bdb4e48e authored by Roberto Raggi's avatar Roberto Raggi

Store the working list in a QHash.

parent 0614e19d
......@@ -68,12 +68,12 @@ namespace {
class ProcessFile: public std::unary_function<QString, QList<Usage> >
{
const QMap<QString, QString> workingList;
const QHash<QString, QString> workingList;
const Snapshot snapshot;
Symbol *symbol;
public:
ProcessFile(const QMap<QString, QString> workingList,
ProcessFile(const QHash<QString, QString> workingList,
const Snapshot snapshot,
Symbol *symbol)
: workingList(workingList), snapshot(snapshot), symbol(symbol)
......@@ -168,7 +168,7 @@ QList<int> CppFindReferences::references(Symbol *symbol,
}
static void find_helper(QFutureInterface<Usage> &future,
const QMap<QString, QString> wl,
const QHash<QString, QString> workingList,
Snapshot snapshot,
Symbol *symbol)
{
......@@ -199,7 +199,7 @@ static void find_helper(QFutureInterface<Usage> &future,
future.setProgressRange(0, files.size());
ProcessFile process(wl, snapshot, symbol);
ProcessFile process(workingList, snapshot, symbol);
UpdateUI reduce(&future);
QtConcurrent::blockingMappedReduced<QList<Usage> > (files, process, reduce);
......@@ -243,7 +243,7 @@ void CppFindReferences::findAll_helper(Symbol *symbol)
_resultWindow->popup(true);
const Snapshot snapshot = _modelManager->snapshot();
const QMap<QString, QString> wl = _modelManager->workingCopy();
const QHash<QString, QString> wl = _modelManager->workingCopy();
Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
......
......@@ -172,7 +172,7 @@ public:
virtual ~CppPreprocessor();
void setRevision(unsigned revision);
void setWorkingCopy(const QMap<QString, QString> &workingCopy);
void setWorkingCopy(const QHash<QString, QString> &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<QString, QString> m_workingCopy;
QHash<QString, QString> m_workingCopy;
QStringList m_projectFiles;
QStringList m_frameworkPaths;
QSet<QString> m_included;
......@@ -242,7 +242,7 @@ CppPreprocessor::~CppPreprocessor()
void CppPreprocessor::setRevision(unsigned revision)
{ m_revision = revision; }
void CppPreprocessor::setWorkingCopy(const QMap<QString, QString> &workingCopy)
void CppPreprocessor::setWorkingCopy(const QHash<QString, QString> &workingCopy)
{ m_workingCopy = workingCopy; }
void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
......@@ -264,13 +264,13 @@ class Process: public std::unary_function<Document::Ptr, void>
{
QPointer<CppModelManager> _modelManager;
Snapshot _snapshot;
QMap<QString, QString> _workingCopy;
QHash<QString, QString> _workingCopy;
Document::Ptr _doc;
public:
Process(QPointer<CppModelManager> modelManager,
Snapshot snapshot,
const QMap<QString, QString> &workingCopy)
const QHash<QString, QString> &workingCopy)
: _modelManager(modelManager),
_snapshot(snapshot),
_workingCopy(workingCopy)
......@@ -789,9 +789,9 @@ void CppModelManager::renameUsages(CPlusPlus::Symbol *symbol)
m_findReferences->renameUsages(symbol);
}
QMap<QString, QString> CppModelManager::buildWorkingCopyList()
QHash<QString, QString> CppModelManager::buildWorkingCopyList()
{
QMap<QString, QString> workingCopy;
QHash<QString, QString> workingCopy;
QMapIterator<TextEditor::ITextEditor *, CppEditorSupport *> it(m_editorSupport);
while (it.hasNext()) {
it.next();
......@@ -815,7 +815,7 @@ QMap<QString, QString> CppModelManager::buildWorkingCopyList()
return workingCopy;
}
QMap<QString, QString> CppModelManager::workingCopy() const
QHash<QString, QString> CppModelManager::workingCopy() const
{
return const_cast<CppModelManager *>(this)->buildWorkingCopyList();
}
......@@ -870,7 +870,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)
{
if (! sourceFiles.isEmpty() && m_indexerEnabled) {
const QMap<QString, QString> workingCopy = buildWorkingCopyList();
const QHash<QString, QString> workingCopy = buildWorkingCopyList();
CppPreprocessor *preproc = new CppPreprocessor(this);
preproc->setRevision(++m_revision);
......
......@@ -36,12 +36,12 @@
#include <texteditor/basetexteditor.h>
#include <QMap>
#include <QFutureInterface>
#include <QFutureSynchronizer>
#include <QMutex>
#include <QTimer>
#include <QTextEdit>
#include <QtCore/QHash>
#include <QtCore/QFutureInterface>
#include <QtCore/QFutureSynchronizer>
#include <QtCore/QMutex>
#include <QtCore/QTimer>
#include <QtGui/QTextEdit> // for QTextEdit::ExtraSelection
namespace Core {
class ICore;
......@@ -73,7 +73,7 @@ public:
virtual ~CppModelManager();
virtual void updateSourceFiles(const QStringList &sourceFiles);
virtual QMap<QString, QString> workingCopy() const;
virtual QHash<QString, QString> workingCopy() const;
virtual QList<ProjectInfo> projectInfos() const;
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
......@@ -131,7 +131,7 @@ private Q_SLOTS:
void updateEditorSelections();
private:
QMap<QString, QString> buildWorkingCopyList();
QHash<QString, QString> buildWorkingCopyList();
QStringList projectFiles()
{
......
......@@ -33,7 +33,7 @@
#include <cpptools/cpptools_global.h>
#include <cplusplus/CppDocument.h>
#include <QtCore/QObject>
#include <QtCore/QMap>
#include <QtCore/QHash>
#include <QtCore/QPointer>
#include <QtCore/QStringList>
......@@ -84,7 +84,7 @@ public:
static CppModelManagerInterface *instance();
virtual QMap<QString, QString> workingCopy() const = 0;
virtual QHash<QString, QString> workingCopy() const = 0;
virtual CPlusPlus::Snapshot snapshot() const = 0;
virtual QList<ProjectInfo> projectInfos() const = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment