From 5dc1e08c8c602738f6a827cea0de44683c7bbd0b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 5 Apr 2017 00:07:09 +0200 Subject: 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 --- src/corelib/tools/qstringview.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib/tools/qstringview.h') 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 toUcs4() const Q_REQUIRED_RESULT; Q_DECL_CONSTEXPR QChar at(qssize_t n) const { return (*this)[n]; } -- cgit v1.2.3