Qt 4.8
Public Functions | Public Variables | List of all members
QDomNodePrivate Class Reference
Inheritance diagram for QDomNodePrivate:
QDomAttrPrivate QDomCharacterDataPrivate QDomDocumentFragmentPrivate QDomDocumentPrivate QDomDocumentTypePrivate QDomElementPrivate QDomEntityPrivate QDomEntityReferencePrivate QDomNotationPrivate QDomProcessingInstructionPrivate

Public Functions

virtual QDomNodePrivateappendChild (QDomNodePrivate *newChild)
 
virtual void clear ()
 
virtual QDomNodePrivatecloneNode (bool deep=true)
 
virtual QDomNodePrivateinsertAfter (QDomNodePrivate *newChild, QDomNodePrivate *refChild)
 
virtual QDomNodePrivateinsertBefore (QDomNodePrivate *newChild, QDomNodePrivate *refChild)
 
virtual bool isAttr () const
 
virtual bool isCDATASection () const
 
virtual bool isCharacterData () const
 
virtual bool isComment () const
 
virtual bool isDocument () const
 
virtual bool isDocumentFragment () const
 
virtual bool isDocumentType () const
 
virtual bool isElement () const
 
virtual bool isEntity () const
 
virtual bool isEntityReference () const
 
virtual bool isNotation () const
 
virtual bool isProcessingInstruction () const
 
virtual bool isText () const
 
QDomNodePrivatenamedItem (const QString &name)
 
QString nodeName () const
 
virtual QDomNode::NodeType nodeType () const
 
QString nodeValue () const
 
virtual void normalize ()
 
QDomDocumentPrivateownerDocument ()
 
QDomNodePrivateparent () const
 
 QDomNodePrivate (QDomDocumentPrivate *, QDomNodePrivate *parent=0)
 
 QDomNodePrivate (QDomNodePrivate *n, bool deep)
 
virtual QDomNodePrivateremoveChild (QDomNodePrivate *oldChild)
 
virtual QDomNodePrivatereplaceChild (QDomNodePrivate *newChild, QDomNodePrivate *oldChild)
 
virtual void save (QTextStream &, int, int) const
 
void setLocation (int lineNumber, int columnNumber)
 
virtual void setNodeValue (const QString &v)
 
void setNoParent ()
 
void setOwnerDocument (QDomDocumentPrivate *doc)
 
void setParent (QDomNodePrivate *p)
 
virtual ~QDomNodePrivate ()
 

Public Variables

int columnNumber
 
bool createdWithDom1Interface: 1
 
QDomNodePrivatefirst
 
bool hasParent: 1
 
QDomNodePrivatelast
 
int lineNumber
 
QString name
 
QString namespaceURI
 
QDomNodePrivatenext
 
QDomNodePrivateownerNode
 
QString prefix
 
QDomNodePrivateprev
 
QAtomicInt ref
 
QString value
 

Detailed Description

Definition at line 135 of file qdom.cpp.

Constructors and Destructors

◆ QDomNodePrivate() [1/2]

QDomNodePrivate::QDomNodePrivate ( QDomDocumentPrivate doc,
QDomNodePrivate parent = 0 
)

Definition at line 1482 of file qdom.cpp.

1483 {
1484  ref = 1;
1485  if (par)
1486  setParent(par);
1487  else
1488  setOwnerDocument(doc);
1489  prev = 0;
1490  next = 0;
1491  first = 0;
1492  last = 0;
1493  createdWithDom1Interface = true;
1494  lineNumber = -1;
1495  columnNumber = -1;
1496 }
QDomNodePrivate * prev
Definition: qdom.cpp:192
bool createdWithDom1Interface
Definition: qdom.cpp:202
int columnNumber
Definition: qdom.cpp:206
QAtomicInt ref
Definition: qdom.cpp:191
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * last
Definition: qdom.cpp:196
void setParent(QDomNodePrivate *p)
Definition: qdom.cpp:162
int lineNumber
Definition: qdom.cpp:205
QDomNodePrivate * first
Definition: qdom.cpp:195
void setOwnerDocument(QDomDocumentPrivate *doc)
Definition: qdom.cpp:1476

