Logo Search packages:      
Sourcecode: rarian version File versions

TiXmlNode * TiXmlNode::ReplaceChild ( TiXmlNode replaceThis,
const TiXmlNode withThis 
) [inherited]

Replace a child of this node. Returns a pointer to the new object or NULL if an error occured.

Definition at line 276 of file tinyxml.cpp.

References TiXmlNode::Clone(), TiXmlNode::next, TiXmlNode::parent, and TiXmlNode::prev.

{
      if ( replaceThis->parent != this )
            return 0;

      TiXmlNode* node = withThis.Clone();
      if ( !node )
            return 0;

      node->next = replaceThis->next;
      node->prev = replaceThis->prev;

      if ( replaceThis->next )
            replaceThis->next->prev = node;
      else
            lastChild = node;

      if ( replaceThis->prev )
            replaceThis->prev->next = node;
      else
            firstChild = node;

      delete replaceThis;
      node->parent = this;
      return node;
}


Generated by  Doxygen 1.6.0   Back to index