summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-05-30 03:51:54 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-05-30 04:00:23 +0200
commit6bde78b5743d6b323b9af14d434927fd175175c3 (patch)
treeb72e10a690d81a8a11babc71c853789f5ae8eca3 /src/xmpp
parenteb9a20187098185cc10ad192e91a90dbba12633a (diff)
downloadbiboumi-6bde78b5743d6b323b9af14d434927fd175175c3.tar.gz
biboumi-6bde78b5743d6b323b9af14d434927fd175175c3.tar.bz2
biboumi-6bde78b5743d6b323b9af14d434927fd175175c3.tar.xz
biboumi-6bde78b5743d6b323b9af14d434927fd175175c3.zip
XmlNode’s copy constructor now recursively copies the children nodes as well
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/xmpp_stanza.hpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/xmpp/xmpp_stanza.hpp b/src/xmpp/xmpp_stanza.hpp
index e55d555..53e0139 100644
--- a/src/xmpp/xmpp_stanza.hpp
+++ b/src/xmpp/xmpp_stanza.hpp
@@ -35,9 +35,8 @@ public:
node.parent = nullptr;
}
/**
- * The copy constructor do not copy the children or parent attributes. The
- * copied node is identical to the original except that it is not attached
- * to any other node.
+ * The copy constructor do not copy the parent attribute. The children
+ * nodes are all copied recursively.
*/
XmlNode(const XmlNode& node):
name(node.name),
@@ -48,6 +47,11 @@ public:
inner(node.inner),
tail(node.tail)
{
+ for (XmlNode* child: node.children)
+ {
+ XmlNode* child_copy = new XmlNode(*child);
+ this->add_child(child_copy);
+ }
}
~XmlNode();