◆ QDomNodePrivate() [2/2]

QDomNodePrivate::QDomNodePrivate ( QDomNodePrivate n,
bool  deep 
)

Definition at line 1498 of file qdom.cpp.

1499 {
1500  ref = 1;
1502  prev = 0;
1503  next = 0;
1504  first = 0;
1505  last = 0;
1506 
1507  name = n->name;
1508  value = n->value;
1509  prefix = n->prefix;
1512  lineNumber = -1;
1513  columnNumber = -1;
1514 
1515  if (!deep)
1516  return;
1517 
1518  for (QDomNodePrivate* x = n->first; x; x = x->next)
1519  appendChild(x->cloneNode(true));
1520 }
QDomNodePrivate * prev
Definition: qdom.cpp:192
bool createdWithDom1Interface
Definition: qdom.cpp:202
int columnNumber
Definition: qdom.cpp:206
QString name
Definition: qdom.cpp:198
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
virtual QDomNodePrivate * appendChild(QDomNodePrivate *newChild)
Definition: qdom.cpp:1887
QAtomicInt ref
Definition: qdom.cpp:191
QString value
Definition: qdom.cpp:199
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * last
Definition: qdom.cpp:196
QString namespaceURI
Definition: qdom.cpp:201
int lineNumber
Definition: qdom.cpp:205
QDomNodePrivate * first
Definition: qdom.cpp:195
void setOwnerDocument(QDomDocumentPrivate *doc)
Definition: qdom.cpp:1476
QString prefix
Definition: qdom.cpp:200

◆ ~QDomNodePrivate()

QDomNodePrivate::~QDomNodePrivate ( )
virtual

Definition at line 1522 of file qdom.cpp.

1523 {
1524  QDomNodePrivate* p = first;
1525  QDomNodePrivate* n;
1526 
1527  while (p) {
1528  n = p->next;
1529  if (!p->ref.deref())
1530  delete p;
1531  else
1532  p->setNoParent();
1533  p = n;
1534  }
1535  first = 0;
1536  last = 0;
1537 }
void setNoParent()
Definition: qdom.cpp:164
QAtomicInt ref
Definition: qdom.cpp:191
bool deref()
Atomically decrements the value of this QAtomicInt.
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * last
Definition: qdom.cpp:196
QDomNodePrivate * first
Definition: qdom.cpp:195

Functions

◆ appendChild()

QDomNodePrivate * QDomNodePrivate::appendChild ( QDomNodePrivate newChild)
virtual

Reimplemented in QDomDocumentTypePrivate.

Definition at line 1887 of file qdom.cpp.

Referenced by QDomHandler::characters(), QDomHandler::comment(), QDomHandler::processingInstruction(), QDomNamedNodeMapPrivate::setNamedItem(), QDomNamedNodeMapPrivate::setNamedItemNS(), QDomAttrPrivate::setNodeValue(), QDomHandler::skippedEntity(), and QDomHandler::startElement().

1888 {
1889  // No reference manipulation needed. Done in insertAfter.
1890  return insertAfter(newChild, 0);
1891 }
virtual QDomNodePrivate * insertAfter(QDomNodePrivate *newChild, QDomNodePrivate *refChild)
Definition: qdom.cpp:1661

◆ clear()

void QDomNodePrivate::clear ( void  )
virtual

Reimplemented in QDomDocumentPrivate.

Definition at line 1539 of file qdom.cpp.

Referenced by QDomNodeListPrivate::createList(), and QDomDocumentPrivate::setContent().

1540 {
1541  QDomNodePrivate* p = first;
1542  QDomNodePrivate* n;
1543 
1544  while (p) {
1545  n = p->next;
1546  if (!p->ref.deref())
1547  delete p;
1548  p = n;
1549  }
1550  first = 0;
1551  last = 0;
1552 }
QAtomicInt ref
Definition: qdom.cpp:191
bool deref()
Atomically decrements the value of this QAtomicInt.
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * last
Definition: qdom.cpp:196
QDomNodePrivate * first
Definition: qdom.cpp:195

