From 23d2d57d922dbb6e2b9e03ec27c7de254e4920aa Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Wed, 22 Jun 2022 16:51:10 +0200 Subject: QDom: Use the default for assignment operators in QDom* classes These classes are all derived from QDomNode, and their assignment operators are directly or indirectly calling the ones from QDomNode by explicitly converting to it. We can just use the default assignment operators instead. Change-Id: I1e3d4eef2188d124e5d54a909eb18bb93ddaa110 Pick-to: 6.4 Reviewed-by: Thiago Macieira --- src/xml/dom/qdom.cpp | 67 +++++++++++----------------------------------------- 1 file changed, 14 insertions(+), 53 deletions(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 2db31e4646..b54590a2f8 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -3139,11 +3139,7 @@ QDomDocumentType::QDomDocumentType(QDomDocumentTypePrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocumentType& QDomDocumentType::operator= (const QDomDocumentType& n) -{ - return static_cast(QDomNode::operator=(n)); -} - +QDomDocumentType &QDomDocumentType::operator=(const QDomDocumentType &n) = default; /*! Returns the name of the document type as specified in the <!DOCTYPE name> tag. @@ -3319,10 +3315,7 @@ QDomDocumentFragment::QDomDocumentFragment(const QDomDocumentFragment& x) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocumentFragment& QDomDocumentFragment::operator= (const QDomDocumentFragment& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomDocumentFragment &QDomDocumentFragment::operator=(const QDomDocumentFragment &x) = default; /*! \fn QDomNode::NodeType QDomDocumentFragment::nodeType() const @@ -3453,10 +3446,7 @@ QDomCharacterData::QDomCharacterData(QDomCharacterDataPrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomCharacterData& QDomCharacterData::operator= (const QDomCharacterData& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomCharacterData &QDomCharacterData::operator=(const QDomCharacterData &x) = default; /*! Returns the string stored in this object. @@ -3762,10 +3752,7 @@ QDomAttr::QDomAttr(QDomAttrPrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomAttr& QDomAttr::operator= (const QDomAttr& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomAttr &QDomAttr::operator=(const QDomAttr &x) = default; /*! Returns the attribute's name. @@ -4185,10 +4172,7 @@ QDomElement::QDomElement(QDomElementPrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomElement& QDomElement::operator= (const QDomElement& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomElement &QDomElement::operator=(const QDomElement &x) = default; /*! \fn QDomNode::NodeType QDomElement::nodeType() const @@ -4705,10 +4689,7 @@ QDomText::QDomText(QDomTextPrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomText& QDomText::operator= (const QDomText& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomText &QDomText::operator=(const QDomText &x) = default; /*! \fn QDomNode::NodeType QDomText::nodeType() const @@ -4836,10 +4817,7 @@ QDomComment::QDomComment(QDomCommentPrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomComment& QDomComment::operator= (const QDomComment& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomComment &QDomComment::operator=(const QDomComment &x) = default; /*! \fn QDomNode::NodeType QDomComment::nodeType() const @@ -4944,10 +4922,7 @@ QDomCDATASection::QDomCDATASection(QDomCDATASectionPrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomCDATASection& QDomCDATASection::operator= (const QDomCDATASection& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomCDATASection &QDomCDATASection::operator=(const QDomCDATASection &x) = default; /*! \fn QDomNode::NodeType QDomCDATASection::nodeType() const @@ -5068,10 +5043,7 @@ QDomNotation::QDomNotation(QDomNotationPrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomNotation& QDomNotation::operator= (const QDomNotation& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomNotation &QDomNotation::operator=(const QDomNotation &x) = default; /*! \fn QDomNode::NodeType QDomNotation::nodeType() const @@ -5265,10 +5237,7 @@ QDomEntity::QDomEntity(QDomEntityPrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomEntity& QDomEntity::operator= (const QDomEntity& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomEntity &QDomEntity::operator=(const QDomEntity &x) = default; /*! \fn QDomNode::NodeType QDomEntity::nodeType() const @@ -5417,10 +5386,7 @@ QDomEntityReference::QDomEntityReference(QDomEntityReferencePrivate* n) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomEntityReference& QDomEntityReference::operator= (const QDomEntityReference& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomEntityReference &QDomEntityReference::operator=(const QDomEntityReference &x) = default; /*! \fn QDomNode::NodeType QDomEntityReference::nodeType() const @@ -5534,10 +5500,8 @@ QDomProcessingInstruction::QDomProcessingInstruction(QDomProcessingInstructionPr will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomProcessingInstruction& QDomProcessingInstruction::operator= (const QDomProcessingInstruction& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomProcessingInstruction & +QDomProcessingInstruction::operator=(const QDomProcessingInstruction &x) = default; /*! \fn QDomNode::NodeType QDomProcessingInstruction::nodeType() const @@ -6065,10 +6029,7 @@ QDomDocument::QDomDocument(QDomDocumentPrivate* x) will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocument& QDomDocument::operator= (const QDomDocument& x) -{ - return static_cast(QDomNode::operator=(x)); -} +QDomDocument &QDomDocument::operator=(const QDomDocument &x) = default; /*! Destroys the object and frees its resources. -- cgit v1.2.3