diff options
| author | Marc Mutz <marc.mutz@kdab.com> | 2020-04-29 11:36:19 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@kdab.com> | 2020-05-09 06:26:08 +0000 |
| commit | 928d57d8da5e89d2dd7fb3be8c992422538f47d0 (patch) | |
| tree | 0915a02f6788300fd2d4d41bf1433ce7836021f8 /src/corelib/codecs/qtextcodec.cpp | |
| parent | 19e7c0d2b5a807e194be1d65b16041f48136c9be (diff) | |
QChar: add fromUcs{2,4}()
The fromUcs2() named ctor is designed to replace all the non-char
integral-type constructors of QChar which make it very hard to control
the implicit QChar conversions, which have caused a few bugs in Qt
itself. As a classical named contructor, it simply returns QChar.
The fromUcs4() named "ctor", however, needs to expand surrogate pairs,
and thus can't just return QChar. Instead, it returns a small struct
that contains one or two char16_t's, can be iterated over and be
implicitly converted to QStringView. To avoid bikeshedding the name
(FromUcs4Result, of course :), it's defined inline and thus can't be
named outside the function. This function replaces most uses of
QChar::requiresSurrogates() in QtBase.
[ChangeLog][QtCore][QChar] Added fromUcs2(), fromUcs4().
Change-Id: I803708c14001040f75cb599e33c24a3fb8d2579c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/codecs/qtextcodec.cpp')
0 files changed, 0 insertions, 0 deletions