◆ cloneNode()

QDomNodePrivate * QDomNodePrivate::cloneNode ( bool  deep = true)
virtual

Reimplemented in QDomDocumentPrivate, QDomProcessingInstructionPrivate, QDomEntityReferencePrivate, QDomEntityPrivate, QDomNotationPrivate, QDomCDATASectionPrivate, QDomCommentPrivate, QDomElementPrivate, QDomAttrPrivate, QDomTextPrivate, QDomCharacterDataPrivate, QDomDocumentFragmentPrivate, and QDomDocumentTypePrivate.

Definition at line 1905 of file qdom.cpp.

Referenced by QDomNamedNodeMapPrivate::clone().

1906 {
1907  QDomNodePrivate* p = new QDomNodePrivate(this, deep);
1908  // We are not interested in this node
1909  p->ref.deref();
1910  return p;
1911 }
QAtomicInt ref
Definition: qdom.cpp:191
QDomNodePrivate(QDomDocumentPrivate *, QDomNodePrivate *parent=0)
Definition: qdom.cpp:1482
bool deref()
Atomically decrements the value of this QAtomicInt.

◆ insertAfter()

QDomNodePrivate * QDomNodePrivate::insertAfter ( QDomNodePrivate newChild,
QDomNodePrivate refChild 
)
virtual

Reimplemented in QDomDocumentTypePrivate.

Definition at line 1661 of file qdom.cpp.

Referenced by QDomDocumentTypePrivate::insertAfter().

1662 {
1663  // Error check
1664  if (!newChild)
1665  return 0;
1666 
1667  // Error check
1668  if (newChild == refChild)
1669  return 0;
1670 
1671  // Error check
1672  if (refChild && refChild->parent() != this)
1673  return 0;
1674 
1675  // "mark lists as dirty"
1676  QDomDocumentPrivate *const doc = ownerDocument();
1677  if(doc)
1678  doc->nodeListTime++;
1679 
1680  // Special handling for inserting a fragment. We just insert
1681  // all elements of the fragment instead of the fragment itself.
1682  if (newChild->isDocumentFragment()) {
1683  // Fragment is empty ?
1684  if (newChild->first == 0)
1685  return newChild;
1686 
1687  // New parent
1688  QDomNodePrivate* n = newChild->first;
1689  while (n) {
1690  n->setParent(this);
1691  n = n->next;
1692  }
1693 
1694  // Insert at the end
1695  if (!refChild || refChild->next == 0) {
1696  if (last)
1697  last->next = newChild->first;
1698  newChild->first->prev = last;
1699  if (!first)
1700  first = newChild->first;
1701  last = newChild->last;
1702  } else { // Insert in the middle
1703  newChild->first->prev = refChild;
1704  newChild->last->next = refChild->next;
1705  refChild->next->prev = newChild->last;
1706  refChild->next = newChild->first;
1707  }
1708 
1709  // No need to increase the reference since QDomDocumentFragment
1710  // does not decrease the reference.
1711 
1712  // Remove the nodes from the fragment
1713  newChild->first = 0;
1714  newChild->last = 0;
1715  return newChild;
1716  }
1717 
1718  // Release new node from its current parent
1719  if (newChild->parent())
1720  newChild->parent()->removeChild(newChild);
1721 
1722  // No more errors can occur now, so we take
1723  // ownership of the node
1724  newChild->ref.ref();
1725 
1726  newChild->setParent(this);
1727 
1728  // Insert at the end
1729  if (!refChild) {
1730  if (last)
1731  last->next = newChild;
1732  newChild->prev = last;
1733  if (!first)
1734  first = newChild;
1735  last = newChild;
1736  return newChild;
1737  }
1738 
1739  if (refChild->next == 0) {
1740  if (last)
1741  last->next = newChild;
1742  newChild->prev = last;
1743  if (!first)
1744  first = newChild;
1745  last = newChild;
1746  return newChild;
1747  }
1748 
1749  newChild->prev = refChild;
1750  newChild->next = refChild->next;
1751  refChild->next->prev = newChild;
1752  refChild->next = newChild;
1753 
1754  return newChild;
1755 }
QDomNodePrivate * parent() const
Definition: qdom.cpp:161
QDomNodePrivate * prev
Definition: qdom.cpp:192
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
bool ref()
Atomically increments the value of this QAtomicInt.
QAtomicInt ref
Definition: qdom.cpp:191
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * last
Definition: qdom.cpp:196
void setParent(QDomNodePrivate *p)
Definition: qdom.cpp:162
QDomNodePrivate * first
Definition: qdom.cpp:195
virtual bool isDocumentFragment() const
Definition: qdom.cpp:172
virtual QDomNodePrivate * removeChild(QDomNodePrivate *oldChild)
Definition: qdom.cpp:1851

