Style fix
Move all constructors at the top of classes
This commit is contained in:
@@ -21,6 +21,12 @@ public:
|
||||
commands{}
|
||||
{ }
|
||||
~AdhocCommandsHandler() = default;
|
||||
|
||||
AdhocCommandsHandler(const AdhocCommandsHandler&) = delete;
|
||||
AdhocCommandsHandler(AdhocCommandsHandler&&) = delete;
|
||||
AdhocCommandsHandler& operator=(const AdhocCommandsHandler&) = delete;
|
||||
AdhocCommandsHandler& operator=(AdhocCommandsHandler&&) = delete;
|
||||
|
||||
/**
|
||||
* Returns the list of available commands.
|
||||
*/
|
||||
@@ -63,11 +69,6 @@ private:
|
||||
* Of the form: {{session_id, owner_jid}, session}.
|
||||
*/
|
||||
std::map<std::pair<const std::string, const std::string>, AdhocSession> sessions;
|
||||
|
||||
AdhocCommandsHandler(const AdhocCommandsHandler&) = delete;
|
||||
AdhocCommandsHandler(AdhocCommandsHandler&&) = delete;
|
||||
AdhocCommandsHandler& operator=(const AdhocCommandsHandler&) = delete;
|
||||
AdhocCommandsHandler& operator=(AdhocCommandsHandler&&) = delete;
|
||||
};
|
||||
|
||||
#endif // ADHOC_COMMANDS_HANDLER_HPP
|
||||
|
||||
@@ -25,6 +25,12 @@ public:
|
||||
explicit AdhocSession(const AdhocCommand& command, const std::string& owner_jid,
|
||||
const std::string& to_jid);
|
||||
~AdhocSession() = default;
|
||||
|
||||
AdhocSession(const AdhocSession&) = delete;
|
||||
AdhocSession(AdhocSession&&) = delete;
|
||||
AdhocSession& operator=(const AdhocSession&) = delete;
|
||||
AdhocSession& operator=(AdhocSession&&) = delete;
|
||||
|
||||
/**
|
||||
* Return the function to be executed, found in our AdhocCommand, for the
|
||||
* current_step. And increment the current_step.
|
||||
@@ -80,12 +86,6 @@ public:
|
||||
* any key in there.
|
||||
*/
|
||||
std::map<std::string, std::string> vars;
|
||||
|
||||
private:
|
||||
AdhocSession(const AdhocSession&) = delete;
|
||||
AdhocSession(AdhocSession&&) = delete;
|
||||
AdhocSession& operator=(const AdhocSession&) = delete;
|
||||
AdhocSession& operator=(AdhocSession&&) = delete;
|
||||
};
|
||||
|
||||
#endif // ADHOC_SESSION_HPP
|
||||
|
||||
@@ -11,6 +11,11 @@ class Jid
|
||||
public:
|
||||
explicit Jid(const std::string& jid);
|
||||
|
||||
Jid(const Jid&) = delete;
|
||||
Jid(Jid&&) = delete;
|
||||
Jid& operator=(const Jid&) = delete;
|
||||
Jid& operator=(Jid&&) = delete;
|
||||
|
||||
std::string domain;
|
||||
std::string local;
|
||||
std::string resource;
|
||||
@@ -23,12 +28,6 @@ public:
|
||||
{
|
||||
return this->local + "@" + this->domain + "/" + this->resource;
|
||||
}
|
||||
|
||||
private:
|
||||
Jid(const Jid&) = delete;
|
||||
Jid(Jid&&) = delete;
|
||||
Jid& operator=(const Jid&) = delete;
|
||||
Jid& operator=(Jid&&) = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,6 +38,11 @@ public:
|
||||
explicit XmppComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret);
|
||||
virtual ~XmppComponent() = default;
|
||||
|
||||
XmppComponent(const XmppComponent&) = delete;
|
||||
XmppComponent(XmppComponent&&) = delete;
|
||||
XmppComponent& operator=(const XmppComponent&) = delete;
|
||||
XmppComponent& operator=(XmppComponent&&) = delete;
|
||||
|
||||
void on_connection_failed(const std::string& reason) override final;
|
||||
void on_connected() override final;
|
||||
void on_connection_close(const std::string& error) override final;
|
||||
@@ -231,11 +236,6 @@ protected:
|
||||
|
||||
std::unordered_map<std::string, std::function<void(const Stanza&)>> stanza_handlers;
|
||||
AdhocCommandsHandler adhoc_commands_handler;
|
||||
|
||||
XmppComponent(const XmppComponent&) = delete;
|
||||
XmppComponent(XmppComponent&&) = delete;
|
||||
XmppComponent& operator=(const XmppComponent&) = delete;
|
||||
XmppComponent& operator=(XmppComponent&&) = delete;
|
||||
};
|
||||
|
||||
#endif // XMPP_COMPONENT_INCLUDED
|
||||
|
||||
@@ -118,7 +118,7 @@ void XmppParser::end_element(const XML_Char*)
|
||||
this->stanza_event(*this->current_node);
|
||||
// Note: deleting all the children of our parent deletes ourself,
|
||||
// so current_node is an invalid pointer after this line
|
||||
this->current_node->get_parent()->delete_all_children();
|
||||
parent->delete_all_children();
|
||||
}
|
||||
this->current_node = parent;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ void XmppParser::stanza_event(const Stanza& stanza) const
|
||||
try {
|
||||
callback(stanza);
|
||||
} catch (const std::exception& e) {
|
||||
log_debug("Unhandled exception: " << e.what());
|
||||
log_error("Unhandled exception: " << e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ class XmppParser
|
||||
public:
|
||||
explicit XmppParser();
|
||||
~XmppParser();
|
||||
XmppParser(const XmppParser&) = delete;
|
||||
XmppParser& operator=(const XmppParser&) = delete;
|
||||
XmppParser(XmppParser&&) = delete;
|
||||
XmppParser& operator=(XmppParser&&) = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Init the XML parser and install the callbacks
|
||||
*/
|
||||
void init_xml_parser();
|
||||
/**
|
||||
* Feed the parser with some XML data
|
||||
*/
|
||||
@@ -98,6 +98,11 @@ public:
|
||||
void stream_close_event(const XmlNode& node) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Init the XML parser and install the callbacks
|
||||
*/
|
||||
void init_xml_parser();
|
||||
|
||||
/**
|
||||
* Expat structure.
|
||||
*/
|
||||
@@ -123,9 +128,6 @@ private:
|
||||
std::vector<std::function<void(const Stanza&)>> stanza_callbacks;
|
||||
std::vector<std::function<void(const XmlNode&)>> stream_open_callbacks;
|
||||
std::vector<std::function<void(const XmlNode&)>> stream_close_callbacks;
|
||||
|
||||
XmppParser(const XmppParser&) = delete;
|
||||
XmppParser& operator=(const XmppParser&) = delete;
|
||||
};
|
||||
|
||||
#endif // XMPP_PARSER_INCLUDED
|
||||
|
||||
@@ -25,7 +25,6 @@ class XmlNode
|
||||
public:
|
||||
explicit XmlNode(const std::string& name, XmlNode* parent);
|
||||
explicit XmlNode(const std::string& name);
|
||||
XmlNode(XmlNode&& node) = default;
|
||||
/**
|
||||
* The copy constructor does not copy the parent attribute. The children
|
||||
* nodes are all copied recursively.
|
||||
@@ -42,6 +41,10 @@ public:
|
||||
this->add_child(std::make_unique<XmlNode>(*child));
|
||||
}
|
||||
|
||||
XmlNode(XmlNode&& node) = default;
|
||||
XmlNode& operator=(const XmlNode&) = delete;
|
||||
XmlNode& operator=(XmlNode&&) = delete;
|
||||
|
||||
~XmlNode() = default;
|
||||
|
||||
void delete_all_children();
|
||||
@@ -129,9 +132,6 @@ private:
|
||||
std::vector<std::unique_ptr<XmlNode>> children;
|
||||
std::string inner;
|
||||
std::string tail;
|
||||
|
||||
XmlNode& operator=(const XmlNode&) = delete;
|
||||
XmlNode& operator=(XmlNode&&) = delete;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const XmlNode& node);
|
||||
|
||||
Reference in New Issue
Block a user