From c6358e5d380c18f3ebff148a095ddf3a9d6b266c Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 9 May 2014 10:04:13 -0400 Subject: C++: Add utf16 indices to Macro and Document::MacroUse In most cases we need to work with the utf16 indices. Only in cppfindreferences the byte interface is still needed since there we read in files and work on a QByteArray to save memory. Change-Id: I6ef6a93fc1875a8c9a305c075d51a9ca034c41bb Reviewed-by: Erik Verbruggen --- src/libs/cplusplus/Macro.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/libs/cplusplus/Macro.h') diff --git a/src/libs/cplusplus/Macro.h b/src/libs/cplusplus/Macro.h index 0258345cfe..01bb3dce9f 100644 --- a/src/libs/cplusplus/Macro.h +++ b/src/libs/cplusplus/Macro.h @@ -71,6 +71,9 @@ public: QByteArray name() const { return _name; } + QString nameToQString() const + { return QString::fromUtf8(_name, _name.size()); } + void setName(const QByteArray &name) { _name = name; } @@ -107,11 +110,17 @@ public: void setLine(unsigned line) { _line = line; } - unsigned offset() const - { return _offset; } + unsigned bytesOffset() const + { return _bytesOffset; } + + void setBytesOffset(unsigned bytesOffset) + { _bytesOffset = bytesOffset; } + + unsigned utf16CharOffset() const + { return _utf16charsOffset; } - void setOffset(unsigned offset) - { _offset = offset; } + void setUtf16charOffset(unsigned utf16charOffset) + { _utf16charsOffset = utf16charOffset; } unsigned length() const { return _length; } @@ -161,7 +170,8 @@ private: unsigned _hashcode; unsigned _fileRevision; unsigned _line; - unsigned _offset; + unsigned _bytesOffset; + unsigned _utf16charsOffset; unsigned _length; union -- cgit v1.2.1