Style fix

Move all constructors at the top of classes
This commit is contained in:
louiz’
2016-05-04 14:16:40 +02:00
parent 305e01c0b5
commit af42073830
33 changed files with 157 additions and 174 deletions
+7 -6
View File
@@ -28,8 +28,13 @@ typedef std::function<void()> t_config_changed_callback;
class Config class Config
{ {
public: public:
Config(){}; Config() = default;
~Config(){}; ~Config() = default;
Config(const Config&) = delete;
Config& operator=(const Config&) = delete;
Config(Config&&) = delete;
Config& operator=(Config&&) = delete;
/** /**
* returns a value from the config. If it doesn’t exist, use * returns a value from the config. If it doesn’t exist, use
* the second argument as the default. * the second argument as the default.
@@ -88,10 +93,6 @@ private:
std::map<std::string, std::string> values; std::map<std::string, std::string> values;
std::vector<t_config_changed_callback> callbacks; std::vector<t_config_changed_callback> callbacks;
Config(const Config&) = delete;
Config& operator=(const Config&) = delete;
Config(Config&&) = delete;
Config& operator=(Config&&) = delete;
}; };
#endif // CONFIG_INCLUDED #endif // CONFIG_INCLUDED
+5 -3
View File
@@ -67,10 +67,12 @@ public:
Logger(const int log_level, const std::string& log_file); Logger(const int log_level, const std::string& log_file);
Logger(const int log_level); Logger(const int log_level);
private: Logger(const Logger&) = delete;
Logger(const Logger&); Logger& operator=(const Logger&) = delete;
Logger& operator=(const Logger&); Logger(Logger&&) = delete;
Logger& operator=(Logger&&) = delete;
private:
const int log_level; const int log_level;
std::ofstream ofstream; std::ofstream ofstream;
nullstream null_stream; nullstream null_stream;
@@ -14,6 +14,12 @@ class BasicCredentialsManager: public Botan::Credentials_Manager
{ {
public: public:
BasicCredentialsManager(const TCPSocketHandler* const socket_handler); BasicCredentialsManager(const TCPSocketHandler* const socket_handler);
BasicCredentialsManager(BasicCredentialsManager&&) = delete;
BasicCredentialsManager(const BasicCredentialsManager&) = delete;
BasicCredentialsManager& operator=(const BasicCredentialsManager&) = delete;
BasicCredentialsManager& operator=(BasicCredentialsManager&&) = delete;
void verify_certificate_chain(const std::string& type, void verify_certificate_chain(const std::string& type,
const std::string& purported_hostname, const std::string& purported_hostname,
const std::vector<Botan::X509_Certificate>&) override final; const std::vector<Botan::X509_Certificate>&) override final;
+3 -1
View File
@@ -13,7 +13,9 @@
DNSHandler DNSHandler::instance; DNSHandler DNSHandler::instance;
using namespace std::string_literals; using namespace std::string_literals;
DNSHandler::DNSHandler() DNSHandler::DNSHandler():
socket_handlers{},
channel{nullptr}
{ {
int ares_error; int ares_error;
if ((ares_error = ::ares_library_init(ARES_LIB_INIT_ALL)) != 0) if ((ares_error = ::ares_library_init(ARES_LIB_INIT_ALL)) != 0)
+5 -5
View File
@@ -24,6 +24,11 @@ class DNSHandler
public: public:
DNSHandler(); DNSHandler();
~DNSHandler() = default; ~DNSHandler() = default;
DNSHandler(const DNSHandler&) = delete;
DNSHandler(DNSHandler&&) = delete;
DNSHandler& operator=(const DNSHandler&) = delete;
DNSHandler& operator=(DNSHandler&&) = delete;
void gethostbyname(const std::string& name, ares_host_callback callback, void gethostbyname(const std::string& name, ares_host_callback callback,
void* socket_handler, int family); void* socket_handler, int family);
/** /**
@@ -48,11 +53,6 @@ private:
*/ */
std::vector<std::unique_ptr<DNSSocketHandler>> socket_handlers; std::vector<std::unique_ptr<DNSSocketHandler>> socket_handlers;
ares_channel channel; ares_channel channel;
DNSHandler(const DNSHandler&) = delete;
DNSHandler(DNSHandler&&) = delete;
DNSHandler& operator=(const DNSHandler&) = delete;
DNSHandler& operator=(DNSHandler&&) = delete;
}; };
#endif /* CARES_FOUND */ #endif /* CARES_FOUND */
@@ -13,10 +13,6 @@ DNSSocketHandler::DNSSocketHandler(std::shared_ptr<Poller> poller,
{ {
} }
DNSSocketHandler::~DNSSocketHandler()
{
}
void DNSSocketHandler::connect() void DNSSocketHandler::connect()
{ {
} }
+6 -5
View File
@@ -18,7 +18,12 @@ class DNSSocketHandler: public SocketHandler
{ {
public: public:
explicit DNSSocketHandler(std::shared_ptr<Poller> poller, const socket_t socket); explicit DNSSocketHandler(std::shared_ptr<Poller> poller, const socket_t socket);
~DNSSocketHandler(); ~DNSSocketHandler() = default;
DNSSocketHandler(const DNSSocketHandler&) = delete;
DNSSocketHandler(DNSSocketHandler&&) = delete;
DNSSocketHandler& operator=(const DNSSocketHandler&) = delete;
DNSSocketHandler& operator=(DNSSocketHandler&&) = delete;
/** /**
* Just call dns_process_fd, c-ares will do its work of send()ing or * Just call dns_process_fd, c-ares will do its work of send()ing or
* recv()ing the data it wants on that socket. * recv()ing the data it wants on that socket.
@@ -36,10 +41,6 @@ public:
bool is_connected() const override final; bool is_connected() const override final;
private: private:
DNSSocketHandler(const DNSSocketHandler&) = delete;
DNSSocketHandler(DNSSocketHandler&&) = delete;
DNSSocketHandler& operator=(const DNSSocketHandler&) = delete;
DNSSocketHandler& operator=(DNSSocketHandler&&) = delete;
}; };
#endif // CARES_FOUND #endif // CARES_FOUND
+4 -5
View File
@@ -38,6 +38,10 @@ class Poller
public: public:
explicit Poller(); explicit Poller();
~Poller(); ~Poller();
Poller(const Poller&) = delete;
Poller(Poller&&) = delete;
Poller& operator=(const Poller&) = delete;
Poller& operator=(Poller&&) = delete;
/** /**
* Add a SocketHandler to be monitored by this Poller. All receive events * Add a SocketHandler to be monitored by this Poller. All receive events
* are always automatically watched. * are always automatically watched.
@@ -85,11 +89,6 @@ private:
#elif POLLER == EPOLL #elif POLLER == EPOLL
int epfd; int epfd;
#endif #endif
Poller(const Poller&) = delete;
Poller(Poller&&) = delete;
Poller& operator=(const Poller&) = delete;
Poller& operator=(Poller&&) = delete;
}; };
#endif // POLLER_INCLUDED #endif // POLLER_INCLUDED
+4 -5
View File
@@ -37,6 +37,10 @@ public:
Resolver(); Resolver();
~Resolver() = default; ~Resolver() = default;
Resolver(const Resolver&) = delete;
Resolver(Resolver&&) = delete;
Resolver& operator=(const Resolver&) = delete;
Resolver& operator=(Resolver&&) = delete;
bool is_resolving() const bool is_resolving() const
{ {
@@ -117,11 +121,6 @@ private:
ErrorCallbackType error_cb; ErrorCallbackType error_cb;
SuccessCallbackType success_cb; SuccessCallbackType success_cb;
Resolver(const Resolver&) = delete;
Resolver(Resolver&&) = delete;
Resolver& operator=(const Resolver&) = delete;
Resolver& operator=(Resolver&&) = delete;
}; };
std::string addr_to_string(const struct addrinfo* rp); std::string addr_to_string(const struct addrinfo* rp);
+5 -6
View File
@@ -16,6 +16,11 @@ public:
socket(socket) socket(socket)
{} {}
virtual ~SocketHandler() {} virtual ~SocketHandler() {}
SocketHandler(const SocketHandler&) = delete;
SocketHandler(SocketHandler&&) = delete;
SocketHandler& operator=(const SocketHandler&) = delete;
SocketHandler& operator=(SocketHandler&&) = delete;
virtual void on_recv() = 0; virtual void on_recv() = 0;
virtual void on_send() = 0; virtual void on_send() = 0;
virtual void connect() = 0; virtual void connect() = 0;
@@ -34,12 +39,6 @@ protected:
* The handled socket. * The handled socket.
*/ */
socket_t socket; socket_t socket;
private:
SocketHandler(const SocketHandler&) = delete;
SocketHandler(SocketHandler&&) = delete;
SocketHandler& operator=(const SocketHandler&) = delete;
SocketHandler& operator=(SocketHandler&&) = delete;
}; };
#endif // SOCKET_HANDLER_HPP #endif // SOCKET_HANDLER_HPP
+5 -6
View File
@@ -28,9 +28,13 @@ class TCPSocketHandler: public SocketHandler
{ {
protected: protected:
~TCPSocketHandler(); ~TCPSocketHandler();
public: public:
explicit TCPSocketHandler(std::shared_ptr<Poller> poller); explicit TCPSocketHandler(std::shared_ptr<Poller> poller);
TCPSocketHandler(const TCPSocketHandler&) = delete;
TCPSocketHandler(TCPSocketHandler&&) = delete;
TCPSocketHandler& operator=(const TCPSocketHandler&) = delete;
TCPSocketHandler& operator=(TCPSocketHandler&&) = delete;
/** /**
* Connect to the remote server, and call on_connected() if this * Connect to the remote server, and call on_connected() if this
* succeeds. If tls is true, we set use_tls to true and will also call * succeeds. If tls is true, we set use_tls to true and will also call
@@ -231,11 +235,6 @@ protected:
std::string bind_addr; std::string bind_addr;
private: private:
TCPSocketHandler(const TCPSocketHandler&) = delete;
TCPSocketHandler(TCPSocketHandler&&) = delete;
TCPSocketHandler& operator=(const TCPSocketHandler&) = delete;
TCPSocketHandler& operator=(TCPSocketHandler&&) = delete;
/** /**
* Display the resolved IP, just for information purpose. * Display the resolved IP, just for information purpose.
*/ */
+6 -4
View File
@@ -40,6 +40,12 @@ public:
{ {
this->add_callback(std::move(func)); this->add_callback(std::move(func));
} }
ScopeGuard(const ScopeGuard&) = delete;
ScopeGuard& operator=(ScopeGuard&&) = delete;
ScopeGuard(ScopeGuard&&) = delete;
ScopeGuard& operator=(const ScopeGuard&) = delete;
/** /**
* default constructor, the scope guard is enabled but empty, use * default constructor, the scope guard is enabled but empty, use
* add_callback() * add_callback()
@@ -78,10 +84,6 @@ private:
bool enabled; bool enabled;
std::vector<std::function<void()>> callbacks; std::vector<std::function<void()>> callbacks;
ScopeGuard(const ScopeGuard&) = delete;
ScopeGuard& operator=(ScopeGuard&&) = delete;
ScopeGuard(ScopeGuard&&) = delete;
ScopeGuard& operator=(const ScopeGuard&) = delete;
}; };
} }
-4
View File
@@ -29,10 +29,6 @@ TimedEvent::TimedEvent(TimedEvent&& other):
{ {
} }
TimedEvent::~TimedEvent()
{
}
bool TimedEvent::is_after(const TimedEvent& other) const bool TimedEvent::is_after(const TimedEvent& other) const
{ {
return this->is_after(other.time_point); return this->is_after(other.time_point);
+14 -11
View File
@@ -31,7 +31,12 @@ public:
std::function<void()> callback, const std::string& name=""); std::function<void()> callback, const std::string& name="");
explicit TimedEvent(TimedEvent&&); explicit TimedEvent(TimedEvent&&);
~TimedEvent(); ~TimedEvent() = default;
TimedEvent(const TimedEvent&) = delete;
TimedEvent& operator=(const TimedEvent&) = delete;
TimedEvent& operator=(TimedEvent&&) = delete;
/** /**
* Whether or not this event happens after the other one. * Whether or not this event happens after the other one.
*/ */
@@ -70,10 +75,6 @@ private:
* unique. * unique.
*/ */
const std::string name; const std::string name;
TimedEvent(const TimedEvent&) = delete;
TimedEvent& operator=(const TimedEvent&) = delete;
TimedEvent& operator=(TimedEvent&&) = delete;
}; };
/** /**
@@ -84,7 +85,13 @@ private:
class TimedEventsManager class TimedEventsManager
{ {
public: public:
~TimedEventsManager(); ~TimedEventsManager() = default;
TimedEventsManager(const TimedEventsManager&) = delete;
TimedEventsManager(TimedEventsManager&&) = delete;
TimedEventsManager& operator=(const TimedEventsManager&) = delete;
TimedEventsManager& operator=(TimedEventsManager&&) = delete;
/** /**
* Return the unique instance of this class * Return the unique instance of this class
*/ */
@@ -121,12 +128,8 @@ public:
std::size_t size() const; std::size_t size() const;
private: private:
explicit TimedEventsManager();
std::list<TimedEvent> events; std::list<TimedEvent> events;
TimedEventsManager(const TimedEventsManager&) = delete; explicit TimedEventsManager() = default;
TimedEventsManager(TimedEventsManager&&) = delete;
TimedEventsManager& operator=(const TimedEventsManager&) = delete;
TimedEventsManager& operator=(TimedEventsManager&&) = delete;
}; };
#endif // TIMED_EVENTS_HPP #endif // TIMED_EVENTS_HPP
@@ -6,14 +6,6 @@ TimedEventsManager& TimedEventsManager::instance()
return inst; return inst;
} }
TimedEventsManager::TimedEventsManager()
{
}
TimedEventsManager::~TimedEventsManager()
{
}
void TimedEventsManager::add_event(TimedEvent&& event) void TimedEventsManager::add_event(TimedEvent&& event)
{ {
for (auto it = this->events.begin(); it != this->events.end(); ++it) for (auto it = this->events.begin(); it != this->events.end(); ++it)
+6 -5
View File
@@ -21,6 +21,12 @@ public:
commands{} commands{}
{ } { }
~AdhocCommandsHandler() = default; ~AdhocCommandsHandler() = default;
AdhocCommandsHandler(const AdhocCommandsHandler&) = delete;
AdhocCommandsHandler(AdhocCommandsHandler&&) = delete;
AdhocCommandsHandler& operator=(const AdhocCommandsHandler&) = delete;
AdhocCommandsHandler& operator=(AdhocCommandsHandler&&) = delete;
/** /**
* Returns the list of available commands. * Returns the list of available commands.
*/ */
@@ -63,11 +69,6 @@ private:
* Of the form: {{session_id, owner_jid}, session}. * Of the form: {{session_id, owner_jid}, session}.
*/ */
std::map<std::pair<const std::string, const std::string>, AdhocSession> sessions; 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 #endif // ADHOC_COMMANDS_HANDLER_HPP
+6 -6
View File
@@ -25,6 +25,12 @@ public:
explicit AdhocSession(const AdhocCommand& command, const std::string& owner_jid, explicit AdhocSession(const AdhocCommand& command, const std::string& owner_jid,
const std::string& to_jid); const std::string& to_jid);
~AdhocSession() = default; ~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 * Return the function to be executed, found in our AdhocCommand, for the
* current_step. And increment the current_step. * current_step. And increment the current_step.
@@ -80,12 +86,6 @@ public:
* any key in there. * any key in there.
*/ */
std::map<std::string, std::string> vars; 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 #endif // ADHOC_SESSION_HPP
+5 -6
View File
@@ -11,6 +11,11 @@ class Jid
public: public:
explicit Jid(const std::string& jid); 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 domain;
std::string local; std::string local;
std::string resource; std::string resource;
@@ -23,12 +28,6 @@ public:
{ {
return this->local + "@" + this->domain + "/" + this->resource; return this->local + "@" + this->domain + "/" + this->resource;
} }
private:
Jid(const Jid&) = delete;
Jid(Jid&&) = delete;
Jid& operator=(const Jid&) = delete;
Jid& operator=(Jid&&) = delete;
}; };
/** /**
+5 -5
View File
@@ -38,6 +38,11 @@ public:
explicit XmppComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret); explicit XmppComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret);
virtual ~XmppComponent() = default; 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_connection_failed(const std::string& reason) override final;
void on_connected() override final; void on_connected() override final;
void on_connection_close(const std::string& error) 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; std::unordered_map<std::string, std::function<void(const Stanza&)>> stanza_handlers;
AdhocCommandsHandler adhoc_commands_handler; AdhocCommandsHandler adhoc_commands_handler;
XmppComponent(const XmppComponent&) = delete;
XmppComponent(XmppComponent&&) = delete;
XmppComponent& operator=(const XmppComponent&) = delete;
XmppComponent& operator=(XmppComponent&&) = delete;
}; };
#endif // XMPP_COMPONENT_INCLUDED #endif // XMPP_COMPONENT_INCLUDED
+2 -2
View File
@@ -118,7 +118,7 @@ void XmppParser::end_element(const XML_Char*)
this->stanza_event(*this->current_node); this->stanza_event(*this->current_node);
// Note: deleting all the children of our parent deletes ourself, // Note: deleting all the children of our parent deletes ourself,
// so current_node is an invalid pointer after this line // 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; this->current_node = parent;
} }
@@ -139,7 +139,7 @@ void XmppParser::stanza_event(const Stanza& stanza) const
try { try {
callback(stanza); callback(stanza);
} catch (const std::exception& e) { } catch (const std::exception& e) {
log_debug("Unhandled exception: " << e.what()); log_error("Unhandled exception: " << e.what());
} }
} }
} }
+9 -7
View File
@@ -32,12 +32,12 @@ class XmppParser
public: public:
explicit XmppParser(); explicit XmppParser();
~XmppParser(); ~XmppParser();
XmppParser(const XmppParser&) = delete;
XmppParser& operator=(const XmppParser&) = delete;
XmppParser(XmppParser&&) = delete;
XmppParser& operator=(XmppParser&&) = delete;
public: public:
/**
* Init the XML parser and install the callbacks
*/
void init_xml_parser();
/** /**
* Feed the parser with some XML data * Feed the parser with some XML data
*/ */
@@ -98,6 +98,11 @@ public:
void stream_close_event(const XmlNode& node) const; void stream_close_event(const XmlNode& node) const;
private: private:
/**
* Init the XML parser and install the callbacks
*/
void init_xml_parser();
/** /**
* Expat structure. * Expat structure.
*/ */
@@ -123,9 +128,6 @@ private:
std::vector<std::function<void(const Stanza&)>> stanza_callbacks; 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_open_callbacks;
std::vector<std::function<void(const XmlNode&)>> stream_close_callbacks; std::vector<std::function<void(const XmlNode&)>> stream_close_callbacks;
XmppParser(const XmppParser&) = delete;
XmppParser& operator=(const XmppParser&) = delete;
}; };
#endif // XMPP_PARSER_INCLUDED #endif // XMPP_PARSER_INCLUDED
+4 -4
View File
@@ -25,7 +25,6 @@ class XmlNode
public: public:
explicit XmlNode(const std::string& name, XmlNode* parent); explicit XmlNode(const std::string& name, XmlNode* parent);
explicit XmlNode(const std::string& name); explicit XmlNode(const std::string& name);
XmlNode(XmlNode&& node) = default;
/** /**
* The copy constructor does not copy the parent attribute. The children * The copy constructor does not copy the parent attribute. The children
* nodes are all copied recursively. * nodes are all copied recursively.
@@ -42,6 +41,10 @@ public:
this->add_child(std::make_unique<XmlNode>(*child)); this->add_child(std::make_unique<XmlNode>(*child));
} }
XmlNode(XmlNode&& node) = default;
XmlNode& operator=(const XmlNode&) = delete;
XmlNode& operator=(XmlNode&&) = delete;
~XmlNode() = default; ~XmlNode() = default;
void delete_all_children(); void delete_all_children();
@@ -129,9 +132,6 @@ private:
std::vector<std::unique_ptr<XmlNode>> children; std::vector<std::unique_ptr<XmlNode>> children;
std::string inner; std::string inner;
std::string tail; std::string tail;
XmlNode& operator=(const XmlNode&) = delete;
XmlNode& operator=(XmlNode&&) = delete;
}; };
std::ostream& operator<<(std::ostream& os, const XmlNode& node); std::ostream& operator<<(std::ostream& os, const XmlNode& node);
-4
View File
@@ -45,10 +45,6 @@ Bridge::Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_
{ {
} }
Bridge::~Bridge()
{
}
/** /**
* Return the role and affiliation, corresponding to the given irc mode */ * Return the role and affiliation, corresponding to the given irc mode */
static std::tuple<std::string, std::string> get_role_affiliation_from_irc_mode(const char mode) static std::tuple<std::string, std::string> get_role_affiliation_from_irc_mode(const char mode)
+6 -6
View File
@@ -34,7 +34,12 @@ class Bridge
{ {
public: public:
explicit Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller> poller); explicit Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller> poller);
~Bridge(); ~Bridge() = default;
Bridge(const Bridge&) = delete;
Bridge(Bridge&& other) = delete;
Bridge& operator=(const Bridge&) = delete;
Bridge& operator=(Bridge&&) = delete;
/** /**
* QUIT all connected IRC servers. * QUIT all connected IRC servers.
*/ */
@@ -239,11 +244,6 @@ private:
* response iq. * response iq.
*/ */
std::list<irc_responder_callback_t> waiting_irc; std::list<irc_responder_callback_t> waiting_irc;
Bridge(const Bridge&) = delete;
Bridge(Bridge&& other) = delete;
Bridge& operator=(const Bridge&) = delete;
Bridge& operator=(Bridge&&) = delete;
}; };
struct IRCNotConnected: public std::exception struct IRCNotConnected: public std::exception
+5 -5
View File
@@ -16,6 +16,11 @@ public:
Database() = default; Database() = default;
~Database() = default; ~Database() = default;
Database(const Database&) = delete;
Database(Database&&) = delete;
Database& operator=(const Database&) = delete;
Database& operator=(Database&&) = delete;
static void set_verbose(const bool val); static void set_verbose(const bool val);
template<typename PersistentType> template<typename PersistentType>
@@ -42,11 +47,6 @@ private:
static std::unique_ptr<db::BibouDB> db; static std::unique_ptr<db::BibouDB> db;
static db::BibouDB& get_db(); static db::BibouDB& get_db();
Database(const Database&) = delete;
Database(Database&&) = delete;
Database& operator=(const Database&) = delete;
Database& operator=(Database&&) = delete;
}; };
#endif /* USE_DATABASE */ #endif /* USE_DATABASE */
-8
View File
@@ -51,14 +51,6 @@ void Iid::init_with_fixed_server(const std::string& iid, const std::string& host
} }
} }
Iid::Iid(const Iid& other):
is_channel(other.is_channel),
is_user(other.is_user),
local(other.local),
server(other.server)
{
}
Iid::Iid(): Iid::Iid():
is_channel(false), is_channel(false),
is_user(false) is_user(false)
+6 -6
View File
@@ -43,8 +43,12 @@ class Iid
{ {
public: public:
Iid(const std::string& iid); Iid(const std::string& iid);
explicit Iid(const Iid&); Iid();
explicit Iid(); Iid(const Iid&) = default;
Iid(Iid&&) = delete;
Iid& operator=(const Iid&) = delete;
Iid& operator=(Iid&&) = delete;
void set_local(const std::string& loc); void set_local(const std::string& loc);
void set_server(const std::string& serv); void set_server(const std::string& serv);
@@ -63,10 +67,6 @@ private:
std::string local; std::string local;
std::string server; std::string server;
Iid(Iid&&) = delete;
Iid& operator=(const Iid&) = delete;
Iid& operator=(Iid&&) = delete;
}; };
namespace std { namespace std {
+9 -11
View File
@@ -16,6 +16,11 @@ class IrcChannel
public: public:
explicit IrcChannel(); explicit IrcChannel();
IrcChannel(const IrcChannel&) = delete;
IrcChannel(IrcChannel&&) = delete;
IrcChannel& operator=(const IrcChannel&) = delete;
IrcChannel& operator=(IrcChannel&&) = delete;
bool joined; bool joined;
std::string topic; std::string topic;
std::string topic_author; std::string topic_author;
@@ -30,12 +35,6 @@ public:
protected: protected:
std::unique_ptr<IrcUser> self; std::unique_ptr<IrcUser> self;
std::vector<std::unique_ptr<IrcUser>> users; std::vector<std::unique_ptr<IrcUser>> users;
private:
IrcChannel(const IrcChannel&) = delete;
IrcChannel(IrcChannel&&) = delete;
IrcChannel& operator=(const IrcChannel&) = delete;
IrcChannel& operator=(IrcChannel&&) = delete;
}; };
/** /**
@@ -50,6 +49,10 @@ class DummyIrcChannel: public IrcChannel
{ {
public: public:
explicit DummyIrcChannel(); explicit DummyIrcChannel();
DummyIrcChannel(const DummyIrcChannel&) = delete;
DummyIrcChannel(DummyIrcChannel&&) = delete;
DummyIrcChannel& operator=(const DummyIrcChannel&) = delete;
DummyIrcChannel& operator=(DummyIrcChannel&&) = delete;
/** /**
* This flag is at true whenever the user wants to join this channel, but * This flag is at true whenever the user wants to join this channel, but
@@ -60,11 +63,6 @@ public:
* the channel, we don’t use that flag, we just join it immediately. * the channel, we don’t use that flag, we just join it immediately.
*/ */
bool joining; bool joining;
private:
DummyIrcChannel(const DummyIrcChannel&) = delete;
DummyIrcChannel(DummyIrcChannel&&) = delete;
DummyIrcChannel& operator=(const DummyIrcChannel&) = delete;
DummyIrcChannel& operator=(DummyIrcChannel&&) = delete;
}; };
#endif // IRC_CHANNEL_INCLUDED #endif // IRC_CHANNEL_INCLUDED
+6 -5
View File
@@ -31,6 +31,12 @@ public:
const std::string& realname, const std::string& user_hostname, const std::string& realname, const std::string& user_hostname,
Bridge& bridge); Bridge& bridge);
~IrcClient(); ~IrcClient();
IrcClient(const IrcClient&) = delete;
IrcClient(IrcClient&&) = delete;
IrcClient& operator=(const IrcClient&) = delete;
IrcClient& operator=(IrcClient&&) = delete;
/** /**
* Connect to the IRC server * Connect to the IRC server
*/ */
@@ -360,11 +366,6 @@ private:
* the WebIRC protocole. * the WebIRC protocole.
*/ */
Resolver dns_resolver; Resolver dns_resolver;
IrcClient(const IrcClient&) = delete;
IrcClient(IrcClient&&) = delete;
IrcClient& operator=(const IrcClient&) = delete;
IrcClient& operator=(IrcClient&&) = delete;
}; };
#endif // IRC_CLIENT_INCLUDED #endif // IRC_CLIENT_INCLUDED
-4
View File
@@ -47,10 +47,6 @@ IrcMessage::IrcMessage(std::string&& command,
{ {
} }
IrcMessage::~IrcMessage()
{
}
std::ostream& operator<<(std::ostream& os, const IrcMessage& message) std::ostream& operator<<(std::ostream& os, const IrcMessage& message)
{ {
os << "IrcMessage"; os << "IrcMessage";
+5 -5
View File
@@ -11,16 +11,16 @@ public:
IrcMessage(std::string&& line); IrcMessage(std::string&& line);
IrcMessage(std::string&& prefix, std::string&& command, std::vector<std::string>&& args); IrcMessage(std::string&& prefix, std::string&& command, std::vector<std::string>&& args);
IrcMessage(std::string&& command, std::vector<std::string>&& args); IrcMessage(std::string&& command, std::vector<std::string>&& args);
~IrcMessage(); ~IrcMessage() = default;
std::string prefix;
std::string command;
std::vector<std::string> arguments;
IrcMessage(const IrcMessage&) = delete; IrcMessage(const IrcMessage&) = delete;
IrcMessage(IrcMessage&&) = delete; IrcMessage(IrcMessage&&) = delete;
IrcMessage& operator=(const IrcMessage&) = delete; IrcMessage& operator=(const IrcMessage&) = delete;
IrcMessage& operator=(IrcMessage&&) = delete; IrcMessage& operator=(IrcMessage&&) = delete;
std::string prefix;
std::string command;
std::vector<std::string> arguments;
}; };
std::ostream& operator<<(std::ostream& os, const IrcMessage& message); std::ostream& operator<<(std::ostream& os, const IrcMessage& message);
+8 -7
View File
@@ -15,18 +15,19 @@ public:
explicit IrcUser(const std::string& name, explicit IrcUser(const std::string& name,
const std::map<char, char>& prefix_to_mode); const std::map<char, char>& prefix_to_mode);
explicit IrcUser(const std::string& name); explicit IrcUser(const std::string& name);
void add_mode(const char mode);
void remove_mode(const char mode);
char get_most_significant_mode(const std::vector<char>& sorted_user_modes) const;
std::string nick;
std::string host;
std::set<char> modes;
private:
IrcUser(const IrcUser&) = delete; IrcUser(const IrcUser&) = delete;
IrcUser(IrcUser&&) = delete; IrcUser(IrcUser&&) = delete;
IrcUser& operator=(const IrcUser&) = delete; IrcUser& operator=(const IrcUser&) = delete;
IrcUser& operator=(IrcUser&&) = delete; IrcUser& operator=(IrcUser&&) = delete;
void add_mode(const char mode);
void remove_mode(const char mode);
char get_most_significant_mode(const std::vector<char>& sorted_user_modes) const;
std::string nick;
std::string host;
std::set<char> modes;
}; };
#endif // IRC_USER_INCLUDED #endif // IRC_USER_INCLUDED
+5 -5
View File
@@ -26,6 +26,11 @@ public:
explicit BiboumiComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret); explicit BiboumiComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret);
~BiboumiComponent() = default; ~BiboumiComponent() = default;
BiboumiComponent(const BiboumiComponent&) = delete;
BiboumiComponent(BiboumiComponent&&) = delete;
BiboumiComponent& operator=(const BiboumiComponent&) = delete;
BiboumiComponent& operator=(BiboumiComponent&&) = delete;
/** /**
* Returns the bridge for the given user. If it does not exist, return * Returns the bridge for the given user. If it does not exist, return
* nullptr. * nullptr.
@@ -99,11 +104,6 @@ private:
AdhocCommandsHandler irc_server_adhoc_commands_handler; AdhocCommandsHandler irc_server_adhoc_commands_handler;
AdhocCommandsHandler irc_channel_adhoc_commands_handler; AdhocCommandsHandler irc_channel_adhoc_commands_handler;
BiboumiComponent(const BiboumiComponent&) = delete;
BiboumiComponent(BiboumiComponent&&) = delete;
BiboumiComponent& operator=(const BiboumiComponent&) = delete;
BiboumiComponent& operator=(BiboumiComponent&&) = delete;
}; };
#endif // BIBOUMI_COMPONENT_INCLUDED #endif // BIBOUMI_COMPONENT_INCLUDED