◆ insertBefore()

QDomNodePrivate * QDomNodePrivate::insertBefore ( QDomNodePrivate newChild,
QDomNodePrivate refChild 
)
virtual

Reimplemented in QDomDocumentTypePrivate.

Definition at line 1566 of file qdom.cpp.

Referenced by QDomDocumentTypePrivate::insertBefore().

1567 {
1568  // Error check
1569  if (!newChild)
1570  return 0;
1571 
1572  // Error check
1573  if (newChild == refChild)
1574  return 0;
1575 
1576  // Error check
1577  if (refChild && refChild->parent() != this)
1578  return 0;
1579 
1580  // "mark lists as dirty"
1581  QDomDocumentPrivate *const doc = ownerDocument();
1582  if(doc)
1583  doc->nodeListTime++;
1584 
1585  // Special handling for inserting a fragment. We just insert
1586  // all elements of the fragment instead of the fragment itself.
1587  if (newChild->isDocumentFragment()) {
1588  // Fragment is empty ?
1589  if (newChild->first == 0)
1590  return newChild;
1591 
1592  // New parent
1593  QDomNodePrivate* n = newChild->first;
1594  while (n) {
1595  n->setParent(this);
1596  n = n->next;
1597  }
1598 
1599  // Insert at the beginning ?
1600  if (!refChild || refChild->prev == 0) {
1601  if (first)
1602  first->prev = newChild->last;
1603  newChild->last->next = first;
1604  if (!last)
1605  last = newChild->last;
1606  first = newChild->first;
1607  } else {
1608  // Insert in the middle
1609  newChild->last->next = refChild;
1610  newChild->first->prev = refChild->prev;
1611  refChild->prev->next = newChild->first;
1612  refChild->prev = newChild->last;
1613  }
1614 
1615  // No need to increase the reference since QDomDocumentFragment
1616  // does not decrease the reference.
1617 
1618  // Remove the nodes from the fragment
1619  newChild->first = 0;
1620  newChild->last = 0;
1621  return newChild;
1622  }
1623 
1624  // No more errors can occur now, so we take
1625  // ownership of the node.
1626  newChild->ref.ref();
1627 
1628  if (newChild->parent())
1629  newChild->parent()->removeChild(newChild);
1630 
1631  newChild->setParent(this);
1632 
1633  if (!refChild) {
1634  if (first)
1635  first->prev = newChild;
1636  newChild->next = first;
1637  if (!last)
1638  last = newChild;
1639  first = newChild;
1640  return newChild;
1641  }
1642 
1643  if (refChild->prev == 0) {
1644  if (first)
1645  first->prev = newChild;
1646  newChild->next = first;
1647  if (!last)
1648  last = newChild;
1649  first = newChild;
1650  return newChild;
1651  }
1652 
1653  newChild->next = refChild;
1654  newChild->prev = refChild->prev;
1655  refChild->prev->next = newChild;
1656  refChild->prev = newChild;
1657 
1658  return newChild;
1659 }
QDomNodePrivate * parent() const
Definition: qdom.cpp:161
QDomNodePrivate * prev
Definition: qdom.cpp:192
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
bool ref()
Atomically increments the value of this QAtomicInt.
QAtomicInt ref
Definition: qdom.cpp:191
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * last
Definition: qdom.cpp:196
void setParent(QDomNodePrivate *p)
Definition: qdom.cpp:162
QDomNodePrivate * first
Definition: qdom.cpp:195
virtual bool isDocumentFragment() const
Definition: qdom.cpp:172
virtual QDomNodePrivate * removeChild(QDomNodePrivate *oldChild)
Definition: qdom.cpp:1851

