blob: d62039738235ad5ae6b26410b9b013e61a799842 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "cru/xml/XmlNode.hpp"
namespace cru::xml {
XmlElementNode::~XmlElementNode() {
for (auto child : children_) {
delete child;
}
}
void XmlElementNode::AddAttribute(String key, String value) {
attributes_[std::move(key)] = std::move(value);
}
void XmlElementNode::AddChild(XmlNode* child) {
assert(child->GetParent() == nullptr);
children_.push_back(child);
child->parent_ = this;
}
XmlNode* XmlElementNode::Clone() const {
XmlElementNode* node = new XmlElementNode(tag_, attributes_);
for (auto child : children_) {
node->AddChild(child->Clone());
}
return node;
}
} // namespace cru::xml
|