QStringDecoder: add a char16_t overload of appendToBuffer(QChar*, ~~~)
More and more code in Qt uses char16_t instead of QChar, even QString::Data, so reduce the impedance mismatch with such code and supply a char16_t overload in parallel to the existing QChar* one. [ChangeLog][QtCore][QStringDecoder] Added appendToBuffer() overload for char16_t*, complementing the existing overload taking QChar*. Task-number: QTBUG-106198 Change-Id: I0cb8ab22c897c14b1318a676f5212cc0cf1b72b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
f9fe333018
commit
ef1be84551
@ -2374,4 +2374,10 @@ const char *QStringConverter::nameForEncoding(QStringConverter::Encoding e)
|
||||
\sa requiredSpace
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn char16_t *QStringDecoder::appendToBuffer(char16_t *out, QByteArrayView in)
|
||||
\since 6.6
|
||||
\overload
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -140,6 +140,8 @@ public:
|
||||
}
|
||||
return iface->toUtf16(out, ba, &state);
|
||||
}
|
||||
char16_t *appendToBuffer(char16_t *out, QByteArrayView ba)
|
||||
{ return reinterpret_cast<char16_t *>(appendToBuffer(reinterpret_cast<QChar *>(out), ba)); }
|
||||
|
||||
Q_CORE_EXPORT static QStringDecoder decoderForHtml(QByteArrayView data);
|
||||
|
||||
|
@ -252,8 +252,8 @@ void tst_QStringConverter::invalidConverter()
|
||||
|
||||
decoder.resetState();
|
||||
QVERIFY(!decoder.hasError());
|
||||
QChar buffer[100];
|
||||
QChar *position = decoder.appendToBuffer(buffer, "Even more");
|
||||
char16_t buffer[100];
|
||||
char16_t *position = decoder.appendToBuffer(buffer, "Even more");
|
||||
QCOMPARE(position, buffer);
|
||||
QVERIFY(decoder.hasError());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user