Return TypeFunction nameArguments
hzEcodehzXmlNode::AddNode(hzXmlNode*,)

Declared in file: hzDocument.h
Defined in file : hzDocXml.cpp

Function Logic:

0:START 1:!pNode 2:Return hzerr(E_ARGUMENT,Attempt to add a null node to %s,txtName()) 3:pNode==this 4:Return hzerr(E_DUPLICATE,Attempt to add a node (%d) to itself (%d, %s),pNode->m_Uid,m_Uid,txtName()) 5:!m_pHostDoc 6:hzexit 7:hzMapM::Insert 8:!m_Children 9:hzXmlNode::GetUid m_Children 10:tmp->m_Sibling; 11:pNode==tmp 12:Return hzerr(E_DUPLICATE,Attempt to add an already existing node to %s,txtName()) 13:tmp 14:Return E_OK

Function body:

hzEcode hzXmlNode::AddNode (hzXmlNode* pNode)
{
   _hzfunc("hzXmlNode::AddNode") ;
   hzXmlNode*  tmp ;
   if (!pNode)
       return hzerr(E_ARGUMENT, "Attempt to add a null node to %s", txtName()) ;
   if (pNode == this)
       return hzerr(E_DUPLICATE, "Attempt to add a node (%d) to itself (%d, %s)", pNode->m_Uid, m_Uid, txtName()) ;
   if (!m_pHostDoc)
       hzexit(E_NOINIT, "Node has no host document") ;
   m_pHostDoc->m_NodesPar.Insert(m_Uid, pNode->m_Uid) ;
   if (!m_Children)
       m_Children = pNode->GetUid() ;
   else
   {
       for (tmp = GetFirstChild() ; tmp->m_Sibling ; tmp = tmp->Sibling())
       {
           if (pNode == tmp)
               return hzerr(E_DUPLICATE, "Attempt to add an already existing node to %s", txtName()) ;
       }
       tmp->m_Sibling = pNode->m_Uid ;
   }
   return E_OK ;
}