diff options
author | hjk <hjk@qt.io> | 2022-11-24 15:21:15 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2022-12-14 09:14:12 +0000 |
commit | 4159c4b5d55c65d0759925e0dc8c63c60653b367 (patch) | |
tree | fbd8154d8317b25bcbb55bc715e2033cc412d30f /src/plugins/cppeditor/cppelementevaluator.cpp | |
parent | 9bac0d7f4c574a88455771b88f078c0c10dd9b32 (diff) | |
download | qt-creator-4159c4b5d55c65d0759925e0dc8c63c60653b367.tar.gz |
CppEditor: More migration to FilePath
Change-Id: I261b713671e00bb567f61b4ee5ecf6fa83473bff
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppelementevaluator.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppelementevaluator.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp index c0f1680429..44940cdead 100644 --- a/src/plugins/cppeditor/cppelementevaluator.cpp +++ b/src/plugins/cppeditor/cppelementevaluator.cpp @@ -74,7 +74,7 @@ public: } public: - Utils::FilePath path; + FilePath path; QString fileName; }; @@ -87,7 +87,7 @@ public: const QString macroName = QString::fromUtf8(macro.name(), macro.name().size()); helpIdCandidates = QStringList(macroName); helpMark = macroName; - link = Utils::Link(macro.filePath(), macro.line()); + link = Link(macro.filePath(), macro.line()); tooltip = macro.toStringWithLineBreaks(); } }; @@ -325,9 +325,7 @@ static Symbol *followClassDeclaration(Symbol *symbol, const Snapshot &snapshot, return symbol; if (context) { - const QString fileName = QString::fromUtf8(classDeclaration->fileName(), - classDeclaration->fileNameLength()); - const Document::Ptr declarationDocument = snapshot.document(fileName); + const Document::Ptr declarationDocument = snapshot.document(classDeclaration->filePath()); if (declarationDocument != context->thisDocument()) (*context) = LookupContext(declarationDocument, snapshot); } @@ -503,15 +501,15 @@ static QFuture<QSharedPointer<CppElement>> asyncExec( class FromExpressionFunctor { public: - FromExpressionFunctor(const QString &expression, const QString &fileName) + FromExpressionFunctor(const QString &expression, const FilePath &filePath) : m_expression(expression) - , m_fileName(fileName) + , m_filePath(filePath) {} bool operator()(const CPlusPlus::Snapshot &snapshot, Document::Ptr &doc, Scope **scope, QString &expression) { - doc = snapshot.document(m_fileName); + doc = snapshot.document(m_filePath); if (doc.isNull()) return false; @@ -523,13 +521,13 @@ public: } private: const QString m_expression; - const QString m_fileName; + const FilePath m_filePath; }; QFuture<QSharedPointer<CppElement>> CppElementEvaluator::asyncExecute(const QString &expression, - const QString &fileName) + const FilePath &filePath) { - return exec(FromExpressionFunctor(expression, fileName), asyncExec); + return exec(FromExpressionFunctor(expression, filePath), asyncExec); } class FromGuiFunctor @@ -692,10 +690,10 @@ const QString &CppElementEvaluator::diagnosis() const return d->m_functor.m_diagnosis; } -Utils::Link CppElementEvaluator::linkFromExpression(const QString &expression, const QString &fileName) +Utils::Link CppElementEvaluator::linkFromExpression(const QString &expression, const FilePath &filePath) { const Snapshot &snapshot = CppModelManager::instance()->snapshot(); - Document::Ptr doc = snapshot.document(fileName); + Document::Ptr doc = snapshot.document(filePath); if (doc.isNull()) return Utils::Link(); Scope *scope = doc->globalNamespace(); |