From bbb01309b443054724713c2d72826535edc554d5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 8 Dec 2022 19:20:48 +0100 Subject: QXmlStreamWriter: prepare for port to QAnyStringView The UTF-8 support in Qt is still lacking, so QUtf8StringView doesn't, yet, have the likes of contains(), endsWith(), etc that the existing QString code uses in Q_ASSERTs. Provide free functions that work for UTF-8 haystacks and ASCII needles by falling back to QByteArrayView or QLatin1StringView. Also break a replace() use into a series of indexOf() + chunked write(). This is rather expensive for QString, so port the writeCDATA() function that uses this to QAnyStringView already, ahead of the bulk of the changes in Mate's follow-up patch. Task-number: QTBUG-103302 Change-Id: Ic66261740817ede2600b78a383cf667a31df7bfc Reviewed-by: Fabian Kosmale Reviewed-by: Marc Mutz Reviewed-by: Ivan Solovev Reviewed-by: Tatiana Borisova --- src/corelib/compat/removed_api.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/corelib/compat') diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index aad7b58b36..62dc063072 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -368,6 +368,17 @@ void QXmlStreamReader::addData(const char *data) #endif // QT_CONFIG(xmlstreamreader) +#if QT_CONFIG(xmlstreamwriter) + +#include "qxmlstream.h" + +void QXmlStreamWriter::writeCDATA(const QString &text) +{ + writeCDATA(qToAnyStringViewIgnoringNull(text)); +} + +#endif // QT_CONFIG(xmlstreamwriter) + // inlined API #include "qfloat16.h" #include "qstring.h" -- cgit v1.2.3