The Power in your Hands
Search Site:
About
Features
Documentation
Download
Community
Main
Classes
Namespaces
Modules
include
Pt
Xml
Comment.h
1
/*
2
* Copyright (C) 2012 Marc Boris Duerner
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* As a special exception, you may use this file as part of a free
10
* software library without restriction. Specifically, if other files
11
* instantiate templates or use macros or inline functions from this
12
* file, or you compile this file and link it with other files to
13
* produce an executable, this file does not by itself cause the
14
* resulting executable to be covered by the GNU General Public
15
* License. This exception does not however invalidate any other
16
* reasons why the executable file might be covered by the GNU Library
17
* General Public License.
18
*
19
* This library is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
* Lesser General Public License for more details.
23
*
24
* You should have received a copy of the GNU Lesser General Public
25
* License along with this library; if not, write to the Free Software
26
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27
*/
28
29
#ifndef Pt_Xml_Comment_h
30
#define Pt_Xml_Comment_h
31
32
#include <Pt/Xml/Api.h>
33
#include <Pt/Xml/Node.h>
34
#include <Pt/String.h>
35
36
namespace
Pt {
37
38
namespace
Xml {
39
44
class
Comment
:
public
Node
45
{
46
public
:
49
explicit
Comment
()
50
:
Node
(
Node
::
Comment
)
51
, _content()
52
{ }
53
56
bool
empty
()
const
57
{
return
_content.
empty
(); }
58
61
void
clear
()
62
{ _content.
clear
(); }
63
66
String
&
content
()
67
{
return
_content; }
68
71
const
String
&
content
()
const
72
{
return
_content; }
73
76
void
setContent
(
const
String
& text)
77
{ _content = text; }
78
80
inline
static
const
Node::Type nodeId()
81
{
return
Node::Comment; }
82
83
private
:
84
String
_content;
85
};
86
91
inline
Comment
*
toComment
(
Node
* node)
92
{
93
return
nodeCast<Comment>(node);
94
}
95
100
inline
const
Comment
*
toComment
(
const
Node
* node)
101
{
102
return
nodeCast<Comment>(node);
103
}
104
109
inline
Comment
&
toComment
(
Node
& node)
110
{
111
return
nodeCast<Comment>(node);
112
}
113
118
inline
const
Comment
&
toComment
(
const
Node
& node)
119
{
120
return
nodeCast<Comment>(node);
121
}
122
123
}
// namespace Xml
124
125
}
// namespace Pt
126
127
#endif // Pt_Xml_Comment_h
Pt::Xml::Comment::Comment
Comment()
Constructs an empty Comment node.
Definition:
Comment.h:49
Pt::String::clear
void clear()
Clears the string.
Definition:
String.h:367
Pt::Xml::Comment::toComment
Comment * toComment(Node *node)
Casts a generic node to a Comment node.
Definition:
Comment.h:91
Pt::Xml::Comment::clear
void clear()
Clears all content.
Definition:
Comment.h:61
Pt::Xml::Comment::empty
bool empty() const
Returns true if is empty.
Definition:
Comment.h:56
Pt::Xml::Comment::toComment
Comment & toComment(Node &node)
Casts a generic node to a Comment node.
Definition:
Comment.h:109
Pt::String::empty
bool empty() const
Returns true if empty.
Definition:
String.h:244
Pt::Xml::Comment::content
String & content()
Returns the text of the comment.
Definition:
Comment.h:66
Pt::Xml::Comment::toComment
const Comment * toComment(const Node *node)
Casts a generic node to a Comment node.
Definition:
Comment.h:100
Pt::Xml::Comment::setContent
void setContent(const String &text)
Sets the text of the comment.
Definition:
Comment.h:76
Pt::String
Unicode capable basic_string.
Definition:
String.h:42
Pt::Xml::Comment
A Comment node represents a comment in an XML document.
Definition:
Comment.h:44
Pt::Xml::Comment::content
const String & content() const
Returns the text of the comment.
Definition:
Comment.h:71
Pt::Xml::Node
XML document node.
Definition:
Node.h:50
Pt::Xml::Comment::toComment
const Comment & toComment(const Node &node)
Casts a generic node to a Comment node.
Definition:
Comment.h:118