aboutsummaryrefslogtreecommitdiff
path: root/src/xml/XmlNode.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-03-04 20:07:50 +0800
committercrupest <crupest@outlook.com>2022-03-04 20:07:50 +0800
commit14e1b0f188d302b69816ddf12f5ac591fd76b91d (patch)
tree8481328cfa20a43b67abd5455c2e34fd42639e0b /src/xml/XmlNode.cpp
parent57353bd3acd97957cb5f970016fec52977cc6e95 (diff)
downloadcru-14e1b0f188d302b69816ddf12f5ac591fd76b91d.tar.gz
cru-14e1b0f188d302b69816ddf12f5ac591fd76b91d.tar.bz2
cru-14e1b0f188d302b69816ddf12f5ac591fd76b91d.zip
...
Diffstat (limited to 'src/xml/XmlNode.cpp')
-rw-r--r--src/xml/XmlNode.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/xml/XmlNode.cpp b/src/xml/XmlNode.cpp
index cfa87dd6..41bbed4d 100644
--- a/src/xml/XmlNode.cpp
+++ b/src/xml/XmlNode.cpp
@@ -9,6 +9,10 @@ XmlElementNode* XmlNode::AsElement() {
XmlTextNode* XmlNode::AsText() { return static_cast<XmlTextNode*>(this); }
+XmlCommentNode* XmlNode::AsComment() {
+ return static_cast<XmlCommentNode*>(this);
+}
+
const XmlElementNode* XmlNode::AsElement() const {
return static_cast<const XmlElementNode*>(this);
}
@@ -17,6 +21,10 @@ const XmlTextNode* XmlNode::AsText() const {
return static_cast<const XmlTextNode*>(this);
}
+const XmlCommentNode* XmlNode::AsComment() const {
+ return static_cast<const XmlCommentNode*>(this);
+}
+
XmlElementNode::~XmlElementNode() {
for (auto child : children_) {
delete child;
@@ -57,4 +65,12 @@ XmlNode* XmlElementNode::Clone() const {
return node;
}
+
+XmlCommentNode::~XmlCommentNode() {}
+
+XmlNode* XmlCommentNode::Clone() const {
+ XmlCommentNode* node = new XmlCommentNode(text_);
+
+ return node;
+}
} // namespace cru::xml