Commit 1031989f authored by louiz’'s avatar louiz’

XmlNode::add_child can also take a copy of a node

parent 45e8fe56
...@@ -178,6 +178,12 @@ XmlNode* XmlNode::add_child(XmlNode&& child) ...@@ -178,6 +178,12 @@ XmlNode* XmlNode::add_child(XmlNode&& child)
return this->add_child(std::move(new_node)); return this->add_child(std::move(new_node));
} }
XmlNode* XmlNode::add_child(const XmlNode& child)
{
auto new_node = std::make_unique<XmlNode>(child);
return this->add_child(std::move(new_node));
}
XmlNode* XmlNode::get_last_child() const XmlNode* XmlNode::get_last_child() const
{ {
return this->children.back().get(); return this->children.back().get();
......
...@@ -87,6 +87,7 @@ public: ...@@ -87,6 +87,7 @@ public:
*/ */
XmlNode* add_child(std::unique_ptr<XmlNode> child); XmlNode* add_child(std::unique_ptr<XmlNode> child);
XmlNode* add_child(XmlNode&& child); XmlNode* add_child(XmlNode&& child);
XmlNode* add_child(const XmlNode& child);
/** /**
* Returns the last of the children. If the node doesn't have any child, * Returns the last of the children. If the node doesn't have any child,
* the behaviour is undefined. The user should make sure this is the case * the behaviour is undefined. The user should make sure this is the case
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment