diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-13 13:17:07 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-01-08 12:40:53 +0100 |
commit | c9c598d4d76b703f84ace9d2d06b099e8bcf2b07 (patch) | |
tree | dbcede05d0e5de052f74bb8490f41226893c2c41 /src/corelib/text/qstring.h | |
parent | d3399092dbe32f3b1a21fd2c13b2e530b4c9b1f6 (diff) |
Mark places where we missed conversion to unicode character types
We should use char32_t for the toUcs4() methods of QString and
QStringView and use char16_t for QString::utf16(), thereby matching
QStringView. These naturally imply knock-on changes in various places.
Unfortunately, we didn't make those changes in Qt 6, so they'll have
to wait for Qt 7.
Change-Id: I18451d4b31b76658092e19d3fcbc8bc0fe5ce307
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/text/qstring.h')
-rw-r--r-- | src/corelib/text/qstring.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 20a9b46e4c..86f6d829d4 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -708,7 +708,7 @@ public: [[nodiscard]] QString repeated(qsizetype times) const; - const ushort *utf16() const; + const ushort *utf16() const; // ### Qt 7 char16_t #if !defined(Q_CLANG_QDOC) [[nodiscard]] QByteArray toLatin1() const & @@ -728,7 +728,7 @@ public: [[nodiscard]] QByteArray toUtf8() const; [[nodiscard]] QByteArray toLocal8Bit() const; #endif - [[nodiscard]] QList<uint> toUcs4() const; + [[nodiscard]] QList<uint> toUcs4() const; // ### Qt 7 char32_t // note - this are all inline so we can benefit from strlen() compile time optimizations static QString fromLatin1(QByteArrayView ba); @@ -775,7 +775,7 @@ public: QString &setRawData(const QChar *unicode, qsizetype size); QString &setUnicode(const QChar *unicode, qsizetype size); - inline QString &setUtf16(const ushort *utf16, qsizetype size); + inline QString &setUtf16(const ushort *utf16, qsizetype size); // ### Qt 7 char16_t #if QT_STRINGVIEW_LEVEL < 2 int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; @@ -1089,7 +1089,7 @@ private: static QByteArray toLatin1_helper_inplace(QString &); static QByteArray toUtf8_helper(const QString &); static QByteArray toLocal8Bit_helper(const QChar *data, qsizetype size); - static qsizetype toUcs4_helper(const ushort *uc, qsizetype length, uint *out); + static qsizetype toUcs4_helper(const ushort *uc, qsizetype length, uint *out); // ### Qt 7 char16_t static qlonglong toIntegral_helper(QStringView string, bool *ok, int base); static qulonglong toIntegral_helper(QStringView string, bool *ok, uint base); void replace_helper(size_t *indices, qsizetype nIndices, qsizetype blen, const QChar *after, qsizetype alen); |