Commit 4a66da4c2c53b8cd4e2fa3700789f05189bcc3de

Authored by knodlseder
1 parent 6db41935

initial version

include/GXmlAttribute.hpp 0 → 100644
  1 +/***************************************************************************
  2 + * GXmlAttribute.hpp - XML attribute node 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 GXmlAttribute.hpp
  15 + * @brief XML attribute node class definition
  16 + * @author J. Knodlseder
  17 + */
  18 +
  19 +#ifndef GXMLATTRIBUTE_HPP
  20 +#define GXMLATTRIBUTE_HPP
  21 +
  22 +/* __ Includes ___________________________________________________________ */
  23 +#include <string>
  24 +
  25 +
  26 +/***********************************************************************//**
  27 + * @class GXmlAttribute
  28 + *
  29 + * @brief XML attribute node class interface defintion.
  30 + *
  31 + * This class implements the attribute of an XML elements. An attribute
  32 + * consists of a name-value pair. Note that the hyphens are stored for the
  33 + * attribute value. Allowed hyphens are " and '.
  34 + ***************************************************************************/
  35 +class GXmlAttribute {
  36 +
  37 +public:
  38 + // Constructors and destructors
  39 + GXmlAttribute(void);
  40 + GXmlAttribute(const GXmlAttribute& attr);
  41 + GXmlAttribute(const std::string& name, const std::string& value);
  42 + ~GXmlAttribute(void);
  43 +
  44 + // Operators
  45 + GXmlAttribute& operator= (const GXmlAttribute& attr);
  46 +
  47 + // Methods
  48 + void clear(void);
  49 + void print(std::ostream& os) const;
  50 + std::string name(void) const { return m_name; }
  51 + std::string value(void) const { return m_value; }
  52 + void name(const std::string& name) { m_name=name; }
  53 + void value(const std::string& value) { m_value=value; }
  54 +
  55 +protected:
  56 + // Protected methods
  57 + void init_members(void);
  58 + void copy_members(const GXmlAttribute& attr);
  59 + void free_members(void);
  60 + GXmlAttribute* GXmlAttribute::clone(void) const;
  61 +
  62 + // Protected data members
  63 + std::string m_name; //!< Attribute name
  64 + std::string m_value; //!< Attribute value
  65 +};
  66 +
  67 +#endif /* GXMLATTRIBUTE_HPP */
... ...
include/GXmlComment.hpp 0 → 100644
  1 +/***************************************************************************
  2 + * GXmlComment.hpp - XML comment node 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 GXmlComment.hpp
  15 + * @brief XML comment node class definition
  16 + * @author J. Knodlseder
  17 + */
  18 +
  19 +#ifndef GXMLCOMMENT_HPP
  20 +#define GXMLCOMMENT_HPP
  21 +
  22 +/* __ Includes ___________________________________________________________ */
  23 +#include <string>
  24 +#include <iostream>
  25 +#include "GXmlNode.hpp"
  26 +
  27 +
  28 +/***********************************************************************//**
  29 + * @class GXmlComment
  30 + *
  31 + * @brief XML comment node class interface defintion.
  32 + *
  33 + * This class implements a XML comment. The comment text is stored without
  34 + * the <!-- --> brackets.
  35 + ***************************************************************************/
  36 +class GXmlComment : public GXmlNode {
  37 +
  38 +public:
  39 + // Constructors and destructors
  40 + GXmlComment(void);
  41 + GXmlComment(const GXmlComment& node);
  42 + GXmlComment(const std::string& segment);
  43 + ~GXmlComment(void);
  44 +
  45 + // Operators
  46 + GXmlComment& operator= (const GXmlComment& node);
  47 +
  48 + // Methods
  49 + void clear(void);
  50 + void print(std::ostream& os, int indent = 0) const;
  51 + NodeType type(void) const { return NT_COMMENT; }
  52 +
  53 +protected:
  54 + // Protected methods
  55 + void init_members(void);
  56 + void copy_members(const GXmlComment& node);
  57 + void free_members(void);
  58 + GXmlComment* GXmlComment::clone(void) const;
  59 + void parse(const std::string& segment);
  60 + std::string comment(void) const { return m_comment; }
  61 + void comment(const std::string& comment) { m_comment=comment; }
  62 +
  63 + // Protected data members
  64 + std::string m_comment; //!< Comment (excluding brackets)
  65 +};
  66 +
  67 +#endif /* GXMLCOMMENT_HPP */
... ...