forked from qt-creator/qt-creator
Store the working list in a QHash.
This commit is contained in:
@@ -68,12 +68,12 @@ namespace {
|
|||||||
|
|
||||||
class ProcessFile: public std::unary_function<QString, QList<Usage> >
|
class ProcessFile: public std::unary_function<QString, QList<Usage> >
|
||||||
{
|
{
|
||||||
const QMap<QString, QString> workingList;
|
const QHash<QString, QString> workingList;
|
||||||
const Snapshot snapshot;
|
const Snapshot snapshot;
|
||||||
Symbol *symbol;
|
Symbol *symbol;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ProcessFile(const QMap<QString, QString> workingList,
|
ProcessFile(const QHash<QString, QString> workingList,
|
||||||
const Snapshot snapshot,
|
const Snapshot snapshot,
|
||||||
Symbol *symbol)
|
Symbol *symbol)
|
||||||
: workingList(workingList), 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,
|
static void find_helper(QFutureInterface<Usage> &future,
|
||||||
const QMap<QString, QString> wl,
|
const QHash<QString, QString> workingList,
|
||||||
Snapshot snapshot,
|
Snapshot snapshot,
|
||||||
Symbol *symbol)
|
Symbol *symbol)
|
||||||
{
|
{
|
||||||
@@ -199,7 +199,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
|||||||
|
|
||||||
future.setProgressRange(0, files.size());
|
future.setProgressRange(0, files.size());
|
||||||
|
|
||||||
ProcessFile process(wl, snapshot, symbol);
|
ProcessFile process(workingList, snapshot, symbol);
|
||||||
UpdateUI reduce(&future);
|
UpdateUI reduce(&future);
|
||||||
|
|
||||||
QtConcurrent::blockingMappedReduced<QList<Usage> > (files, process, reduce);
|
QtConcurrent::blockingMappedReduced<QList<Usage> > (files, process, reduce);
|
||||||
@@ -243,7 +243,7 @@ void CppFindReferences::findAll_helper(Symbol *symbol)
|
|||||||
_resultWindow->popup(true);
|
_resultWindow->popup(true);
|
||||||
|
|
||||||
const Snapshot snapshot = _modelManager->snapshot();
|
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();
|
Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
|
||||||
|
|
||||||
|
@@ -172,7 +172,7 @@ public:
|
|||||||
virtual ~CppPreprocessor();
|
virtual ~CppPreprocessor();
|
||||||
|
|
||||||
void setRevision(unsigned revision);
|
void setRevision(unsigned revision);
|
||||||
void setWorkingCopy(const QMap<QString, QString> &workingCopy);
|
void setWorkingCopy(const QHash<QString, QString> &workingCopy);
|
||||||
void setIncludePaths(const QStringList &includePaths);
|
void setIncludePaths(const QStringList &includePaths);
|
||||||
void setFrameworkPaths(const QStringList &frameworkPaths);
|
void setFrameworkPaths(const QStringList &frameworkPaths);
|
||||||
void setProjectFiles(const QStringList &files);
|
void setProjectFiles(const QStringList &files);
|
||||||
@@ -216,7 +216,7 @@ private:
|
|||||||
Preprocessor preprocess;
|
Preprocessor preprocess;
|
||||||
QStringList m_includePaths;
|
QStringList m_includePaths;
|
||||||
QStringList m_systemIncludePaths;
|
QStringList m_systemIncludePaths;
|
||||||
QMap<QString, QString> m_workingCopy;
|
QHash<QString, QString> m_workingCopy;
|
||||||
QStringList m_projectFiles;
|
QStringList m_projectFiles;
|
||||||
QStringList m_frameworkPaths;
|
QStringList m_frameworkPaths;
|
||||||
QSet<QString> m_included;
|
QSet<QString> m_included;
|
||||||
@@ -242,7 +242,7 @@ CppPreprocessor::~CppPreprocessor()
|
|||||||
void CppPreprocessor::setRevision(unsigned revision)
|
void CppPreprocessor::setRevision(unsigned revision)
|
||||||
{ m_revision = revision; }
|
{ m_revision = revision; }
|
||||||
|
|
||||||
void CppPreprocessor::setWorkingCopy(const QMap<QString, QString> &workingCopy)
|
void CppPreprocessor::setWorkingCopy(const QHash<QString, QString> &workingCopy)
|
||||||
{ m_workingCopy = workingCopy; }
|
{ m_workingCopy = workingCopy; }
|
||||||
|
|
||||||
void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
|
void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
|
||||||
@@ -264,13 +264,13 @@ class Process: public std::unary_function<Document::Ptr, void>
|
|||||||
{
|
{
|
||||||
QPointer<CppModelManager> _modelManager;
|
QPointer<CppModelManager> _modelManager;
|
||||||
Snapshot _snapshot;
|
Snapshot _snapshot;
|
||||||
QMap<QString, QString> _workingCopy;
|
QHash<QString, QString> _workingCopy;
|
||||||
Document::Ptr _doc;
|
Document::Ptr _doc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Process(QPointer<CppModelManager> modelManager,
|
Process(QPointer<CppModelManager> modelManager,
|
||||||
Snapshot snapshot,
|
Snapshot snapshot,
|
||||||
const QMap<QString, QString> &workingCopy)
|
const QHash<QString, QString> &workingCopy)
|
||||||
: _modelManager(modelManager),
|
: _modelManager(modelManager),
|
||||||
_snapshot(snapshot),
|
_snapshot(snapshot),
|
||||||
_workingCopy(workingCopy)
|
_workingCopy(workingCopy)
|
||||||
@@ -789,9 +789,9 @@ void CppModelManager::renameUsages(CPlusPlus::Symbol *symbol)
|
|||||||
m_findReferences->renameUsages(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);
|
QMapIterator<TextEditor::ITextEditor *, CppEditorSupport *> it(m_editorSupport);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
@@ -815,7 +815,7 @@ QMap<QString, QString> CppModelManager::buildWorkingCopyList()
|
|||||||
return workingCopy;
|
return workingCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QString> CppModelManager::workingCopy() const
|
QHash<QString, QString> CppModelManager::workingCopy() const
|
||||||
{
|
{
|
||||||
return const_cast<CppModelManager *>(this)->buildWorkingCopyList();
|
return const_cast<CppModelManager *>(this)->buildWorkingCopyList();
|
||||||
}
|
}
|
||||||
@@ -870,7 +870,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const
|
|||||||
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)
|
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)
|
||||||
{
|
{
|
||||||
if (! sourceFiles.isEmpty() && m_indexerEnabled) {
|
if (! sourceFiles.isEmpty() && m_indexerEnabled) {
|
||||||
const QMap<QString, QString> workingCopy = buildWorkingCopyList();
|
const QHash<QString, QString> workingCopy = buildWorkingCopyList();
|
||||||
|
|
||||||
CppPreprocessor *preproc = new CppPreprocessor(this);
|
CppPreprocessor *preproc = new CppPreprocessor(this);
|
||||||
preproc->setRevision(++m_revision);
|
preproc->setRevision(++m_revision);
|
||||||
|
@@ -36,12 +36,12 @@
|
|||||||
|
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
|
|
||||||
#include <QMap>
|
#include <QtCore/QHash>
|
||||||
#include <QFutureInterface>
|
#include <QtCore/QFutureInterface>
|
||||||
#include <QFutureSynchronizer>
|
#include <QtCore/QFutureSynchronizer>
|
||||||
#include <QMutex>
|
#include <QtCore/QMutex>
|
||||||
#include <QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QTextEdit>
|
#include <QtGui/QTextEdit> // for QTextEdit::ExtraSelection
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class ICore;
|
class ICore;
|
||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
virtual ~CppModelManager();
|
virtual ~CppModelManager();
|
||||||
|
|
||||||
virtual void updateSourceFiles(const QStringList &sourceFiles);
|
virtual void updateSourceFiles(const QStringList &sourceFiles);
|
||||||
virtual QMap<QString, QString> workingCopy() const;
|
virtual QHash<QString, QString> workingCopy() const;
|
||||||
|
|
||||||
virtual QList<ProjectInfo> projectInfos() const;
|
virtual QList<ProjectInfo> projectInfos() const;
|
||||||
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
|
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
|
||||||
@@ -131,7 +131,7 @@ private Q_SLOTS:
|
|||||||
void updateEditorSelections();
|
void updateEditorSelections();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QString> buildWorkingCopyList();
|
QHash<QString, QString> buildWorkingCopyList();
|
||||||
|
|
||||||
QStringList projectFiles()
|
QStringList projectFiles()
|
||||||
{
|
{
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#include <cpptools/cpptools_global.h>
|
#include <cpptools/cpptools_global.h>
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QHash>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
|
|
||||||
static CppModelManagerInterface *instance();
|
static CppModelManagerInterface *instance();
|
||||||
|
|
||||||
virtual QMap<QString, QString> workingCopy() const = 0;
|
virtual QHash<QString, QString> workingCopy() const = 0;
|
||||||
virtual CPlusPlus::Snapshot snapshot() const = 0;
|
virtual CPlusPlus::Snapshot snapshot() const = 0;
|
||||||
|
|
||||||
virtual QList<ProjectInfo> projectInfos() const = 0;
|
virtual QList<ProjectInfo> projectInfos() const = 0;
|
||||||
|
Reference in New Issue
Block a user