00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00044 #include "../tinyxml/tinyxml.h"
00045
00046 #include "attribute.h"
00047
00048 #include "element_name.h"
00049
00050 using namespace libsvx;
00051
00054 ElementName::ElementName(TiXmlElement & Element, const std::string the_name)
00055 :ElementGeneric(Element,the_name)
00056 ,m_A_name(NULL)
00057 {
00058
00059 if (Element.Attribute("name") != NULL)
00060 {
00061 m_A_name = new Attribute(*Element.Attribute("name"),"name");
00062 }
00063 }
00064
00068 ElementName::ElementName(const ElementName & a_element)
00069 :ElementGeneric(a_element)
00070 {
00071 if (a_element.m_A_name != NULL)
00072 m_A_name = new Attribute(*a_element.m_A_name);
00073 else
00074 m_A_name = NULL;
00075 }
00076
00080 ElementName::~ElementName()
00081 {
00082 if (m_A_name != NULL)
00083 delete m_A_name;
00084 }
00085
00086 void ElementName::XmlElement(TiXmlElement & the_element_to_fill)
00087 {
00088 if (m_A_name != NULL)
00089 m_A_name->XmlElement(the_element_to_fill);
00090 }
00091
00092 ElementName & ElementName::operator+=(const ElementName & the_object_to_add)
00093 {
00094
00095
00096
00097 {
00098 static_cast<ElementGeneric&>(*this) += the_object_to_add;
00099
00100
00101 if (the_object_to_add.m_A_name != NULL)
00102 {
00103 if (m_A_name == NULL)
00104 {
00105 delete m_A_name;
00106 }
00107 m_A_name = new Attribute(*the_object_to_add.m_A_name);
00108 }
00109 }
00110 return *this;
00111 }
00112
00116 bool ElementName::operator!=(const ElementName & the_object_to_compare) const
00117 {
00118
00119 bool result = false;
00120
00121 result = result || (static_cast<const ElementGeneric&>(*this) != the_object_to_compare);
00122 result = result || (m_A_name != the_object_to_compare.m_A_name);
00123
00124 return result;
00125 }