◆ isAttr()

virtual bool QDomNodePrivate::isAttr ( ) const
inlinevirtual

Reimplemented in QDomAttrPrivate.

Definition at line 170 of file qdom.cpp.

Referenced by QDomNode::toAttr().

170 { return false; }

◆ isCDATASection()

virtual bool QDomNodePrivate::isCDATASection ( ) const
inlinevirtual

Reimplemented in QDomCDATASectionPrivate.

Definition at line 171 of file qdom.cpp.

Referenced by QDomElementPrivate::text(), and QDomNode::toCDATASection().

171 { return false; }

◆ isCharacterData()

virtual bool QDomNodePrivate::isCharacterData ( ) const
inlinevirtual

Reimplemented in QDomCharacterDataPrivate.

Definition at line 181 of file qdom.cpp.

Referenced by QDomNode::toCharacterData().

181 { return false; }

◆ isComment()

virtual bool QDomNodePrivate::isComment ( ) const
inlinevirtual

Reimplemented in QDomCommentPrivate.

Definition at line 182 of file qdom.cpp.

Referenced by QDomNode::toComment().

182 { return false; }

◆ isDocument()

virtual bool QDomNodePrivate::isDocument ( ) const
inlinevirtual

Reimplemented in QDomDocumentPrivate.

Definition at line 173 of file qdom.cpp.

Referenced by ownerDocument(), and QDomNode::toDocument().

173 { return false; }

◆ isDocumentFragment()

virtual bool QDomNodePrivate::isDocumentFragment ( ) const
inlinevirtual

Reimplemented in QDomDocumentFragmentPrivate.

Definition at line 172 of file qdom.cpp.

Referenced by insertAfter(), insertBefore(), replaceChild(), and QDomNode::toDocumentFragment().

172 { return false; }

◆ isDocumentType()

virtual bool QDomNodePrivate::isDocumentType ( ) const
inlinevirtual

Reimplemented in QDomDocumentTypePrivate.

Definition at line 174 of file qdom.cpp.

Referenced by QDomNode::toDocumentType().

174 { return false; }

◆ isElement()

virtual bool QDomNodePrivate::isElement ( ) const
inlinevirtual

◆ isEntity()

virtual bool QDomNodePrivate::isEntity ( ) const
inlinevirtual

◆ isEntityReference()

virtual bool QDomNodePrivate::isEntityReference ( ) const
inlinevirtual

Reimplemented in QDomEntityReferencePrivate.

Definition at line 176 of file qdom.cpp.

Referenced by QDomNode::toEntityReference().

176 { return false; }

◆ isNotation()

virtual bool QDomNodePrivate::isNotation ( ) const
inlinevirtual

◆ isProcessingInstruction()

virtual bool QDomNodePrivate::isProcessingInstruction ( ) const
inlinevirtual

Reimplemented in QDomProcessingInstructionPrivate.

Definition at line 180 of file qdom.cpp.

Referenced by QDomDocumentPrivate::saveDocument(), and QDomNode::toProcessingInstruction().

180 { return false; }

◆ isText()

virtual bool QDomNodePrivate::isText ( ) const
inlinevirtual

Reimplemented in QDomTextPrivate.

Definition at line 177 of file qdom.cpp.

Referenced by qNormalizeNode(), QDomElementPrivate::save(), QDomElementPrivate::text(), and QDomNode::toText().

177 { return false; }

◆ namedItem()

QDomNodePrivate * QDomNodePrivate::namedItem ( const QString name)

