diff --git a/include/GXmlAttribute.hpp b/include/GXmlAttribute.hpp new file mode 100644 index 0000000..6a7a155 --- /dev/null +++ b/include/GXmlAttribute.hpp @@ -0,0 +1,67 @@ +/*************************************************************************** + * GXmlAttribute.hpp - XML attribute node 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 GXmlAttribute.hpp + * @brief XML attribute node class definition + * @author J. Knodlseder + */ + +#ifndef GXMLATTRIBUTE_HPP +#define GXMLATTRIBUTE_HPP + +/* __ Includes ___________________________________________________________ */ +#include + + +/***********************************************************************//** + * @class GXmlAttribute + * + * @brief XML attribute node class interface defintion. + * + * This class implements the attribute of an XML elements. An attribute + * consists of a name-value pair. Note that the hyphens are stored for the + * attribute value. Allowed hyphens are " and '. + ***************************************************************************/ +class GXmlAttribute { + +public: + // Constructors and destructors + GXmlAttribute(void); + GXmlAttribute(const GXmlAttribute& attr); + GXmlAttribute(const std::string& name, const std::string& value); + ~GXmlAttribute(void); + + // Operators + GXmlAttribute& operator= (const GXmlAttribute& attr); + + // Methods + void clear(void); + void print(std::ostream& os) const; + std::string name(void) const { return m_name; } + std::string value(void) const { return m_value; } + void name(const std::string& name) { m_name=name; } + void value(const std::string& value) { m_value=value; } + +protected: + // Protected methods + void init_members(void); + void copy_members(const GXmlAttribute& attr); + void free_members(void); + GXmlAttribute* GXmlAttribute::clone(void) const; + + // Protected data members + std::string m_name; //!< Attribute name + std::string m_value; //!< Attribute value +}; + +#endif /* GXMLATTRIBUTE_HPP */ diff --git a/include/GXmlComment.hpp b/include/GXmlComment.hpp new file mode 100644 index 0000000..85b8dba --- /dev/null +++ b/include/GXmlComment.hpp @@ -0,0 +1,67 @@ +/*************************************************************************** + * GXmlComment.hpp - XML comment node 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 GXmlComment.hpp + * @brief XML comment node class definition + * @author J. Knodlseder + */ + +#ifndef GXMLCOMMENT_HPP +#define GXMLCOMMENT_HPP + +/* __ Includes ___________________________________________________________ */ +#include +#include +#include "GXmlNode.hpp" + + +/***********************************************************************//** + * @class GXmlComment + * + * @brief XML comment node class interface defintion. + * + * This class implements a XML comment. The comment text is stored without + * the brackets. + ***************************************************************************/ +class GXmlComment : public GXmlNode { + +public: + // Constructors and destructors + GXmlComment(void); + GXmlComment(const GXmlComment& node); + GXmlComment(const std::string& segment); + ~GXmlComment(void); + + // Operators + GXmlComment& operator= (const GXmlComment& node); + + // Methods + void clear(void); + void print(std::ostream& os, int indent = 0) const; + NodeType type(void) const { return NT_COMMENT; } + +protected: + // Protected methods + void init_members(void); + void copy_members(const GXmlComment& node); + void free_members(void); + GXmlComment* GXmlComment::clone(void) const; + void parse(const std::string& segment); + std::string comment(void) const { return m_comment; } + void comment(const std::string& comment) { m_comment=comment; } + + // Protected data members + std::string m_comment; //!< Comment (excluding brackets) +}; + +#endif /* GXMLCOMMENT_HPP */