From 1ac7b9d2a25d50b7680bd75ff68f29055b196d80 Mon Sep 17 00:00:00 2001 From: Jonah BrĂ¼chert Date: Sun, 22 Mar 2020 22:24:26 +0100 Subject: base: Convert to QStringLiteral Two new macros were added: * QBL (short alias for QByteArrayLiteral) * QSL (short alias for QStringLiteral) --- src/base/QXmppRegisterIq.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/base/QXmppRegisterIq.cpp') diff --git a/src/base/QXmppRegisterIq.cpp b/src/base/QXmppRegisterIq.cpp index 330a013d..17e3197a 100644 --- a/src/base/QXmppRegisterIq.cpp +++ b/src/base/QXmppRegisterIq.cpp @@ -30,8 +30,8 @@ #include #include -#define ELEMENT_REGISTERED QStringLiteral("registered") -#define ELEMENT_REMOVE QStringLiteral("remove") +#define ELEMENT_REGISTERED QSL("registered") +#define ELEMENT_REMOVE QSL("remove") class QXmppRegisterIqPrivate : public QSharedData { @@ -260,17 +260,17 @@ void QXmppRegisterIq::setBitsOfBinaryData(const QXmppBitsOfBinaryDataList &bitsO /// \cond bool QXmppRegisterIq::isRegisterIq(const QDomElement &element) { - return (element.firstChildElement("query").namespaceURI() == ns_register); + return (element.firstChildElement(QSL("query")).namespaceURI() == ns_register); } void QXmppRegisterIq::parseElementFromChild(const QDomElement &element) { - QDomElement queryElement = element.firstChildElement("query"); - d->instructions = queryElement.firstChildElement("instructions").text(); - d->username = queryElement.firstChildElement("username").text(); - d->password = queryElement.firstChildElement("password").text(); - d->email = queryElement.firstChildElement("email").text(); - d->form.parse(queryElement.firstChildElement("x")); + QDomElement queryElement = element.firstChildElement(QSL("query")); + d->instructions = queryElement.firstChildElement(QSL("instructions")).text(); + d->username = queryElement.firstChildElement(QSL("username")).text(); + d->password = queryElement.firstChildElement(QSL("password")).text(); + d->email = queryElement.firstChildElement(QSL("email")).text(); + d->form.parse(queryElement.firstChildElement(QSL("x"))); d->isRegistered = !queryElement.firstChildElement(ELEMENT_REGISTERED).isNull(); d->isRemove = !queryElement.firstChildElement(ELEMENT_REMOVE).isNull(); d->bitsOfBinaryData.parse(queryElement); @@ -278,11 +278,11 @@ void QXmppRegisterIq::parseElementFromChild(const QDomElement &element) void QXmppRegisterIq::toXmlElementFromChild(QXmlStreamWriter *writer) const { - writer->writeStartElement("query"); + writer->writeStartElement(QSL("query")); writer->writeDefaultNamespace(ns_register); if (!d->instructions.isEmpty()) - writer->writeTextElement("instructions", d->instructions); + writer->writeTextElement(QSL("instructions"), d->instructions); if (d->isRegistered) writer->writeEmptyElement(ELEMENT_REGISTERED); @@ -290,19 +290,19 @@ void QXmppRegisterIq::toXmlElementFromChild(QXmlStreamWriter *writer) const writer->writeEmptyElement(ELEMENT_REMOVE); if (!d->username.isEmpty()) - writer->writeTextElement("username", d->username); + writer->writeTextElement(QSL("username"), d->username); else if (!d->username.isNull()) - writer->writeEmptyElement("username"); + writer->writeEmptyElement(QSL("username")); if (!d->password.isEmpty()) - writer->writeTextElement("password", d->password); + writer->writeTextElement(QSL("password"), d->password); else if (!d->password.isNull()) - writer->writeEmptyElement("password"); + writer->writeEmptyElement(QSL("password")); if (!d->email.isEmpty()) - writer->writeTextElement("email", d->email); + writer->writeTextElement(QSL("email"), d->email); else if (!d->email.isNull()) - writer->writeEmptyElement("email"); + writer->writeEmptyElement(QSL("email")); d->form.toXml(writer); d->bitsOfBinaryData.toXml(writer); -- cgit v1.2.3