Definition at line 1554 of file qdom.cpp.

1555 {
1556  QDomNodePrivate* p = first;
1557  while (p) {
1558  if (p->nodeName() == n)
1559  return p;
1560  p = p->next;
1561  }
1562  return 0;
1563 }
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * first
Definition: qdom.cpp:195
QString nodeName() const
Definition: qdom.cpp:142

◆ nodeName()

QString QDomNodePrivate::nodeName ( ) const
inline

◆ nodeType()

virtual QDomNode::NodeType QDomNodePrivate::nodeType ( ) const
inlinevirtual

◆ nodeValue()

QString QDomNodePrivate::nodeValue ( ) const
inline

◆ normalize()

void QDomNodePrivate::normalize ( )
virtual

Definition at line 1935 of file qdom.cpp.

1936 {
1937  // ### This one has moved from QDomElementPrivate to this position. It is
1938  // not tested.
1939  qNormalizeNode(this);
1940 }
static void qNormalizeNode(QDomNodePrivate *n)
Definition: qdom.cpp:1913

◆ ownerDocument()

QDomDocumentPrivate * QDomNodePrivate::ownerDocument ( )

Definition at line 1893 of file qdom.cpp.

Referenced by QDomNodeListPrivate::createList(), QDomNodeListPrivate::item(), QDomNodeListPrivate::length(), QDomNodePrivate(), QDomElementPrivate::setAttribute(), and QDomElementPrivate::setAttributeNS().

1894 {
1895  QDomNodePrivate* p = this;
1896  while (p && !p->isDocument()) {
1897  if (!p->hasParent)
1898  return (QDomDocumentPrivate*)p->ownerNode;
1899  p = p->parent();
1900  }
1901 
1902  return static_cast<QDomDocumentPrivate *>(p);
1903 }
QDomNodePrivate * parent() const
Definition: qdom.cpp:161
QDomNodePrivate * ownerNode
Definition: qdom.cpp:194
bool hasParent
Definition: qdom.cpp:203
virtual bool isDocument() const
Definition: qdom.cpp:173

◆ parent()

QDomNodePrivate* QDomNodePrivate::parent ( ) const
inline

◆ removeChild()

QDomNodePrivate * QDomNodePrivate::removeChild ( QDomNodePrivate oldChild)
virtual

Reimplemented in QDomDocumentTypePrivate.

Definition at line 1851 of file qdom.cpp.

Referenced by insertAfter(), insertBefore(), qNormalizeNode(), QDomDocumentTypePrivate::removeChild(), replaceChild(), and QDomAttrPrivate::setNodeValue().

1852 {
1853  // Error check
1854  if (oldChild->parent() != this)
1855  return 0;
1856 
1857  // "mark lists as dirty"
1858  QDomDocumentPrivate *const doc = ownerDocument();
1859  if(doc)
1860  doc->nodeListTime++;
1861 
1862  // Perhaps oldChild was just created with "createElement" or that. In this case
1863  // its parent is QDomDocument but it is not part of the documents child list.
1864  if (oldChild->next == 0 && oldChild->prev == 0 && first != oldChild)
1865  return 0;
1866 
1867  if (oldChild->next)
1868  oldChild->next->prev = oldChild->prev;
1869  if (oldChild->prev)
1870  oldChild->prev->next = oldChild->next;
1871 
1872  if (last == oldChild)
1873  last = oldChild->prev;
1874  if (first == oldChild)
1875  first = oldChild->next;
1876 
1877  oldChild->setNoParent();
1878  oldChild->next = 0;
1879  oldChild->prev = 0;
1880 
1881  // We are no longer interested in the old node
1882  oldChild->ref.deref();
1883 
1884  return oldChild;
1885 }
QDomNodePrivate * parent() const
Definition: qdom.cpp:161
QDomNodePrivate * prev
Definition: qdom.cpp:192
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
void setNoParent()
Definition: qdom.cpp:164
QAtomicInt ref
Definition: qdom.cpp:191
bool deref()
Atomically decrements the value of this QAtomicInt.
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * last
Definition: qdom.cpp:196
QDomNodePrivate * first
Definition: qdom.cpp:195

