From c73dd2e88722c2e165bb4c0f177ca536eea326fb Mon Sep 17 00:00:00 2001 From: knodlseder <> Date: Fri, 15 Oct 2010 16:19:03 +0000 Subject: [PATCH] initial version --- include/GXml.hpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/xml/GXml.cpp | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/xml/Makefile.am | 14 ++++++++++++++ 3 files changed, 263 insertions(+), 0 deletions(-) create mode 100644 include/GXml.hpp create mode 100644 src/xml/GXml.cpp create mode 100644 src/xml/Makefile.am diff --git a/include/GXml.hpp b/include/GXml.hpp new file mode 100644 index 0000000..6e73135 --- /dev/null +++ b/include/GXml.hpp @@ -0,0 +1,57 @@ +/*************************************************************************** + * GXml.hpp - XML class definition * + * ----------------------------------------------------------------------- * + * copyright (C) 2010 by Jurgen Knodlseder * + * ----------------------------------------------------------------------- * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +/** + * @file GXml.hpp + * @brief XML class definition + * @author J. Knodlseder + */ + +#ifndef GXML_HPP +#define GXML_HPP + +/* __ Includes ___________________________________________________________ */ +#include + + +/***********************************************************************//** + * @class GXml + * + * @brief XML class interface defintion. + ***************************************************************************/ +class GXml { + + // I/O friends + friend std::ostream& operator<< (std::ostream& os, const GXml& xml); + +public: + // Constructors and destructors + GXml(void); + GXml(const GXml& xml); + ~GXml(void); + + // Operators + GXml& operator= (const GXml& xml); + + // Methods + +protected: + // Protected methods + void init_members(void); + void copy_members(const GXml& xml); + void free_members(void); + + // Protected data members + std::string m_name; //!< Name +}; + +#endif /* GXML_HPP */ diff --git a/src/xml/GXml.cpp b/src/xml/GXml.cpp new file mode 100644 index 0000000..7b47a22 --- /dev/null +++ b/src/xml/GXml.cpp @@ -0,0 +1,192 @@ +/*************************************************************************** + * GXml.cpp - XML class implementation * + * ----------------------------------------------------------------------- * + * copyright (C) 2010 by Jurgen Knodlseder * + * ----------------------------------------------------------------------- * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +/** + * @file GXml.cpp + * @brief XML class implementation + * @author J. Knodlseder + */ + +/* __ Includes ___________________________________________________________ */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "GXml.hpp" + +/* __ Method name definitions ____________________________________________ */ + +/* __ Macros _____________________________________________________________ */ + +/* __ Coding definitions _________________________________________________ */ + +/* __ Debug definitions __________________________________________________ */ + + +/*========================================================================== + = = + = Constructors/destructors = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Void constructor + ***************************************************************************/ +GXml::GXml(void) +{ + // Initialise private members for clean destruction + init_members(); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Copy constructor + * + * @param[in] xml Object from which the instance should be built. + ***************************************************************************/ +GXml::GXml(const GXml& xml) +{ + // Initialise private members for clean destruction + init_members(); + + // Copy members + copy_members(xml); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Destructor + ***************************************************************************/ +GXml::~GXml(void) +{ + // Free members + free_members(); + + // Return + return; +} + + +/*========================================================================== + = = + = Operators = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Assignment operator + * + * @param[in] xml Object which should be assigned. + ***************************************************************************/ +GXml& GXml::operator= (const GXml& xml) +{ + // Execute only if object is not identical + if (this != &xml) { + + // Free members + free_members(); + + // Initialise private members for clean destruction + init_members(); + + // Copy members + copy_members(xml); + + } // endif: object was not identical + + // Return + return *this; +} + + +/*========================================================================== + = = + = Public methods = + = = + ==========================================================================*/ + +/*========================================================================== + = = + = Private methods = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Initialise class members + ***************************************************************************/ +void GXml::init_members(void) +{ + // Initialise members + m_name.clear(); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Copy class members + * + * @param[in] xml Object from which members which should be copied. + ***************************************************************************/ +void GXml::copy_members(const GXml& xml) +{ + // Copy attributes + m_name = xml.m_name; + + // Return + return; +} + + +/***********************************************************************//** + * @brief Delete class members + ***************************************************************************/ +void GXml::free_members(void) +{ + // Free memory + //if (m_par != NULL) delete [] m_par; + + // Signal free pointers + //m_par = NULL; + + // Return + return; +} + + +/*========================================================================== + = = + = Friends = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Put object in output stream + * + * @param[in] os Output stream into which the model will be dumped + * @param[in] xml Object to be dumped + ***************************************************************************/ +std::ostream& operator<< (std::ostream& os, const GXml& xml) +{ + // Put object in stream + os << "=== GXml ===" << std::endl; + + // Return output stream + return os; +} + diff --git a/src/xml/Makefile.am b/src/xml/Makefile.am new file mode 100644 index 0000000..15edc52 --- /dev/null +++ b/src/xml/Makefile.am @@ -0,0 +1,14 @@ +## Process this file with automake to produce Makefile.in + +# Set include directories +INCLUDES = -I$(top_srcdir)/include \ + -I$(top_builddir)/src \ + -I$(top_srcdir)/src/support + +# Define sources for this directory +sources = GXml.cpp + +# Build libtool library +noinst_LTLIBRARIES = libxml.la +libxml_la_SOURCES = $(sources) +libxml_la_LDFLAGS = -version-info $(GAMMALIB_LT_VERSION) -- libgit2 0.21.4