00001 00012 // for truncation warning 00013 #ifdef _MSC_VER 00014 #include "msdevstudio/MSconfig.h" 00015 #endif 00016 00017 #include "BaseXML.h" 00018 00019 #include "XmlController.h" 00020 #include "XmlDocument.h" 00021 #include "XmlElement.h" 00022 00023 #include <cassert> 00024 00025 using std::string; 00026 using std::swap; 00027 00028 namespace hippodraw { 00029 00030 BaseXML:: 00031 BaseXML ( const std::string & tagname, XmlController * controller ) 00032 : m_tagname ( tagname ), 00033 m_type ( "type" ), 00034 m_id ( "id" ), 00035 m_controller ( controller ) 00036 { 00037 } 00038 00039 BaseXML::~BaseXML ( ) 00040 { 00041 } 00042 00043 XmlElement * BaseXML::createElement ( ) 00044 { 00045 return XmlController::m_xml_doc->createElement ( m_tagname ); 00046 } 00047 00048 const string & BaseXML::tagName () const 00049 { 00050 return m_tagname; 00051 } 00052 00053 const XmlElement * BaseXML::getNode ( const XmlElement * parent ) const 00054 { 00055 return parent->getNode ( m_tagname ); 00056 } 00057 00058 void BaseXML::fillNodeList ( const XmlElement * element, 00059 std::list < XmlElement * > & nodelist ) 00060 { 00061 element->fillNodeList ( m_tagname, nodelist ); 00062 } 00063 00064 void BaseXML::setId ( XmlElement & tag, int id ) 00065 { 00066 tag.setAttribute ( m_id, id ); 00067 } 00068 00069 } // namespace hippodraw 00070