summaryrefslogtreecommitdiffstats
path: root/src/corelib/compat/removed_api.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-12-08 19:20:48 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-12-10 01:00:23 +0100
commitbbb01309b443054724713c2d72826535edc554d5 (patch)
tree8d25c12358f76a5c3359c95740d486a2388f65f7 /src/corelib/compat/removed_api.cpp
parent9addd9a89d30135d8b917fe9e8d80212e48cf287 (diff)
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 <fabian.kosmale@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Diffstat (limited to 'src/corelib/compat/removed_api.cpp')
-rw-r--r--src/corelib/compat/removed_api.cpp11
1 files changed, 11 insertions, 0 deletions
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"