GammaLib 2.0.0
Loading...
Searching...
No Matches
GXmlComment.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GXmlComment.hpp - XML comment node class definition *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2010-2014 by Juergen Knoedlseder *
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 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21/**
22 * @file GXmlComment.hpp
23 * @brief XML comment node class interface definition
24 * @author Juergen Knodlseder
25 */
26
27#ifndef GXMLCOMMENT_HPP
28#define GXMLCOMMENT_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GUrl.hpp"
33#include "GXmlNode.hpp"
34
35
36/***********************************************************************//**
37 * @class GXmlComment
38 *
39 * @brief XML comment node class
40 *
41 * This class implements a XML comment. The comment text is stored without
42 * the <!-- --> brackets.
43 ***************************************************************************/
44class GXmlComment : public GXmlNode {
45
46public:
47 // Constructors and destructors
48 GXmlComment(void);
49 GXmlComment(const GXmlComment& node);
50 explicit GXmlComment(const std::string& segment);
51 virtual ~GXmlComment(void);
52
53 // Operators
54 GXmlComment& operator=(const GXmlComment& node);
55
56 // Implemented pure virtual base class methods
57 virtual void clear(void);
58 virtual GXmlComment* clone(void) const;
59 virtual std::string classname(void) const;
60 virtual void write(GUrl& url, const int& indent = 0) const;
61 virtual NodeType type(void) const;
62 virtual std::string print(const GChatter& chatter = NORMAL,
63 const int& indent = 0) const;
64
65 // Other methods
66 const std::string& comment(void) const;
67 void comment(const std::string& comment);
68
69protected:
70 // Protected methods
71 void init_members(void);
72 void copy_members(const GXmlComment& node);
73 void free_members(void);
74 void parse(const std::string& segment);
75
76 // Protected data members
77 std::string m_comment; //!< Comment (excluding brackets)
78};
79
80
81/***********************************************************************//**
82 * @brief Return class name
83 *
84 * @return String containing the class name ("GXmlComment").
85 ***************************************************************************/
86inline
87std::string GXmlComment::classname(void) const
88{
89 return ("GXmlComment");
90}
91
92
93/***********************************************************************//**
94 * @brief Return comment
95 *
96 * @return Comment string.
97 ***************************************************************************/
98inline
99const std::string& GXmlComment::comment(void) const
100{
101 return (m_comment);
102}
103
104
105/***********************************************************************//**
106 * @brief Set comment
107 *
108 * @param[in] comment Comment string.
109 ***************************************************************************/
110inline
111void GXmlComment::comment(const std::string& comment)
112{
114 return;
115}
116
117
118/***********************************************************************//**
119 * @brief Return XML node type
120 *
121 * @return XML node type (NT_COMMENT).
122 ***************************************************************************/
123inline
125{
126 return (NT_COMMENT);
127}
128
129#endif /* GXMLCOMMENT_HPP */
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Abstract URL base class interface definition.
Abstract XML node base class interface definition.
Abstract URL base class.
Definition GUrl.hpp:44
XML comment node class.
virtual NodeType type(void) const
Return XML node type.
virtual ~GXmlComment(void)
Destructor.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
virtual void write(GUrl &url, const int &indent=0) const
Write comment into URL.
std::string m_comment
Comment (excluding brackets)
GXmlComment(void)
Void constructor.
void parse(const std::string &segment)
Parse comment segment string.
GXmlComment & operator=(const GXmlComment &node)
Assignment operator.
virtual std::string classname(void) const
Return class name.
virtual GXmlComment * clone(void) const
Clone XML comment.
virtual std::string print(const GChatter &chatter=NORMAL, const int &indent=0) const
Print XML comment.
void copy_members(const GXmlComment &node)
Copy class members.
virtual void clear(void)
Clear XML comment.
const std::string & comment(void) const
Return comment.
Abstract XML node base class.
Definition GXmlNode.hpp:57