diff options
author | Florent Le Coz <louiz@louiz.org> | 2015-09-18 21:56:23 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2015-09-18 22:09:26 +0200 |
commit | 1031989fe26f219ccb4b9a602a599e30f18cb9d2 (patch) | |
tree | 4b12a10112c817b52bfff8ac94c4f3947478aaa0 /louloulibs | |
parent | 45e8fe56a688ec03201cdfc3dfea6ae186af682d (diff) | |
download | biboumi-1031989fe26f219ccb4b9a602a599e30f18cb9d2.tar.gz biboumi-1031989fe26f219ccb4b9a602a599e30f18cb9d2.tar.bz2 biboumi-1031989fe26f219ccb4b9a602a599e30f18cb9d2.tar.xz biboumi-1031989fe26f219ccb4b9a602a599e30f18cb9d2.zip |
XmlNode::add_child can also take a copy of a node
Diffstat (limited to 'louloulibs')
-rw-r--r-- | louloulibs/xmpp/xmpp_stanza.cpp | 6 | ||||
-rw-r--r-- | louloulibs/xmpp/xmpp_stanza.hpp | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/louloulibs/xmpp/xmpp_stanza.cpp b/louloulibs/xmpp/xmpp_stanza.cpp index 3ba8483..4c0f5c7 100644 --- a/louloulibs/xmpp/xmpp_stanza.cpp +++ b/louloulibs/xmpp/xmpp_stanza.cpp @@ -178,6 +178,12 @@ XmlNode* XmlNode::add_child(XmlNode&& child) 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 { return this->children.back().get(); diff --git a/louloulibs/xmpp/xmpp_stanza.hpp b/louloulibs/xmpp/xmpp_stanza.hpp index 4a54379..9cf7d8d 100644 --- a/louloulibs/xmpp/xmpp_stanza.hpp +++ b/louloulibs/xmpp/xmpp_stanza.hpp @@ -87,6 +87,7 @@ public: */ XmlNode* add_child(std::unique_ptr<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, * the behaviour is undefined. The user should make sure this is the case |