* Path for renames during restore and renames during share (thanks to Bryan Aldrich...
[vss2svn.git] / ssphys / SSPhysLib / XML.cpp
blob82c1bc6cee8d6c4f5faa04774d907d5ff1a0607c
1 // XML.cpp:
2 //
3 //////////////////////////////////////////////////////////////////////
5 #include "StdAfx.h"
6 #include "XML.h"
8 XMLNode::XMLNode (XMLNode* pParent, std::string name, AttribMap attrib)
9 : m_Node (name), m_pParent (pParent)
11 SetAttributes (attrib);
14 void XMLNode::SetAttributes (AttribMap attrib)
16 AttribMap::iterator itor = attrib.begin ();
17 for (; itor != attrib.end (); ++itor)
19 m_Node.SetAttribute(itor->first, itor->second);
23 void XMLNode::AddChild (XMLNode* pChild)
25 m_Node.InsertEndChild(pChild->m_Node);
28 void XMLNode::AddText (XMLText* pContent)
30 m_Node.InsertEndChild(pContent->m_Text);
33 void XMLNode::SetText (std::string text)
35 TiXmlText xmlText (text);
36 m_Node.InsertEndChild(xmlText);
39 XMLNode::~XMLNode ()
41 if (m_pParent)
42 m_pParent->AddChild (this);
45 // ---------------------------------------------------------------
46 XMLText::~XMLText ()
48 if (m_pParent)
49 m_pParent->AddText(this);
53 void XMLText::SetValue (std::string value)
55 m_Text.SetValue (value);