diff options
Diffstat (limited to 'src/xml/dom/qdom.cpp')
-rw-r--r-- | src/xml/dom/qdom.cpp | 358 |
1 files changed, 180 insertions, 178 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index d63526ad01..b25cdf487f 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -47,7 +47,7 @@ using namespace Qt::StringLiterals; /* ##### new TODOs: - Remove empty emthods in the *Private classes + Remove empty methods in the *Private classes Make a lot of the (mostly empty) methods in the public classes inline. Specially constructors assignment operators and comparison operators are candidates. @@ -374,52 +374,52 @@ QDomImplementation::QDomImplementation() } /*! - Constructs a copy of \a x. + Constructs a copy of \a implementation. */ -QDomImplementation::QDomImplementation(const QDomImplementation &x) +QDomImplementation::QDomImplementation(const QDomImplementation &implementation) + : impl(implementation.impl) { - impl = x.impl; if (impl) impl->ref.ref(); } -QDomImplementation::QDomImplementation(QDomImplementationPrivate *p) +QDomImplementation::QDomImplementation(QDomImplementationPrivate *pimpl) + : impl(pimpl) { // We want to be co-owners, so increase the reference count - impl = p; if (impl) impl->ref.ref(); } /*! - Assigns \a x to this DOM implementation. + Assigns \a other to this DOM implementation. */ -QDomImplementation& QDomImplementation::operator=(const QDomImplementation &x) +QDomImplementation& QDomImplementation::operator=(const QDomImplementation &other) { - if (x.impl) - x.impl->ref.ref(); + if (other.impl) + other.impl->ref.ref(); if (impl && !impl->ref.deref()) delete impl; - impl = x.impl; + impl = other.impl; return *this; } /*! - Returns \c true if \a x and this DOM implementation object were + Returns \c true if \a other and this DOM implementation object were created from the same QDomDocument; otherwise returns \c false. */ -bool QDomImplementation::operator==(const QDomImplementation &x) const +bool QDomImplementation::operator==(const QDomImplementation &other) const { - return (impl == x.impl); + return impl == other.impl; } /*! - Returns \c true if \a x and this DOM implementation object were + Returns \c true if \a other and this DOM implementation object were created from different QDomDocuments; otherwise returns \c false. */ -bool QDomImplementation::operator!=(const QDomImplementation &x) const +bool QDomImplementation::operator!=(const QDomImplementation &other) const { - return (impl != x.impl); + return !operator==(other); } /*! @@ -646,10 +646,10 @@ bool QDomNodeListPrivate::operator==(const QDomNodeListPrivate &other) const bool QDomNodeListPrivate::operator!=(const QDomNodeListPrivate &other) const { - return (node_impl != other.node_impl) || (tagname != other.tagname); + return !operator==(other); } -void QDomNodeListPrivate::createList() +void QDomNodeListPrivate::createList() const { if (!node_impl) return; @@ -703,16 +703,21 @@ void QDomNodeListPrivate::createList() } } -QDomNodePrivate* QDomNodeListPrivate::item(int index) +bool QDomNodeListPrivate::maybeCreateList() const { if (!node_impl) - return nullptr; + return false; const QDomDocumentPrivate *const doc = node_impl->ownerDocument(); if (!doc || timestamp != doc->nodeListTime) createList(); - if (index >= list.size()) + return true; +} + +QDomNodePrivate *QDomNodeListPrivate::item(int index) +{ + if (!maybeCreateList() || index >= list.size() || index < 0) return nullptr; return list.at(index); @@ -720,15 +725,9 @@ QDomNodePrivate* QDomNodeListPrivate::item(int index) int QDomNodeListPrivate::length() const { - if (!node_impl) + if (!maybeCreateList()) return 0; - const QDomDocumentPrivate *const doc = node_impl->ownerDocument(); - if (!doc || timestamp != doc->nodeListTime) { - QDomNodeListPrivate *that = const_cast<QDomNodeListPrivate *>(this); - that->createList(); - } - return list.size(); } @@ -771,54 +770,54 @@ QDomNodeList::QDomNodeList() { } -QDomNodeList::QDomNodeList(QDomNodeListPrivate* p) - : impl(p) +QDomNodeList::QDomNodeList(QDomNodeListPrivate *pimpl) + : impl(pimpl) { } /*! - Constructs a copy of \a n. + Constructs a copy of \a nodeList. */ -QDomNodeList::QDomNodeList(const QDomNodeList& n) +QDomNodeList::QDomNodeList(const QDomNodeList &nodeList) + : impl(nodeList.impl) { - impl = n.impl; if (impl) impl->ref.ref(); } /*! - Assigns \a n to this node list. + Assigns \a other to this node list. */ -QDomNodeList& QDomNodeList::operator=(const QDomNodeList &n) +QDomNodeList& QDomNodeList::operator=(const QDomNodeList &other) { - if (n.impl) - n.impl->ref.ref(); + if (other.impl) + other.impl->ref.ref(); if (impl && !impl->ref.deref()) delete impl; - impl = n.impl; + impl = other.impl; return *this; } /*! - Returns \c true if the node list \a n and this node list are equal; + Returns \c true if the node list \a other and this node list are equal; otherwise returns \c false. */ -bool QDomNodeList::operator==(const QDomNodeList &n) const +bool QDomNodeList::operator==(const QDomNodeList &other) const { - if (impl == n.impl) + if (impl == other.impl) return true; - if (!impl || !n.impl) + if (!impl || !other.impl) return false; - return (*impl == *n.impl); + return (*impl == *other.impl); } /*! - Returns \c true the node list \a n and this node list are not equal; + Returns \c true the node list \a other and this node list are not equal; otherwise returns \c false. */ -bool QDomNodeList::operator!=(const QDomNodeList &n) const +bool QDomNodeList::operator!=(const QDomNodeList &other) const { - return !operator==(n); + return !operator==(other); } /*! @@ -1474,48 +1473,48 @@ QDomNode::QDomNode() } /*! - Constructs a copy of \a n. + Constructs a copy of \a node. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomNode::QDomNode(const QDomNode &n) +QDomNode::QDomNode(const QDomNode &node) + : impl(node.impl) { - impl = n.impl; if (impl) impl->ref.ref(); } /*! \internal - Constructs a new node for the data \a n. + Constructs a new node for the data \a pimpl. */ -QDomNode::QDomNode(QDomNodePrivate *n) +QDomNode::QDomNode(QDomNodePrivate *pimpl) + : impl(pimpl) { - impl = n; if (impl) impl->ref.ref(); } /*! - Assigns a copy of \a n to this DOM node. + Assigns a copy of \a other to this DOM node. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomNode& QDomNode::operator=(const QDomNode &n) +QDomNode& QDomNode::operator=(const QDomNode &other) { - if (n.impl) - n.impl->ref.ref(); + if (other.impl) + other.impl->ref.ref(); if (impl && !impl->ref.deref()) delete impl; - impl = n.impl; + impl = other.impl; return *this; } /*! - Returns \c true if \a n and this DOM node are equal; otherwise + Returns \c true if \a other and this DOM node are equal; otherwise returns \c false. Any instance of QDomNode acts as a reference to an underlying data @@ -1534,18 +1533,18 @@ QDomNode& QDomNode::operator=(const QDomNode &n) \c {element3 == element4} will return false because they refer to two different nodes in the underlying data structure. */ -bool QDomNode::operator== (const QDomNode& n) const +bool QDomNode::operator==(const QDomNode &other) const { - return (impl == n.impl); + return impl == other.impl; } /*! - Returns \c true if \a n and this DOM node are not equal; otherwise + Returns \c true if \a other and this DOM node are not equal; otherwise returns \c false. */ -bool QDomNode::operator!= (const QDomNode& n) const +bool QDomNode::operator!=(const QDomNode &other) const { - return (impl != n.impl); + return !operator==(other); } /*! @@ -1622,15 +1621,14 @@ QString QDomNode::nodeValue() const } /*! - Sets the node's value to \a v. + Sets the node's value to \a value. \sa nodeValue() */ -void QDomNode::setNodeValue(const QString& v) +void QDomNode::setNodeValue(const QString& value) { - if (!impl) - return; - IMPL->setNodeValue(v); + if (impl) + IMPL->setNodeValue(value); } /*! @@ -2504,11 +2502,12 @@ int QDomNode::columnNumber() const * **************************************************************/ -QDomNamedNodeMapPrivate::QDomNamedNodeMapPrivate(QDomNodePrivate* n) : ref(1) +QDomNamedNodeMapPrivate::QDomNamedNodeMapPrivate(QDomNodePrivate *pimpl) + : ref(1) + , parent(pimpl) + , readonly(false) + , appendToParent(false) { - readonly = false; - parent = n; - appendToParent = false; } QDomNamedNodeMapPrivate::~QDomNamedNodeMapPrivate() @@ -2516,16 +2515,16 @@ QDomNamedNodeMapPrivate::~QDomNamedNodeMapPrivate() clearMap(); } -QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate* p) +QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate *pimpl) { - std::unique_ptr<QDomNamedNodeMapPrivate> m(new QDomNamedNodeMapPrivate(p)); + std::unique_ptr<QDomNamedNodeMapPrivate> m(new QDomNamedNodeMapPrivate(pimpl)); m->readonly = readonly; m->appendToParent = appendToParent; auto it = map.constBegin(); for (; it != map.constEnd(); ++it) { QDomNodePrivate *new_node = it.value()->cloneNode(); - new_node->setParent(p); + new_node->setParent(pimpl); m->setNamedItem(new_node); } @@ -2697,51 +2696,51 @@ QDomNamedNodeMap::QDomNamedNodeMap() } /*! - Constructs a copy of \a n. + Constructs a copy of \a namedNodeMap. */ -QDomNamedNodeMap::QDomNamedNodeMap(const QDomNamedNodeMap &n) +QDomNamedNodeMap::QDomNamedNodeMap(const QDomNamedNodeMap &namedNodeMap) + : impl(namedNodeMap.impl) { - impl = n.impl; if (impl) impl->ref.ref(); } -QDomNamedNodeMap::QDomNamedNodeMap(QDomNamedNodeMapPrivate *n) +QDomNamedNodeMap::QDomNamedNodeMap(QDomNamedNodeMapPrivate *pimpl) + : impl(pimpl) { - impl = n; if (impl) impl->ref.ref(); } /*! - Assigns \a n to this named node map. + Assigns \a other to this named node map. */ -QDomNamedNodeMap& QDomNamedNodeMap::operator=(const QDomNamedNodeMap &n) +QDomNamedNodeMap& QDomNamedNodeMap::operator=(const QDomNamedNodeMap &other) { - if (n.impl) - n.impl->ref.ref(); + if (other.impl) + other.impl->ref.ref(); if (impl && !impl->ref.deref()) delete impl; - impl = n.impl; + impl = other.impl; return *this; } /*! - Returns \c true if \a n and this named node map are equal; otherwise + Returns \c true if \a other and this named node map are equal; otherwise returns \c false. */ -bool QDomNamedNodeMap::operator== (const QDomNamedNodeMap& n) const +bool QDomNamedNodeMap::operator==(const QDomNamedNodeMap &other) const { - return (impl == n.impl); + return impl == other.impl; } /*! - Returns \c true if \a n and this named node map are not equal; + Returns \c true if \a other and this named node map are not equal; otherwise returns \c false. */ -bool QDomNamedNodeMap::operator!= (const QDomNamedNodeMap& n) const +bool QDomNamedNodeMap::operator!=(const QDomNamedNodeMap &other) const { - return (impl != n.impl); + return !operator==(other); } /*! @@ -3117,30 +3116,30 @@ QDomDocumentType::QDomDocumentType() : QDomNode() } /*! - Constructs a copy of \a n. + Constructs a copy of \a documentType. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocumentType::QDomDocumentType(const QDomDocumentType& n) - : QDomNode(n) +QDomDocumentType::QDomDocumentType(const QDomDocumentType &documentType) + : QDomNode(documentType) { } -QDomDocumentType::QDomDocumentType(QDomDocumentTypePrivate* n) - : QDomNode(n) +QDomDocumentType::QDomDocumentType(QDomDocumentTypePrivate *pimpl) + : QDomNode(pimpl) { } /*! - Assigns \a n to this document type. + Assigns \a other to this document type. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocumentType &QDomDocumentType::operator=(const QDomDocumentType &n) = default; +QDomDocumentType &QDomDocumentType::operator=(const QDomDocumentType &other) = default; /*! Returns the name of the document type as specified in the <!DOCTYPE name> tag. @@ -3298,25 +3297,25 @@ QDomDocumentFragment::QDomDocumentFragment(QDomDocumentFragmentPrivate* n) } /*! - Constructs a copy of \a x. + Constructs a copy of \a documentFragment. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocumentFragment::QDomDocumentFragment(const QDomDocumentFragment& x) - : QDomNode(x) +QDomDocumentFragment::QDomDocumentFragment(const QDomDocumentFragment &documentFragment) + : QDomNode(documentFragment) { } /*! - Assigns \a x to this DOM document fragment. + Assigns \a other to this DOM document fragment. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocumentFragment &QDomDocumentFragment::operator=(const QDomDocumentFragment &x) = default; +QDomDocumentFragment &QDomDocumentFragment::operator=(const QDomDocumentFragment &other) = default; /*! \fn QDomNode::NodeType QDomDocumentFragment::nodeType() const @@ -3424,14 +3423,14 @@ QDomCharacterData::QDomCharacterData() } /*! - Constructs a copy of \a x. + Constructs a copy of \a characterData. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomCharacterData::QDomCharacterData(const QDomCharacterData& x) - : QDomNode(x) +QDomCharacterData::QDomCharacterData(const QDomCharacterData &characterData) + : QDomNode(characterData) { } @@ -3441,13 +3440,13 @@ QDomCharacterData::QDomCharacterData(QDomCharacterDataPrivate* n) } /*! - Assigns \a x to this character data. + Assigns \a other to this character data. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomCharacterData &QDomCharacterData::operator=(const QDomCharacterData &x) = default; +QDomCharacterData &QDomCharacterData::operator=(const QDomCharacterData &other) = default; /*! Returns the string stored in this object. @@ -3463,12 +3462,12 @@ QString QDomCharacterData::data() const } /*! - Sets this object's string to \a v. + Sets this object's string to \a data. */ -void QDomCharacterData::setData(const QString& v) +void QDomCharacterData::setData(const QString &data) { if (impl) - impl->setNodeValue(v); + impl->setNodeValue(data); } /*! @@ -3730,14 +3729,14 @@ QDomAttr::QDomAttr() } /*! - Constructs a copy of \a x. + Constructs a copy of \a attr. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomAttr::QDomAttr(const QDomAttr& x) - : QDomNode(x) +QDomAttr::QDomAttr(const QDomAttr &attr) + : QDomNode(attr) { } @@ -3747,13 +3746,13 @@ QDomAttr::QDomAttr(QDomAttrPrivate* n) } /*! - Assigns \a x to this DOM attribute. + Assigns \a other to this DOM attribute. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomAttr &QDomAttr::operator=(const QDomAttr &x) = default; +QDomAttr &QDomAttr::operator=(const QDomAttr &other) = default; /*! Returns the attribute's name. @@ -3805,15 +3804,15 @@ QString QDomAttr::value() const } /*! - Sets the attribute's value to \a v. + Sets the attribute's value to \a value. \sa value() */ -void QDomAttr::setValue(const QString& v) +void QDomAttr::setValue(const QString &value) { if (!impl) return; - impl->setNodeValue(v); + impl->setNodeValue(value); IMPL->m_specified = true; } @@ -4201,14 +4200,14 @@ QDomElement::QDomElement() } /*! - Constructs a copy of \a x. + Constructs a copy of \a element. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomElement::QDomElement(const QDomElement& x) - : QDomNode(x) +QDomElement::QDomElement(const QDomElement &element) + : QDomNode(element) { } @@ -4218,13 +4217,13 @@ QDomElement::QDomElement(QDomElementPrivate* n) } /*! - Assigns \a x to this DOM element. + Assigns \a other to this DOM element. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomElement &QDomElement::operator=(const QDomElement &x) = default; +QDomElement &QDomElement::operator=(const QDomElement &other) = default; /*! \fn QDomNode::NodeType QDomElement::nodeType() const @@ -4671,6 +4670,10 @@ QDomTextPrivate* QDomTextPrivate::splitText(int offset) value.truncate(offset); parent()->insertAfter(t, this); + Q_ASSERT(t->ref.loadRelaxed() == 2); + + // We are not interested in this node + t->ref.deref(); return t; } @@ -4718,14 +4721,14 @@ QDomText::QDomText() } /*! - Constructs a copy of \a x. + Constructs a copy of \a text. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomText::QDomText(const QDomText& x) - : QDomCharacterData(x) +QDomText::QDomText(const QDomText &text) + : QDomCharacterData(text) { } @@ -4735,13 +4738,13 @@ QDomText::QDomText(QDomTextPrivate* n) } /*! - Assigns \a x to this DOM text. + Assigns \a other to this DOM text. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomText &QDomText::operator=(const QDomText &x) = default; +QDomText &QDomText::operator=(const QDomText &other) = default; /*! \fn QDomNode::NodeType QDomText::nodeType() const @@ -4846,14 +4849,14 @@ QDomComment::QDomComment() } /*! - Constructs a copy of \a x. + Constructs a copy of \a comment. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomComment::QDomComment(const QDomComment& x) - : QDomCharacterData(x) +QDomComment::QDomComment(const QDomComment &comment) + : QDomCharacterData(comment) { } @@ -4863,13 +4866,13 @@ QDomComment::QDomComment(QDomCommentPrivate* n) } /*! - Assigns \a x to this DOM comment. + Assigns \a other to this DOM comment. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomComment &QDomComment::operator=(const QDomComment &x) = default; +QDomComment &QDomComment::operator=(const QDomComment &other) = default; /*! \fn QDomNode::NodeType QDomComment::nodeType() const @@ -4951,14 +4954,14 @@ QDomCDATASection::QDomCDATASection() } /*! - Constructs a copy of \a x. + Constructs a copy of \a cdataSection. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomCDATASection::QDomCDATASection(const QDomCDATASection& x) - : QDomText(x) +QDomCDATASection::QDomCDATASection(const QDomCDATASection &cdataSection) + : QDomText(cdataSection) { } @@ -4968,13 +4971,13 @@ QDomCDATASection::QDomCDATASection(QDomCDATASectionPrivate* n) } /*! - Assigns \a x to this CDATA section. + Assigns \a other to this CDATA section. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomCDATASection &QDomCDATASection::operator=(const QDomCDATASection &x) = default; +QDomCDATASection &QDomCDATASection::operator=(const QDomCDATASection &other) = default; /*! \fn QDomNode::NodeType QDomCDATASection::nodeType() const @@ -5072,14 +5075,14 @@ QDomNotation::QDomNotation() } /*! - Constructs a copy of \a x. + Constructs a copy of \a notation. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomNotation::QDomNotation(const QDomNotation& x) - : QDomNode(x) +QDomNotation::QDomNotation(const QDomNotation ¬ation) + : QDomNode(notation) { } @@ -5089,13 +5092,13 @@ QDomNotation::QDomNotation(QDomNotationPrivate* n) } /*! - Assigns \a x to this DOM notation. + Assigns \a other to this DOM notation. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomNotation &QDomNotation::operator=(const QDomNotation &x) = default; +QDomNotation &QDomNotation::operator=(const QDomNotation &other) = default; /*! \fn QDomNode::NodeType QDomNotation::nodeType() const @@ -5266,14 +5269,14 @@ QDomEntity::QDomEntity() /*! - Constructs a copy of \a x. + Constructs a copy of \a entity. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomEntity::QDomEntity(const QDomEntity& x) - : QDomNode(x) +QDomEntity::QDomEntity(const QDomEntity &entity) + : QDomNode(entity) { } @@ -5283,13 +5286,13 @@ QDomEntity::QDomEntity(QDomEntityPrivate* n) } /*! - Assigns \a x to this DOM entity. + Assigns \a other to this DOM entity. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomEntity &QDomEntity::operator=(const QDomEntity &x) = default; +QDomEntity &QDomEntity::operator=(const QDomEntity &other) = default; /*! \fn QDomNode::NodeType QDomEntity::nodeType() const @@ -5415,14 +5418,14 @@ QDomEntityReference::QDomEntityReference() } /*! - Constructs a copy of \a x. + Constructs a copy of \a entityReference. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomEntityReference::QDomEntityReference(const QDomEntityReference& x) - : QDomNode(x) +QDomEntityReference::QDomEntityReference(const QDomEntityReference &entityReference) + : QDomNode(entityReference) { } @@ -5432,13 +5435,13 @@ QDomEntityReference::QDomEntityReference(QDomEntityReferencePrivate* n) } /*! - Assigns \a x to this entity reference. + Assigns \a other to this entity reference. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomEntityReference &QDomEntityReference::operator=(const QDomEntityReference &x) = default; +QDomEntityReference &QDomEntityReference::operator=(const QDomEntityReference &other) = default; /*! \fn QDomNode::NodeType QDomEntityReference::nodeType() const @@ -5529,14 +5532,14 @@ QDomProcessingInstruction::QDomProcessingInstruction() } /*! - Constructs a copy of \a x. + Constructs a copy of \a processingInstruction. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomProcessingInstruction::QDomProcessingInstruction(const QDomProcessingInstruction& x) - : QDomNode(x) +QDomProcessingInstruction::QDomProcessingInstruction(const QDomProcessingInstruction &processingInstruction) + : QDomNode(processingInstruction) { } @@ -5546,14 +5549,14 @@ QDomProcessingInstruction::QDomProcessingInstruction(QDomProcessingInstructionPr } /*! - Assigns \a x to this processing instruction. + Assigns \a other to this processing instruction. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ QDomProcessingInstruction & -QDomProcessingInstruction::operator=(const QDomProcessingInstruction &x) = default; +QDomProcessingInstruction::operator=(const QDomProcessingInstruction &other) = default; /*! \fn QDomNode::NodeType QDomProcessingInstruction::nodeType() const @@ -5586,15 +5589,14 @@ QString QDomProcessingInstruction::data() const } /*! - Sets the data contained in the processing instruction to \a d. + Sets the data contained in the processing instruction to \a data. \sa data() */ -void QDomProcessingInstruction::setData(const QString& d) +void QDomProcessingInstruction::setData(const QString &data) { - if (!impl) - return; - impl->setNodeValue(d); + if (impl) + impl->setNodeValue(data); } /************************************************************** @@ -5992,8 +5994,8 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod representation of the document can be obtained using toString(). \note The DOM tree might end up reserving a lot of memory if the XML - document is big. For such documents, the QXmlStreamReader or the - QXmlQuery classes might be better solutions. + document is big. For such documents, the QXmlStreamReader class + might be a better solution. It is possible to insert a node from another document into the document using importNode(). @@ -6018,7 +6020,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core} Specifications. - \sa {DOM Bookmarks Application}, {Simple DOM Model Example} + \sa {DOM Bookmarks Application} */ /*! @@ -6050,30 +6052,30 @@ QDomDocument::QDomDocument(const QDomDocumentType& doctype) } /*! - Constructs a copy of \a x. + Constructs a copy of \a document. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocument::QDomDocument(const QDomDocument& x) - : QDomNode(x) +QDomDocument::QDomDocument(const QDomDocument &document) + : QDomNode(document) { } -QDomDocument::QDomDocument(QDomDocumentPrivate* x) - : QDomNode(x) +QDomDocument::QDomDocument(QDomDocumentPrivate *pimpl) + : QDomNode(pimpl) { } /*! - Assigns \a x to this DOM document. + Assigns \a other to this DOM document. The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode(). */ -QDomDocument &QDomDocument::operator=(const QDomDocument &x) = default; +QDomDocument &QDomDocument::operator=(const QDomDocument &other) = default; /*! Destroys the object and frees its resources. @@ -6177,7 +6179,7 @@ static inline void unpackParseResult(const QDomDocument::ParseResult &parseResul if (errorLine) *errorLine = static_cast<int>(parseResult.errorLine); if (errorColumn) - *errorColumn = static_cast<int>(parseResult.errorLine); + *errorColumn = static_cast<int>(parseResult.errorColumn); } } @@ -6336,8 +6338,8 @@ QT_WARNING_POP /*! \fn QDomDocument::ParseResult::operator bool() const - Returns \c true if an error is found by QDomDocument::setContent(); - otherwise returns \c false. + Returns \c false if any error is found by QDomDocument::setContent(); + otherwise returns \c true. \sa QDomDocument::setContent() */ |