Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

element_name.cxx

Go to the documentation of this file.
00001 /******************************************************************************
00002 
00003                            Copyright Notice.
00004 
00005                Licensed material - Property of Steve Lhomme
00006 
00007 This source file is part of Steve Lhomme's libSVX.
00008 (C) Copyright Steve Lhomme, France, 2001-2002.
00009 All rights reserved. Modifications (C) copyrighted by their respective
00010 contributors, all rights reserved.
00011 
00012 The contents of this file are subject to the Bixoft Public License
00013 Version 1.0 (the "License"); you may not use this file in any way except
00014 in compliance with the License. You should have received a copy of the
00015 License with this source; see <file or member name>. You may also obtain
00016 a copy of the License at http://www.bixoft.nl/english/license.htm
00017 or http://mukoli.free.fr/BXAPL/
00018 
00019 ANY USE OF THE SOFTWARE CONSTITUTES ACCEPTANCE OF THE LICENSE.
00020 
00021 Anything distributed under the License is distributed on an "AS IS" basis,
00022 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
00023 the specific language governing rights and limitations under the License.
00024 
00025 Definitions required by the License:
00026 Copyright Holder: Steve Lhomme, France
00027           e-mail: steve.lhomme@free.fr
00028 Country: France, i.e. the laws of France apply.
00029 Court  : ????
00030 Programming Tool status: This source is not a Programming Tool.
00031 
00032 Contributor(s):                      Contribution:
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   // attributes
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 //  assert(IsValid());
00095 
00096 //  if (the_object_to_add.IsValid())
00097   {
00098     static_cast<ElementGeneric&>(*this) += the_object_to_add;
00099 
00100     // attributes
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 //  bool result = !(IsValid() && the_object_to_compare.IsValid());
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 }

Generated on Sat Apr 13 15:45:48 2002 for libsvx by doxygen1.2.15