path: root/src/corelib/tools/qstringview.h
diff options
authorMarc Mutz <>2017-04-05 00:07:09 +0200
committerMarc Mutz <>2017-04-07 08:54:16 +0000
commit5dc1e08c8c602738f6a827cea0de44683c7bbd0b (patch)
treec413e9dfbeb5db2fc5e9377c9fdac97bf60f457a /src/corelib/tools/qstringview.h
parent86005ea2570fcce81db8e3f4988f5541b4624de8 (diff)
Add qConvertTo{Utf8,Latin1,Local8Bit,Ucs4}() and corresponding QStringView methods
Like the qt_compare_strings()/qCompareStrings() split, distinguish between the internal and exported functions. Because of the circular dependency between qstring.h and qvector.h, the inline toUcs4() function has to be in qvector.h. At some point, we need to refactor the headers so qvector.h is lower in the dependency chain than qstring.h. It's not the first time this bites. Change-Id: Ief9f3bd92c83cdd1f31c51c700f42e146916eefd Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/corelib/tools/qstringview.h')
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/tools/qstringview.h b/src/corelib/tools/qstringview.h
index 0cfa9e1133..f3f3f52e08 100644
--- a/src/corelib/tools/qstringview.h
+++ b/src/corelib/tools/qstringview.h
@@ -218,6 +218,10 @@ public:
// QString API
+ QByteArray toLatin1() const Q_REQUIRED_RESULT { return qConvertToLatin1(*this); }
+ QByteArray toUtf8() const Q_REQUIRED_RESULT { return qConvertToUtf8(*this); }
+ QByteArray toLocal8Bit() const Q_REQUIRED_RESULT { return qConvertToLocal8Bit(*this); }
+ inline QVector<uint> toUcs4() const Q_REQUIRED_RESULT;
Q_DECL_CONSTEXPR QChar at(qssize_t n) const { return (*this)[n]; }