summaryrefslogtreecommitdiff
path: root/louloulibs/xmpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-09-18 21:56:23 +0200
committerFlorent Le Coz <louiz@louiz.org>2015-09-18 22:09:26 +0200
commit1031989fe26f219ccb4b9a602a599e30f18cb9d2 (patch)
tree4b12a10112c817b52bfff8ac94c4f3947478aaa0 /louloulibs/xmpp
parent45e8fe56a688ec03201cdfc3dfea6ae186af682d (diff)
downloadbiboumi-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/xmpp')
-rw-r--r--louloulibs/xmpp/xmpp_stanza.cpp6
-rw-r--r--louloulibs/xmpp/xmpp_stanza.hpp1
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