◆ replaceChild()

QDomNodePrivate * QDomNodePrivate::replaceChild ( QDomNodePrivate newChild,
QDomNodePrivate oldChild 
)
virtual

Reimplemented in QDomDocumentTypePrivate.

Definition at line 1757 of file qdom.cpp.

Referenced by QDomDocumentTypePrivate::replaceChild().

1758 {
1759  if (!newChild || !oldChild)
1760  return 0;
1761  if (oldChild->parent() != this)
1762  return 0;
1763  if (newChild == oldChild)
1764  return 0;
1765 
1766  // mark lists as dirty
1767  QDomDocumentPrivate *const doc = ownerDocument();
1768  if(doc)
1769  doc->nodeListTime++;
1770 
1771  // Special handling for inserting a fragment. We just insert
1772  // all elements of the fragment instead of the fragment itself.
1773  if (newChild->isDocumentFragment()) {
1774  // Fragment is empty ?
1775  if (newChild->first == 0)
1776  return newChild;
1777 
1778  // New parent
1779  QDomNodePrivate* n = newChild->first;
1780  while (n) {
1781  n->setParent(this);
1782  n = n->next;
1783  }
1784 
1785 
1786  if (oldChild->next)
1787  oldChild->next->prev = newChild->last;
1788  if (oldChild->prev)
1789  oldChild->prev->next = newChild->first;
1790 
1791  newChild->last->next = oldChild->next;
1792  newChild->first->prev = oldChild->prev;
1793 
1794  if (first == oldChild)
1795  first = newChild->first;
1796  if (last == oldChild)
1797  last = newChild->last;
1798 
1799  oldChild->setNoParent();
1800  oldChild->next = 0;
1801  oldChild->prev = 0;
1802 
1803  // No need to increase the reference since QDomDocumentFragment
1804  // does not decrease the reference.
1805 
1806  // Remove the nodes from the fragment
1807  newChild->first = 0;
1808  newChild->last = 0;
1809 
1810  // We are no longer interested in the old node
1811  if (oldChild)
1812  oldChild->ref.deref();
1813 
1814  return oldChild;
1815  }
1816 
1817  // No more errors can occur now, so we take
1818  // ownership of the node
1819  newChild->ref.ref();
1820 
1821  // Release new node from its current parent
1822  if (newChild->parent())
1823  newChild->parent()->removeChild(newChild);
1824 
1825  newChild->setParent(this);
1826 
1827  if (oldChild->next)
1828  oldChild->next->prev = newChild;
1829  if (oldChild->prev)
1830  oldChild->prev->next = newChild;
1831 
1832  newChild->next = oldChild->next;
1833  newChild->prev = oldChild->prev;
1834 
1835  if (first == oldChild)
1836  first = newChild;
1837  if (last == oldChild)
1838  last = newChild;
1839 
1840  oldChild->setNoParent();
1841  oldChild->next = 0;
1842  oldChild->prev = 0;
1843 
1844  // We are no longer interested in the old node
1845  if (oldChild)
1846  oldChild->ref.deref();
1847 
1848  return oldChild;
1849 }
QDomNodePrivate * parent() const
Definition: qdom.cpp:161
QDomNodePrivate * prev
Definition: qdom.cpp:192
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
bool ref()
Atomically increments the value of this QAtomicInt.
void setNoParent()
Definition: qdom.cpp:164
QAtomicInt ref
Definition: qdom.cpp:191
bool deref()
Atomically decrements the value of this QAtomicInt.
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * last
Definition: qdom.cpp:196
void setParent(QDomNodePrivate *p)
Definition: qdom.cpp:162
QDomNodePrivate * first
Definition: qdom.cpp:195
virtual bool isDocumentFragment() const
Definition: qdom.cpp:172
virtual QDomNodePrivate * removeChild(QDomNodePrivate *oldChild)
Definition: qdom.cpp:1851

◆ save()

