diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-05-08 23:54:50 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2020-05-13 19:26:25 +0000 |
commit | f5a56cf9bbaa05eabf2bb62ab881b9536bd554bf (patch) | |
tree | 1ccf3156f01f72bfa3485346215d3a88cf2c6754 /src/corelib/text/qstring.cpp | |
parent | 46fb39ef5ab5dff2d442ac382f0790afd265dc9d (diff) |
QString: deprecate fromUtf16(ushort*)/fromUcs4(uint*)
... in favor of existing char16_t* and char32_t* versions.
Swap the implementations around so the deprecated version is inline.
[ChangeLog][QtCore][QString] The fromUtf16(const ushort*) and
fromUcs4(const uint*) functions have been deprecated in favor of
the char16_t and char32_t versions, resp.
Change-Id: I94ff63ae98d190267da0b1c943d3d9c4e825ef10
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r-- | src/corelib/text/qstring.cpp | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 5ee4102cdb..0682395ebf 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -5448,6 +5448,7 @@ QString QString::fromUtf8_helper(const char *str, int size) } /*! + \since 5.3 Returns a QString initialized with the first \a size characters of the Unicode string \a unicode (ISO-10646-UTF-16 encoded). @@ -5463,7 +5464,7 @@ QString QString::fromUtf8_helper(const char *str, int size) \sa utf16(), setUtf16(), fromStdU16String() */ -QString QString::fromUtf16(const ushort *unicode, int size) +QString QString::fromUtf16(const char16_t *unicode, int size) { if (!unicode) return QString(); @@ -5476,39 +5477,22 @@ QString QString::fromUtf16(const ushort *unicode, int size) } /*! - \fn QString QString::fromUtf16(const char16_t *str, int size) - \since 5.3 - - Returns a QString initialized with the first \a size characters - of the Unicode string \a str (ISO-10646-UTF-16 encoded). - - If \a size is -1 (default), \a str must be \\0'-terminated. - - This function checks for a Byte Order Mark (BOM). If it is missing, - host byte order is assumed. - - This function is slow compared to the other Unicode conversions. - Use QString(const QChar *, int) or QString(const QChar *) if possible. - - QString makes a deep copy of the Unicode data. + \fn QString QString::fromUtf16(const ushort *str, int size) + \obsolete - \sa utf16(), setUtf16(), fromStdU16String() + Use the \c char16_t overload. */ /*! - \fn QString QString::fromUcs4(const char32_t *str, int size) - \since 5.3 - - Returns a QString initialized with the first \a size characters - of the Unicode string \a str (ISO-10646-UCS-4 encoded). - - If \a size is -1 (default), \a str must be \\0'-terminated. + \fn QString QString::fromUcs4(const uint *str, int size) + \since 4.2 + \obsolete - \sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String() + Use the \c char32_t overload instead. */ /*! - \since 4.2 + \since 5.3 Returns a QString initialized with the first \a size characters of the Unicode string \a unicode (ISO-10646-UCS-4 encoded). @@ -5517,7 +5501,7 @@ QString QString::fromUtf16(const ushort *unicode, int size) \sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String() */ -QString QString::fromUcs4(const uint *unicode, int size) +QString QString::fromUcs4(const char32_t *unicode, int size) { if (!unicode) return QString(); |