From be3fbd804579770db0303e6f2ba5a08d5b4fb3b1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 10 Dec 2022 00:06:09 +0100 Subject: QXmlStreamWriter: remove unneeded QStringView::toString() calls Now that QXmlStreamWriter's APIs take QAnyStringView, there's no need to convert the QStringViews we get from e.g. QXmlStreamReader APIs to QString first. Task-number: QTBUG-103302 Change-Id: Iab33dbfb5da7b3501cae0d0ab7f7ecdb61cca784 Reviewed-by: Mate Barany Reviewed-by: Fabian Kosmale --- src/corelib/serialization/qxmlstream.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/corelib/serialization/qxmlstream.cpp') diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index 8150a0e0a6e..0aeef451bdd 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -3314,12 +3314,9 @@ void QXmlStreamWriter::writeAttribute(QAnyStringView namespaceUri, QAnyStringVie void QXmlStreamWriter::writeAttribute(const QXmlStreamAttribute& attribute) { if (attribute.namespaceUri().isEmpty()) - writeAttribute(attribute.qualifiedName().toString(), - attribute.value().toString()); + writeAttribute(attribute.qualifiedName(), attribute.value()); else - writeAttribute(attribute.namespaceUri().toString(), - attribute.name().toString(), - attribute.value().toString()); + writeAttribute(attribute.namespaceUri(), attribute.name(), attribute.value()); } @@ -3786,11 +3783,11 @@ void QXmlStreamWriter::writeCurrentToken(const QXmlStreamReader &reader) writeEndDocument(); break; case QXmlStreamReader::StartElement: { - writeStartElement(reader.namespaceUri().toString(), reader.name().toString()); + writeStartElement(reader.namespaceUri(), reader.name()); const QXmlStreamNamespaceDeclarations decls = reader.namespaceDeclarations(); for (const auto &namespaceDeclaration : decls) { - writeNamespace(namespaceDeclaration.namespaceUri().toString(), - namespaceDeclaration.prefix().toString()); + writeNamespace(namespaceDeclaration.namespaceUri(), + namespaceDeclaration.prefix()); } writeAttributes(reader.attributes()); } break; @@ -3799,22 +3796,22 @@ void QXmlStreamWriter::writeCurrentToken(const QXmlStreamReader &reader) break; case QXmlStreamReader::Characters: if (reader.isCDATA()) - writeCDATA(reader.text().toString()); + writeCDATA(reader.text()); else - writeCharacters(reader.text().toString()); + writeCharacters(reader.text()); break; case QXmlStreamReader::Comment: - writeComment(reader.text().toString()); + writeComment(reader.text()); break; case QXmlStreamReader::DTD: - writeDTD(reader.text().toString()); + writeDTD(reader.text()); break; case QXmlStreamReader::EntityReference: - writeEntityReference(reader.name().toString()); + writeEntityReference(reader.name()); break; case QXmlStreamReader::ProcessingInstruction: - writeProcessingInstruction(reader.processingInstructionTarget().toString(), - reader.processingInstructionData().toString()); + writeProcessingInstruction(reader.processingInstructionTarget(), + reader.processingInstructionData()); break; default: Q_ASSERT(reader.tokenType() != QXmlStreamReader::Invalid); -- cgit v1.2.3