aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/cplusplus
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-11-24 15:21:15 +0100
committerhjk <hjk@qt.io>2022-12-14 09:14:12 +0000
commit4159c4b5d55c65d0759925e0dc8c63c60653b367 (patch)
treefbd8154d8317b25bcbb55bc715e2033cc412d30f /src/libs/3rdparty/cplusplus
parent9bac0d7f4c574a88455771b88f078c0c10dd9b32 (diff)
CppEditor: More migration to FilePath
Change-Id: I261b713671e00bb567f61b4ee5ecf6fa83473bff Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/libs/3rdparty/cplusplus')
-rw-r--r--src/libs/3rdparty/cplusplus/Symbol.cpp18
-rw-r--r--src/libs/3rdparty/cplusplus/Symbol.h7
2 files changed, 19 insertions, 6 deletions
diff --git a/src/libs/3rdparty/cplusplus/Symbol.cpp b/src/libs/3rdparty/cplusplus/Symbol.cpp
index 01410ecea9..4ed2ab0c72 100644
--- a/src/libs/3rdparty/cplusplus/Symbol.cpp
+++ b/src/libs/3rdparty/cplusplus/Symbol.cpp
@@ -34,7 +34,9 @@
#include <utils/link.h>
-using namespace CPlusPlus;
+using namespace Utils;
+
+namespace CPlusPlus {
class Symbol::HashCode: protected NameVisitor
{
@@ -166,6 +168,12 @@ const char *Symbol::fileName() const
int Symbol::fileNameLength() const
{ return _fileId ? _fileId->size() : 0; }
+Utils::FilePath Symbol::filePath() const
+{
+ return _fileId ? Utils::FilePath::fromUtf8(_fileId->chars(), _fileId->size())
+ : Utils::FilePath();
+}
+
const Name *Symbol::unqualifiedName() const
{
if (! _name)
@@ -280,10 +288,8 @@ void Symbol::copy(Symbol *other)
_isDeprecated = other->_isDeprecated;
}
-Utils::Link Symbol::toLink() const
+Link Symbol::toLink() const
{
- const QString filename = QString::fromUtf8(fileName(), fileNameLength());
-
int line = this->line();
int column = this->column();
@@ -293,5 +299,7 @@ Utils::Link Symbol::toLink() const
if (isGenerated())
column = 0;
- return Utils::Link(Utils::FilePath::fromString(filename), line, column);
+ return Link(filePath(), line, column);
}
+
+} // CPlusPlus
diff --git a/src/libs/3rdparty/cplusplus/Symbol.h b/src/libs/3rdparty/cplusplus/Symbol.h
index 33fe77d80d..497226dcc1 100644
--- a/src/libs/3rdparty/cplusplus/Symbol.h
+++ b/src/libs/3rdparty/cplusplus/Symbol.h
@@ -22,7 +22,10 @@
#include "CPlusPlusForwardDeclarations.h"
-namespace Utils { class Link; }
+namespace Utils {
+class FilePath;
+class Link;
+} // Utils
namespace CPlusPlus {
@@ -78,6 +81,8 @@ public:
/// Returns this Symbol's file name length.
int fileNameLength() const;
+ Utils::FilePath filePath() const;
+
/// Returns this Symbol's name.
const Name *name() const { return _name; }