Commit c73dd2e88722c2e165bb4c0f177ca536eea326fb

Authored by knodlseder
1 parent 598a20dc

initial version

include/GXml.hpp 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GXml.hpp - XML class definition *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software; you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation; either version 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GXml.hpp
  15 + * @brief XML class definition
  16 + * @author J. Knodlseder
  17 + */
  18 +
  19 +#ifndef GXML_HPP
  20 +#define GXML_HPP
  21 +
  22 +/* __ Includes ___________________________________________________________ */
  23 +#include <iostream>
  24 +
  25 +
  26 +/***********************************************************************//**
  27 + * @class GXml
  28 + *
  29 + * @brief XML class interface defintion.
  30 + ***************************************************************************/
  31 +class GXml {
  32 +
  33 + // I/O friends
  34 + friend std::ostream& operator<< (std::ostream& os, const GXml& xml);
  35 +
  36 +public:
  37 + // Constructors and destructors
  38 + GXml(void);
  39 + GXml(const GXml& xml);
  40 + ~GXml(void);
  41 +
  42 + // Operators
  43 + GXml& operator= (const GXml& xml);
  44 +
  45 + // Methods
  46 +
  47 +protected:
  48 + // Protected methods
  49 + void init_members(void);
  50 + void copy_members(const GXml& xml);
  51 + void free_members(void);
  52 +
  53 + // Protected data members
  54 + std::string m_name; //!< Name
  55 +};
  56 +
  57 +#endif /* GXML_HPP */
... ...
src/xml/GXml.cpp 0 โ†’ 100644
  1 +/***************************************************************************
  2 + * GXml.cpp - XML class implementation *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2010 by Jurgen Knodlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software; you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation; either version 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GXml.cpp
  15 + * @brief XML class implementation
  16 + * @author J. Knodlseder
  17 + */
  18 +
  19 +/* __ Includes ___________________________________________________________ */
  20 +#ifdef HAVE_CONFIG_H
  21 +#include <config.h>
  22 +#endif
  23 +#include "GXml.hpp"
  24 +
  25 +/* __ Method name definitions ____________________________________________ */
  26 +
  27 +/* __ Macros _____________________________________________________________ */
  28 +
  29 +/* __ Coding definitions _________________________________________________ */
  30 +
  31 +/* __ Debug definitions __________________________________________________ */
  32 +
  33 +
  34 +/*==========================================================================
  35 + = =
  36 + = Constructors/destructors =
  37 + = =
  38 + ==========================================================================*/
  39 +
  40 +/***********************************************************************//**
  41 + * @brief Void constructor
  42 + ***************************************************************************/
  43 +GXml::GXml(void)
  44 +{
  45 + // Initialise private members for clean destruction
  46 + init_members();
  47 +
  48 + // Return
  49 + return;
  50 +}
  51 +
  52 +
  53 +/***********************************************************************//**
  54 + * @brief Copy constructor
  55 + *
  56 + * @param[in] xml Object from which the instance should be built.
  57 + ***************************************************************************/
  58 +GXml::GXml(const GXml& xml)
  59 +{
  60 + // Initialise private members for clean destruction
  61 + init_members();
  62 +
  63 + // Copy members
  64 + copy_members(xml);
  65 +
  66 + // Return
  67 + return;
  68 +}
  69 +
  70 +
  71 +/***********************************************************************//**
  72 + * @brief Destructor
  73 + ***************************************************************************/
  74 +GXml::~GXml(void)
  75 +{
  76 + // Free members
  77 + free_members();
  78 +
  79 + // Return
  80 + return;
  81 +}
  82 +
  83 +
  84 +/*==========================================================================
  85 + = =
  86 + = Operators =
  87 + = =
  88 + ==========================================================================*/
  89 +
  90 +/***********************************************************************//**
  91 + * @brief Assignment operator
  92 + *
  93 + * @param[in] xml Object which should be assigned.
  94 + ***************************************************************************/
  95 +GXml& GXml::operator= (const GXml& xml)
  96 +{
  97 + // Execute only if object is not identical
  98 + if (this != &xml) {
  99 +
  100 + // Free members
  101 + free_members();
  102 +
  103 + // Initialise private members for clean destruction
  104 + init_members();
  105 +
  106 + // Copy members
  107 + copy_members(xml);
  108 +
  109 + } // endif: object was not identical
  110 +
  111 + // Return
  112 + return *this;
  113 +}
  114 +
  115 +
  116 +/*==========================================================================
  117 + = =
  118 + = Public methods =
  119 + = =
  120 + ==========================================================================*/
  121 +
  122 +/*==========================================================================
  123 + = =
  124 + = Private methods =
  125 + = =
  126 + ==========================================================================*/
  127 +
  128 +/***********************************************************************//**
  129 + * @brief Initialise class members
  130 + ***************************************************************************/
  131 +void GXml::init_members(void)
  132 +{
  133 + // Initialise members
  134 + m_name.clear();
  135 +
  136 + // Return
  137 + return;
  138 +}
  139 +
  140 +
  141 +/***********************************************************************//**
  142 + * @brief Copy class members
  143 + *
  144 + * @param[in] xml Object from which members which should be copied.
  145 + ***************************************************************************/
  146 +void GXml::copy_members(const GXml& xml)
  147 +{
  148 + // Copy attributes
  149 + m_name = xml.m_name;
  150 +
  151 + // Return
  152 + return;
  153 +}
  154 +
  155 +
  156 +/***********************************************************************//**
  157 + * @brief Delete class members
  158 + ***************************************************************************/
  159 +void GXml::free_members(void)
  160 +{
  161 + // Free memory
  162 + //if (m_par != NULL) delete [] m_par;
  163 +
  164 + // Signal free pointers
  165 + //m_par = NULL;
  166 +
  167 + // Return
  168 + return;
  169 +}
  170 +
  171 +
  172 +/*==========================================================================
  173 + = =
  174 + = Friends =
  175 + = =
  176 + ==========================================================================*/
  177 +
  178 +/***********************************************************************//**
  179 + * @brief Put object in output stream
  180 + *
  181 + * @param[in] os Output stream into which the model will be dumped
  182 + * @param[in] xml Object to be dumped
  183 + ***************************************************************************/
  184 +std::ostream& operator<< (std::ostream& os, const GXml& xml)
  185 +{
  186 + // Put object in stream
  187 + os << "=== GXml ===" << std::endl;
  188 +
  189 + // Return output stream
  190 + return os;
  191 +}
  192 +
... ...
src/xml/Makefile.am 0 โ†’ 100644
  1 +## Process this file with automake to produce Makefile.in
  2 +
  3 +# Set include directories
  4 +INCLUDES = -I$(top_srcdir)/include \
  5 + -I$(top_builddir)/src \
  6 + -I$(top_srcdir)/src/support
  7 +
  8 +# Define sources for this directory
  9 +sources = GXml.cpp
  10 +
  11 +# Build libtool library
  12 +noinst_LTLIBRARIES = libxml.la
  13 +libxml_la_SOURCES = $(sources)
  14 +libxml_la_LDFLAGS = -version-info $(GAMMALIB_LT_VERSION)
... ...