From eb9a20187098185cc10ad192e91a90dbba12633a Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 27 May 2014 01:01:38 +0200 Subject: Implement the support for adhoc commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have two basic example commands. But it’s not entirely finished because there are some error checks that we don’t do. ref #2521 --- src/xmpp/xmpp_stanza.hpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/xmpp/xmpp_stanza.hpp') diff --git a/src/xmpp/xmpp_stanza.hpp b/src/xmpp/xmpp_stanza.hpp index cc8d53a..e55d555 100644 --- a/src/xmpp/xmpp_stanza.hpp +++ b/src/xmpp/xmpp_stanza.hpp @@ -34,6 +34,21 @@ 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. + */ + XmlNode(const XmlNode& node): + name(node.name), + parent(nullptr), + closed(node.closed), + attributes(node.attributes), + children{}, + inner(node.inner), + tail(node.tail) + { + } ~XmlNode(); @@ -103,6 +118,11 @@ public: * node as no such attribute. */ const std::string get_tag(const std::string& name) const; + /** + * Remove the attribute of the node. Does nothing if that attribute is not + * present. Returns true if the tag was removed, false if it was absent. + */ + bool del_tag(const std::string& name); /** * Use this to set an attribute's value, like node["id"] = "12"; */ @@ -117,7 +137,6 @@ private: std::string inner; std::string tail; - XmlNode(const XmlNode&) = delete; XmlNode& operator=(const XmlNode&) = delete; XmlNode& operator=(XmlNode&&) = delete; }; -- cgit v1.2.3