diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-01-20 16:07:43 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-07 04:47:04 +0100 |
commit | b2d5e7805abe569a926eb087a75bd903261b734f (patch) | |
tree | 81e381610473c9bcf15360ce8b28f30942442a66 /src/corelib | |
parent | f640d3f132457b68509ae94c17dcece0b0a3153f (diff) |
Add QString::fromUtf16 with char16_t and fromUcs4 with char32_t
Because they make sense. I'm even thinking that the char16_t version
should get a QString implicit constructor. Maybe both encodings.
Change-Id: Ifffc61dd890795fbbbd5f7cb5efb3e6287d1270e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qstring.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 4432759b03..40baca20a6 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -505,6 +505,13 @@ public: static QString fromUcs4(const uint *, int size = -1); static QString fromRawData(const QChar *, int size); +#if defined(Q_COMPILER_UNICODE_STRINGS) + static QString fromUtf16(const char16_t *str, int size = -1) + { return fromUtf16(reinterpret_cast<const ushort *>(str), size); } + static QString fromUcs4(const char32_t *str, int size = -1) + { return fromUcs4(reinterpret_cast<const uint *>(str), size); } +#endif + #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED static inline QString fromAscii(const char *str, int size = -1) { return fromLatin1(str, size); } |