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
***************************************************************************/
44
class
GXmlComment
:
public
GXmlNode
{
45
46
public
:
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
69
protected
:
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
***************************************************************************/
86
inline
87
std::string
GXmlComment::classname
(
void
)
const
88
{
89
return
(
"GXmlComment"
);
90
}
91
92
93
/***********************************************************************/
/**
94
* @brief Return comment
95
*
96
* @return Comment string.
97
***************************************************************************/
98
inline
99
const
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
***************************************************************************/
110
inline
111
void
GXmlComment::comment
(
const
std::string& comment)
112
{
113
m_comment
=
comment
;
114
return
;
115
}
116
117
118
/***********************************************************************/
/**
119
* @brief Return XML node type
120
*
121
* @return XML node type (NT_COMMENT).
122
***************************************************************************/
123
inline
124
GXmlNode::NodeType
GXmlComment::type
(
void
)
const
125
{
126
return
(
NT_COMMENT
);
127
}
128
129
#endif
/* GXMLCOMMENT_HPP */
GChatter
GChatter
Definition
GTypemaps.hpp:33
NORMAL
@ NORMAL
Definition
GTypemaps.hpp:36
GUrl.hpp
Abstract URL base class interface definition.
GXmlNode.hpp
Abstract XML node base class interface definition.
GUrl
Abstract URL base class.
Definition
GUrl.hpp:44
GXmlComment
XML comment node class.
Definition
GXmlComment.hpp:44
GXmlComment::type
virtual NodeType type(void) const
Return XML node type.
Definition
GXmlComment.hpp:124
GXmlComment::~GXmlComment
virtual ~GXmlComment(void)
Destructor.
Definition
GXmlComment.cpp:105
GXmlComment::init_members
void init_members(void)
Initialise class members.
Definition
GXmlComment.cpp:250
GXmlComment::free_members
void free_members(void)
Delete class members.
Definition
GXmlComment.cpp:278
GXmlComment::write
virtual void write(GUrl &url, const int &indent=0) const
Write comment into URL.
Definition
GXmlComment.cpp:197
GXmlComment::m_comment
std::string m_comment
Comment (excluding brackets)
Definition
GXmlComment.hpp:77
GXmlComment::GXmlComment
GXmlComment(void)
Void constructor.
Definition
GXmlComment.cpp:54
GXmlComment::parse
void parse(const std::string &segment)
Parse comment segment string.
Definition
GXmlComment.cpp:297
GXmlComment::operator=
GXmlComment & operator=(const GXmlComment &node)
Assignment operator.
Definition
GXmlComment.cpp:127
GXmlComment::classname
virtual std::string classname(void) const
Return class name.
Definition
GXmlComment.hpp:87
GXmlComment::clone
virtual GXmlComment * clone(void) const
Clone XML comment.
Definition
GXmlComment.cpp:182
GXmlComment::print
virtual std::string print(const GChatter &chatter=NORMAL, const int &indent=0) const
Print XML comment.
Definition
GXmlComment.cpp:219
GXmlComment::copy_members
void copy_members(const GXmlComment &node)
Copy class members.
Definition
GXmlComment.cpp:265
GXmlComment::clear
virtual void clear(void)
Clear XML comment.
Definition
GXmlComment.cpp:162
GXmlComment::comment
const std::string & comment(void) const
Return comment.
Definition
GXmlComment.hpp:99
GXmlNode
Abstract XML node base class.
Definition
GXmlNode.hpp:57
GXmlNode::NodeType
NodeType
Definition
GXmlNode.hpp:71
GXmlNode::NT_COMMENT
@ NT_COMMENT
Definition
GXmlNode.hpp:74
include
GXmlComment.hpp
Generated on Tue Jan 14 2025 15:02:55 for GammaLib by
1.11.0