diff options
author | louiz’ <louiz@louiz.org> | 2016-05-04 14:16:40 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-05-04 14:16:40 +0200 |
commit | af42073830087d97385e507f27f601e8769541b0 (patch) | |
tree | d7187f5dcbf73cf73776c6c9dad01ad4d0a25b51 /src | |
parent | 305e01c0b58ec5cfee276841488f9c24835ce923 (diff) | |
download | biboumi-af42073830087d97385e507f27f601e8769541b0.tar.gz biboumi-af42073830087d97385e507f27f601e8769541b0.tar.bz2 biboumi-af42073830087d97385e507f27f601e8769541b0.tar.xz biboumi-af42073830087d97385e507f27f601e8769541b0.zip |
Style fix
Move all constructors at the top of classes
Diffstat (limited to 'src')
-rw-r--r-- | src/bridge/bridge.cpp | 4 | ||||
-rw-r--r-- | src/bridge/bridge.hpp | 12 | ||||
-rw-r--r-- | src/database/database.hpp | 10 | ||||
-rw-r--r-- | src/irc/iid.cpp | 8 | ||||
-rw-r--r-- | src/irc/iid.hpp | 12 | ||||
-rw-r--r-- | src/irc/irc_channel.hpp | 20 | ||||
-rw-r--r-- | src/irc/irc_client.hpp | 11 | ||||
-rw-r--r-- | src/irc/irc_message.cpp | 4 | ||||
-rw-r--r-- | src/irc/irc_message.hpp | 10 | ||||
-rw-r--r-- | src/irc/irc_user.hpp | 13 | ||||
-rw-r--r-- | src/xmpp/biboumi_component.hpp | 10 |
11 files changed, 49 insertions, 65 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index 2815da9..6008dfc 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -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 */ static std::tuple<std::string, std::string> get_role_affiliation_from_irc_mode(const char mode) diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp index 6222ef0..2676d1d 100644 --- a/src/bridge/bridge.hpp +++ b/src/bridge/bridge.hpp @@ -34,7 +34,12 @@ class Bridge { public: 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. */ @@ -239,11 +244,6 @@ private: * response iq. */ 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 diff --git a/src/database/database.hpp b/src/database/database.hpp index fc957bd..7bd41a3 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -16,6 +16,11 @@ public: 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); template<typename PersistentType> @@ -42,11 +47,6 @@ private: static std::unique_ptr<db::BibouDB> 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 */ diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp index 9d39129..212fb8f 100644 --- a/src/irc/iid.cpp +++ b/src/irc/iid.cpp @@ -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(): is_channel(false), is_user(false) diff --git a/src/irc/iid.hpp b/src/irc/iid.hpp index 91779b2..1c026e8 100644 --- a/src/irc/iid.hpp +++ b/src/irc/iid.hpp @@ -43,8 +43,12 @@ class Iid { public: Iid(const std::string& iid); - explicit Iid(const Iid&); - explicit Iid(); + 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_server(const std::string& serv); @@ -63,10 +67,6 @@ private: std::string local; std::string server; - - Iid(Iid&&) = delete; - Iid& operator=(const Iid&) = delete; - Iid& operator=(Iid&&) = delete; }; namespace std { diff --git a/src/irc/irc_channel.hpp b/src/irc/irc_channel.hpp index 651b8ed..e22947b 100644 --- a/src/irc/irc_channel.hpp +++ b/src/irc/irc_channel.hpp @@ -16,6 +16,11 @@ class IrcChannel public: explicit IrcChannel(); + IrcChannel(const IrcChannel&) = delete; + IrcChannel(IrcChannel&&) = delete; + IrcChannel& operator=(const IrcChannel&) = delete; + IrcChannel& operator=(IrcChannel&&) = delete; + bool joined; std::string topic; std::string topic_author; @@ -30,12 +35,6 @@ public: protected: std::unique_ptr<IrcUser> self; 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: 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 @@ -60,11 +63,6 @@ public: * the channel, we don’t use that flag, we just join it immediately. */ bool joining; -private: - DummyIrcChannel(const DummyIrcChannel&) = delete; - DummyIrcChannel(DummyIrcChannel&&) = delete; - DummyIrcChannel& operator=(const DummyIrcChannel&) = delete; - DummyIrcChannel& operator=(DummyIrcChannel&&) = delete; }; #endif // IRC_CHANNEL_INCLUDED diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index ceaa860..7af097c 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -31,6 +31,12 @@ public: const std::string& realname, const std::string& user_hostname, Bridge& bridge); ~IrcClient(); + + IrcClient(const IrcClient&) = delete; + IrcClient(IrcClient&&) = delete; + IrcClient& operator=(const IrcClient&) = delete; + IrcClient& operator=(IrcClient&&) = delete; + /** * Connect to the IRC server */ @@ -360,11 +366,6 @@ private: * the WebIRC protocole. */ Resolver dns_resolver; - - IrcClient(const IrcClient&) = delete; - IrcClient(IrcClient&&) = delete; - IrcClient& operator=(const IrcClient&) = delete; - IrcClient& operator=(IrcClient&&) = delete; }; #endif // IRC_CLIENT_INCLUDED diff --git a/src/irc/irc_message.cpp b/src/irc/irc_message.cpp index eb3eb47..966a47c 100644 --- a/src/irc/irc_message.cpp +++ b/src/irc/irc_message.cpp @@ -47,10 +47,6 @@ IrcMessage::IrcMessage(std::string&& command, { } -IrcMessage::~IrcMessage() -{ -} - std::ostream& operator<<(std::ostream& os, const IrcMessage& message) { os << "IrcMessage"; diff --git a/src/irc/irc_message.hpp b/src/irc/irc_message.hpp index 01e78cf..29ed946 100644 --- a/src/irc/irc_message.hpp +++ b/src/irc/irc_message.hpp @@ -11,16 +11,16 @@ public: IrcMessage(std::string&& line); IrcMessage(std::string&& prefix, std::string&& command, std::vector<std::string>&& args); IrcMessage(std::string&& command, std::vector<std::string>&& args); - ~IrcMessage(); - - std::string prefix; - std::string command; - std::vector<std::string> arguments; + ~IrcMessage() = default; IrcMessage(const IrcMessage&) = delete; IrcMessage(IrcMessage&&) = delete; IrcMessage& operator=(const 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); diff --git a/src/irc/irc_user.hpp b/src/irc/irc_user.hpp index d3397ca..4b6cd7a 100644 --- a/src/irc/irc_user.hpp +++ b/src/irc/irc_user.hpp @@ -15,18 +15,19 @@ public: explicit IrcUser(const std::string& name, const std::map<char, char>& prefix_to_mode); explicit IrcUser(const std::string& name); + + IrcUser(const IrcUser&) = delete; + IrcUser(IrcUser&&) = delete; + IrcUser& operator=(const 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; - -private: - IrcUser(const IrcUser&) = delete; - IrcUser(IrcUser&&) = delete; - IrcUser& operator=(const IrcUser&) = delete; - IrcUser& operator=(IrcUser&&) = delete; }; #endif // IRC_USER_INCLUDED diff --git a/src/xmpp/biboumi_component.hpp b/src/xmpp/biboumi_component.hpp index 7602332..f1817e2 100644 --- a/src/xmpp/biboumi_component.hpp +++ b/src/xmpp/biboumi_component.hpp @@ -26,6 +26,11 @@ public: explicit BiboumiComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret); ~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 * nullptr. @@ -99,11 +104,6 @@ private: AdhocCommandsHandler irc_server_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 |