BaseXML.cxx
Go to the documentation of this file.
1 
12 // for truncation warning
13 #ifdef _MSC_VER
14 #include "msdevstudio/MSconfig.h"
15 #endif
16 
17 #include "BaseXML.h"
18 
19 #include "XmlController.h"
20 #include "XmlDocument.h"
21 #include "XmlElement.h"
22 
23 #include <cassert>
24 
25 using std::string;
26 using std::swap;
27 
28 namespace hippodraw {
29 
31 BaseXML ( const std::string & tagname, XmlController * controller )
32  : m_tagname ( tagname ),
33  m_type ( "type" ),
34  m_id ( "id" ),
35  m_controller ( controller )
36 {
37 }
38 
40 {
41 }
42 
44 {
46 }
47 
48 const string & BaseXML::tagName () const
49 {
50  return m_tagname;
51 }
52 
53 const XmlElement * BaseXML::getNode ( const XmlElement * parent ) const
54 {
55  return parent->getNode ( m_tagname );
56 }
57 
58 void BaseXML::fillNodeList ( const XmlElement * element,
59  std::list < XmlElement * > & nodelist )
60 {
61  element->fillNodeList ( m_tagname, nodelist );
62 }
63 
64 void BaseXML::setId ( XmlElement & tag, int id )
65 {
66  tag.setAttribute ( m_id, id );
67 }
68 
69 } // namespace hippodraw
70 
XmlElement * createElement()
Creates a new element node.
Definition: BaseXML.cxx:43
virtual const std::string & tagName() const
Returns the tag name used by this class.
Definition: BaseXML.cxx:48
virtual XmlElement * createElement(const std::string &tagName)=0
Creates a new DOM element wrapper object and returns a pointer to it.
XmlDocument class interface.
XmlController class interface.
BaseXML class interface.
const std::string m_tagname
The tag name used for elements created by this class.
Definition: BaseXML.h:50
const XmlElement * getNode(const XmlElement *element) const
Returns the single child node of element of the type that can be handled by this object.
Definition: BaseXML.cxx:53
A pure virtual base class of XML element wrapper.
Definition: XmlElement.h:30
void fillNodeList(const XmlElement *element, std::list< XmlElement * > &nodelist)
Fills the nodelist with immediate child nodes of element with nodes that can be handled by this objec...
Definition: BaseXML.cxx:58
virtual XmlElement * getNode(const std::string &tagName) const =0
Returns the single direct child element node with name tagName.
void setId(XmlElement &tag, int id)
Sets the unique identification of the object.
Definition: BaseXML.cxx:64
const std::string m_id
The attribute name for the identification of the object.
Definition: BaseXML.h:57
virtual ~BaseXML()
The destructor.
Definition: BaseXML.cxx:39
BaseXML(const BaseXML &)
A private copy constructor in order to avoid copying.
virtual void fillNodeList(const std::string &tagName, std::list< XmlElement * > &nodeList) const =0
Fills the nodeList with elements with tag name tagName.
XmlElement class interface.
static XmlDocument * m_xml_doc
The current document being generated or read.
A base class that is the interface between GUI and the XML serialization and deserialization.
Definition: XmlController.h:53
virtual void setAttribute(const std::string &name, bool value)=0
Sets attribute named name to the int value value.

Generated for HippoDraw Class Library by doxygen