void QDomNodePrivate::save ( QTextStream s,
int  depth,
int  indent 
) const
virtual
Warning
This function is not part of the public interface. depth is used for indentation, it seems.

Reimplemented in QDomProcessingInstructionPrivate, QDomEntityReferencePrivate, QDomEntityPrivate, QDomNotationPrivate, QDomCDATASectionPrivate, QDomCommentPrivate, QDomElementPrivate, QDomAttrPrivate, QDomTextPrivate, and QDomDocumentTypePrivate.

Definition at line 1945 of file qdom.cpp.

Referenced by save(), and QDomDocumentPrivate::saveDocument().

1946 {
1947  const QDomNodePrivate* n = first;
1948  while (n) {
1949  n->save(s, depth, indent);
1950  n = n->next;
1951  }
1952 }
virtual void save(QTextStream &, int, int) const
Definition: qdom.cpp:1945
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * first
Definition: qdom.cpp:195

◆ setLocation()

void QDomNodePrivate::setLocation ( int  lineNumber,
int  columnNumber 
)

◆ setNodeValue()

virtual void QDomNodePrivate::setNodeValue ( const QString v)
inlinevirtual

◆ setNoParent()

void QDomNodePrivate::setNoParent ( )
inline

Definition at line 164 of file qdom.cpp.

Referenced by removeChild(), replaceChild(), and ~QDomNodePrivate().

164  {
166  hasParent = false;
167  }
QDomDocumentPrivate * ownerDocument()
Definition: qdom.cpp:1893
QDomNodePrivate * ownerNode
Definition: qdom.cpp:194
bool hasParent
Definition: qdom.cpp:203

◆ setOwnerDocument()

void QDomNodePrivate::setOwnerDocument ( QDomDocumentPrivate doc)
inline

Definition at line 1476 of file qdom.cpp.

Referenced by QDomDocumentPrivate::importNode().

1477 {
1478  ownerNode = doc;
1479  hasParent = false;
1480 }
QDomNodePrivate * ownerNode
Definition: qdom.cpp:194
bool hasParent
Definition: qdom.cpp:203

◆ setParent()

void QDomNodePrivate::setParent ( QDomNodePrivate p)
inline

Definition at line 162 of file qdom.cpp.

Referenced by QDomNamedNodeMapPrivate::clone(), insertAfter(), insertBefore(), replaceChild(), and QDomElementPrivate::setAttributeNode().

162 { ownerNode = p; hasParent = true; }
QDomNodePrivate * ownerNode
Definition: qdom.cpp:194
bool hasParent
Definition: qdom.cpp:203

Properties

◆ columnNumber

int QDomNodePrivate::columnNumber

Definition at line 206 of file qdom.cpp.

◆ createdWithDom1Interface

bool QDomNodePrivate::createdWithDom1Interface

◆ first

QDomNodePrivate* QDomNodePrivate::first

◆ hasParent

bool QDomNodePrivate::hasParent

Definition at line 203 of file qdom.cpp.

Referenced by ownerDocument().

◆ last

QDomNodePrivate* QDomNodePrivate::last

Definition at line 196 of file qdom.cpp.

Referenced by insertAfter(), insertBefore(), replaceChild(), and QDomElementPrivate::save().

◆ lineNumber

int QDomNodePrivate::lineNumber

Definition at line 205 of file qdom.cpp.

◆ name

QString QDomNodePrivate::name

◆ namespaceURI

QString QDomNodePrivate::namespaceURI

◆ next

QDomNodePrivate* QDomNodePrivate::next

◆ ownerNode

QDomNodePrivate* QDomNodePrivate::ownerNode

Definition at line 194 of file qdom.cpp.

Referenced by ownerDocument(), and QDomAttrPrivate::save().

◆ prefix

QString QDomNodePrivate::prefix

◆ prev

QDomNodePrivate* QDomNodePrivate::prev

◆ ref

QAtomicInt QDomNodePrivate::ref

◆ value

QString QDomNodePrivate::value

The documentation for this class was generated from the following file: