~singpolyma/biboumi

1031989fe26f219ccb4b9a602a599e30f18cb9d2 — Florent Le Coz 8 years ago 45e8fe5
XmlNode::add_child can also take a copy of a node
2 files changed, 7 insertions(+), 0 deletions(-)

M louloulibs/xmpp/xmpp_stanza.cpp
M louloulibs/xmpp/xmpp_stanza.hpp
M louloulibs/xmpp/xmpp_stanza.cpp => louloulibs/xmpp/xmpp_stanza.cpp +6 -0
@@ 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();

M louloulibs/xmpp/xmpp_stanza.hpp => louloulibs/xmpp/xmpp_stanza.hpp +1 -0
@@ 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