diff options
Diffstat (limited to 'include/modules')
| -rw-r--r-- | include/modules/bs_badwords.h | 8 | ||||
| -rw-r--r-- | include/modules/bs_kick.h | 6 | ||||
| -rw-r--r-- | include/modules/cs_entrymsg.h | 6 | ||||
| -rw-r--r-- | include/modules/cs_log.h | 8 | ||||
| -rw-r--r-- | include/modules/cs_mode.h | 8 | ||||
| -rw-r--r-- | include/modules/dns.h | 25 | ||||
| -rw-r--r-- | include/modules/encryption.h | 6 | ||||
| -rw-r--r-- | include/modules/httpd.h | 14 | ||||
| -rw-r--r-- | include/modules/ldap.h | 9 | ||||
| -rw-r--r-- | include/modules/ns_cert.h | 6 | ||||
| -rw-r--r-- | include/modules/os_forbid.h | 13 | ||||
| -rw-r--r-- | include/modules/os_ignore.h | 8 | ||||
| -rw-r--r-- | include/modules/os_news.h | 5 | ||||
| -rw-r--r-- | include/modules/os_session.h | 15 | ||||
| -rw-r--r-- | include/modules/pseudoclients/chanserv.h | 5 | ||||
| -rw-r--r-- | include/modules/pseudoclients/global.h | 5 | ||||
| -rw-r--r-- | include/modules/pseudoclients/memoserv.h | 5 | ||||
| -rw-r--r-- | include/modules/pseudoclients/nickserv.h | 5 | ||||
| -rw-r--r-- | include/modules/redis.h | 4 | ||||
| -rw-r--r-- | include/modules/sasl.h | 6 | ||||
| -rw-r--r-- | include/modules/set_misc.h | 7 | ||||
| -rw-r--r-- | include/modules/sql.h | 20 | ||||
| -rw-r--r-- | include/modules/ssl.h | 2 | ||||
| -rw-r--r-- | include/modules/suspend.h | 6 | ||||
| -rw-r--r-- | include/modules/xmlrpc.h | 4 |
25 files changed, 104 insertions, 102 deletions
diff --git a/include/modules/bs_badwords.h b/include/modules/bs_badwords.h index 17be4be9b..f41da55f5 100644 --- a/include/modules/bs_badwords.h +++ b/include/modules/bs_badwords.h @@ -9,6 +9,8 @@ * Based on the original code of Services by Andy Church. */ +#pragma once + /** Flags for badwords */ enum BadWordType @@ -30,14 +32,14 @@ struct BadWord Anope::string word; BadWordType type; - virtual ~BadWord() { } + virtual ~BadWord() = default; protected: - BadWord() { } + BadWord() = default; }; struct BadWords { - virtual ~BadWords() { } + virtual ~BadWords() = default; /** Add a badword to the badword list * @param word The badword diff --git a/include/modules/bs_kick.h b/include/modules/bs_kick.h index 88ae4d43e..8c6d561f5 100644 --- a/include/modules/bs_kick.h +++ b/include/modules/bs_kick.h @@ -9,6 +9,8 @@ * Based on the original code of Services by Andy Church. */ +#pragma once + /* Indices for TTB (Times To Ban) */ enum { @@ -36,9 +38,9 @@ struct KickerData bool dontkickops, dontkickvoices; protected: - KickerData() { } + KickerData() = default; public: - virtual ~KickerData() { } + virtual ~KickerData() = default; virtual void Check(ChannelInfo *ci) = 0; }; diff --git a/include/modules/cs_entrymsg.h b/include/modules/cs_entrymsg.h index e90563ca7..a0efe142a 100644 --- a/include/modules/cs_entrymsg.h +++ b/include/modules/cs_entrymsg.h @@ -6,6 +6,8 @@ * Please read COPYING and README for further details. */ +#pragma once + struct EntryMsg { Anope::string chan; @@ -13,9 +15,9 @@ struct EntryMsg Anope::string message; time_t when; - virtual ~EntryMsg() { } + virtual ~EntryMsg() = default; protected: - EntryMsg() { } + EntryMsg() = default; }; struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> > diff --git a/include/modules/cs_log.h b/include/modules/cs_log.h index 0c3376c86..d240aef04 100644 --- a/include/modules/cs_log.h +++ b/include/modules/cs_log.h @@ -9,6 +9,8 @@ * Based on the original code of Services by Andy Church. */ +#pragma once + struct LogSetting { Anope::string chan; @@ -22,9 +24,9 @@ struct LogSetting Anope::string creator; time_t created; - virtual ~LogSetting() { } + virtual ~LogSetting() = default; protected: - LogSetting() { } + LogSetting() = default; }; struct LogSettings : Serialize::Checker<std::vector<LogSetting *> > @@ -37,6 +39,6 @@ struct LogSettings : Serialize::Checker<std::vector<LogSetting *> > } public: - virtual ~LogSettings() { } + virtual ~LogSettings() = default; virtual LogSetting *Create() = 0; }; diff --git a/include/modules/cs_mode.h b/include/modules/cs_mode.h index 9a917ba9d..d237b4273 100644 --- a/include/modules/cs_mode.h +++ b/include/modules/cs_mode.h @@ -9,6 +9,8 @@ * Based on the original code of Services by Andy Church. */ +#pragma once + struct ModeLock { Anope::string ci; @@ -18,16 +20,16 @@ struct ModeLock Anope::string setter; time_t created; - virtual ~ModeLock() { } + virtual ~ModeLock() = default; protected: - ModeLock() { } + ModeLock() = default; }; struct ModeLocks { typedef std::vector<ModeLock *> ModeList; - virtual ~ModeLocks() { } + virtual ~ModeLocks() = default; /** Check if a mode is mlocked * @param mode The mode diff --git a/include/modules/dns.h b/include/modules/dns.h index 491695de2..0ab666be8 100644 --- a/include/modules/dns.h +++ b/include/modules/dns.h @@ -9,8 +9,7 @@ * Based on the original code of Services by Andy Church. */ -#ifndef DNS_H -#define DNS_H +#pragma once namespace DNS { @@ -73,10 +72,10 @@ namespace DNS struct Question { Anope::string name; - QueryType type; - unsigned short qclass; + QueryType type = QUERY_NONE; + unsigned short qclass = 0; - Question() : type(QUERY_NONE), qclass(0) { } + Question() = default; Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { } inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; } @@ -91,12 +90,12 @@ namespace DNS struct ResourceRecord : Question { - unsigned int ttl; + unsigned int ttl = 0; Anope::string rdata; time_t created; - ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(Anope::CurTime) { } - ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { } + ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), created(Anope::CurTime) { } + ResourceRecord(const Question &q) : Question(q), created(Anope::CurTime) { } }; struct Query @@ -118,7 +117,7 @@ namespace DNS { public: Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { } - virtual ~Manager() { } + virtual ~Manager() = default; virtual void Process(Request *req) = 0; virtual void RemoveRequest(Request *req) = 0; @@ -139,12 +138,12 @@ namespace DNS /* Use result cache if available */ bool use_cache; /* Request id */ - unsigned short id; + unsigned short id = 0; /* Creator of this request */ Module *creator; Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) : Timer(0), Question(addr, qt), manager(mgr), - use_cache(cache), id(0), creator(c) { } + use_cache(cache), creator(c) { } virtual ~Request() { @@ -164,7 +163,7 @@ namespace DNS /** Used to time out the query, xalls OnError and lets the TimerManager * delete this request. */ - void Tick(time_t) anope_override + void Tick(time_t) override { Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name; Query rr(*this); @@ -174,5 +173,3 @@ namespace DNS }; } // namespace DNS - -#endif // DNS_H diff --git a/include/modules/encryption.h b/include/modules/encryption.h index 6311ab7cb..6a0f402c7 100644 --- a/include/modules/encryption.h +++ b/include/modules/encryption.h @@ -9,6 +9,8 @@ * Based on the original code of Services by Andy Church. */ +#pragma once + namespace Encryption { typedef std::pair<const unsigned char *, size_t> Hash; @@ -17,7 +19,7 @@ namespace Encryption class Context { public: - virtual ~Context() { } + virtual ~Context() = default; virtual void Update(const unsigned char *data, size_t len) = 0; virtual void Finalize() = 0; virtual Hash GetFinalizedHash() = 0; @@ -27,7 +29,7 @@ namespace Encryption { public: Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { } - virtual ~Provider() { } + virtual ~Provider() = default; virtual Context *CreateContext(IV * = NULL) = 0; virtual IV GetDefaultIV() = 0; diff --git a/include/modules/httpd.h b/include/modules/httpd.h index 49227546c..096f93ca2 100644 --- a/include/modules/httpd.h +++ b/include/modules/httpd.h @@ -6,8 +6,7 @@ * Please read COPYING and README for further details. */ -#ifndef ANOPE_HTTPD_H -#define ANOPE_HTTPD_H +#pragma once enum HTTPError { @@ -21,13 +20,14 @@ enum HTTPError /* A message to someone */ struct HTTPReply { - HTTPError error; + HTTPError error = HTTP_ERROR_OK; Anope::string content_type; std::map<Anope::string, Anope::string, ci::less> headers; typedef std::list<std::pair<Anope::string, Anope::string> > cookie; std::vector<cookie> cookies; - HTTPReply() : error(HTTP_ERROR_OK), length(0) { } + HTTPReply() = default; + HTTPReply& operator=(const HTTPReply &) = default; HTTPReply(const HTTPReply& other) : error(other.error), length(other.length) { @@ -65,7 +65,7 @@ struct HTTPReply }; std::deque<Data *> out; - size_t length; + size_t length = 0; void Write(const Anope::string &message) { @@ -93,7 +93,7 @@ struct HTTPMessage class HTTPClient; class HTTPProvider; -class HTTPPage : public Base +class HTTPPage : public virtual Base { Anope::string url; Anope::string content_type; @@ -239,5 +239,3 @@ namespace HTTPUtils return dst; } } - -#endif // ANOPE_HTTPD_H diff --git a/include/modules/ldap.h b/include/modules/ldap.h index 58ecb6a1a..95c780599 100644 --- a/include/modules/ldap.h +++ b/include/modules/ldap.h @@ -6,15 +6,14 @@ * Please read COPYING and README for further details. */ -#ifndef ANOPE_LDAP_H -#define ANOPE_LDAP_H +#pragma once class LDAPException : public ModuleException { public: LDAPException(const Anope::string &reason) : ModuleException(reason) { } - virtual ~LDAPException() throw() { } + virtual ~LDAPException() noexcept = default; }; struct LDAPModification @@ -116,7 +115,7 @@ class LDAPInterface Module *owner; LDAPInterface(Module *m) : owner(m) { } - virtual ~LDAPInterface() { } + virtual ~LDAPInterface() = default; virtual void OnResult(const LDAPResult &r) = 0; virtual void OnError(const LDAPResult &err) = 0; @@ -167,5 +166,3 @@ class LDAPProvider : public Service */ virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0; }; - -#endif // ANOPE_LDAP_H diff --git a/include/modules/ns_cert.h b/include/modules/ns_cert.h index 7164da646..2c9252ec1 100644 --- a/include/modules/ns_cert.h +++ b/include/modules/ns_cert.h @@ -9,12 +9,14 @@ * Based on the original code of Services by Andy Church. */ +#pragma once + struct NSCertList { protected: - NSCertList() { } + NSCertList() = default; public: - virtual ~NSCertList() { } + virtual ~NSCertList() = default; /** Add an entry to the nick's certificate list * diff --git a/include/modules/os_forbid.h b/include/modules/os_forbid.h index f50592995..3c433f044 100644 --- a/include/modules/os_forbid.h +++ b/include/modules/os_forbid.h @@ -6,8 +6,7 @@ * Please read COPYING and README for further details. */ -#ifndef OS_FORBID_H -#define OS_FORBID_H +#pragma once enum ForbidType { @@ -23,13 +22,13 @@ struct ForbidData Anope::string mask; Anope::string creator; Anope::string reason; - time_t created; - time_t expires; + time_t created = 0; + time_t expires = 0; ForbidType type; - virtual ~ForbidData() { } + virtual ~ForbidData() = default; protected: - ForbidData() : created(0), expires(0) { } + ForbidData() = default; }; class ForbidService : public Service @@ -51,5 +50,3 @@ class ForbidService : public Service }; static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid"); - -#endif diff --git a/include/modules/os_ignore.h b/include/modules/os_ignore.h index afe547431..a0fe1d607 100644 --- a/include/modules/os_ignore.h +++ b/include/modules/os_ignore.h @@ -9,16 +9,18 @@ * Based on the original code of Services by Andy Church. */ +#pragma once + struct IgnoreData { Anope::string mask; Anope::string creator; Anope::string reason; - time_t time; /* When do we stop ignoring them? */ + time_t time = 0; /* When do we stop ignoring them? */ - virtual ~IgnoreData() { } + virtual ~IgnoreData() = default; protected: - IgnoreData() : time(0) { } + IgnoreData() = default; }; class IgnoreService : public Service diff --git a/include/modules/os_news.h b/include/modules/os_news.h index 5db892913..f9bd6ebbf 100644 --- a/include/modules/os_news.h +++ b/include/modules/os_news.h @@ -6,8 +6,7 @@ * Please read COPYING and README for further details. */ -#ifndef OS_NEWS -#define OS_NEWS +#pragma once enum NewsType { @@ -48,5 +47,3 @@ class NewsService : public Service }; static ServiceReference<NewsService> news_service("NewsService", "news"); - -#endif // OS_NEWS diff --git a/include/modules/os_session.h b/include/modules/os_session.h index 5be5104e1..7456ebc3a 100644 --- a/include/modules/os_session.h +++ b/include/modules/os_session.h @@ -6,16 +6,15 @@ * Please read COPYING and README for further details. */ -#ifndef OS_SESSION_H -#define OS_SESSION_H +#pragma once struct Session { cidr addr; /* A cidr (sockaddrs + len) representing this session */ - unsigned count; /* Number of clients with this host */ - unsigned hits; /* Number of subsequent kills for a host */ + unsigned count = 1; /* Number of clients with this host */ + unsigned hits = 0; /* Number of subsequent kills for a host */ - Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { } + Session(const sockaddrs &ip, int len) : addr(ip, len) { } }; struct Exception : Serializable @@ -28,14 +27,14 @@ struct Exception : Serializable time_t expires; /* Time when it expires. 0 == no expiry */ Exception() : Serializable("Exception") { } - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; class SessionService : public Service { public: - typedef TR1NS::unordered_map<cidr, Session *, cidr::hash> SessionMap; + typedef std::unordered_map<cidr, Session *, cidr::hash> SessionMap; typedef std::vector<Exception *> ExceptionVector; SessionService(Module *m) : Service(m, "SessionService", "session") { } @@ -90,5 +89,3 @@ Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data) session_service->AddException(ex); return ex; } - -#endif diff --git a/include/modules/pseudoclients/chanserv.h b/include/modules/pseudoclients/chanserv.h index f05590b7f..284fa7db6 100644 --- a/include/modules/pseudoclients/chanserv.h +++ b/include/modules/pseudoclients/chanserv.h @@ -6,8 +6,7 @@ * Please read COPYING and README for further details. */ -#ifndef CHANSERV_H -#define CHANSERV_H +#pragma once class ChanServService : public Service { @@ -21,5 +20,3 @@ class ChanServService : public Service */ virtual void Hold(Channel *c) = 0; }; - -#endif // CHANSERV_H diff --git a/include/modules/pseudoclients/global.h b/include/modules/pseudoclients/global.h index cb548f75c..2211a1dee 100644 --- a/include/modules/pseudoclients/global.h +++ b/include/modules/pseudoclients/global.h @@ -6,8 +6,7 @@ * Please read COPYING and README for further details. */ -#ifndef GLOBAL_H -#define GLOBAL_H +#pragma once class GlobalService : public Service { @@ -26,5 +25,3 @@ class GlobalService : public Service */ virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0; }; - -#endif // GLOBAL_H diff --git a/include/modules/pseudoclients/memoserv.h b/include/modules/pseudoclients/memoserv.h index 583422c05..bb735cb8f 100644 --- a/include/modules/pseudoclients/memoserv.h +++ b/include/modules/pseudoclients/memoserv.h @@ -6,8 +6,7 @@ * Please read COPYING and README for further details. */ -#ifndef MEMOSERV_H -#define MEMOSERV_H +#pragma once class MemoServService : public Service { @@ -37,5 +36,3 @@ class MemoServService : public Service */ virtual void Check(User *u) = 0; }; - -#endif // MEMOSERV_H diff --git a/include/modules/pseudoclients/nickserv.h b/include/modules/pseudoclients/nickserv.h index c2d13810c..7ee207547 100644 --- a/include/modules/pseudoclients/nickserv.h +++ b/include/modules/pseudoclients/nickserv.h @@ -6,8 +6,7 @@ * Please read COPYING and README for further details. */ -#ifndef NICKSERV_H -#define NICKSERV_H +#pragma once class NickServService : public Service { @@ -20,5 +19,3 @@ class NickServService : public Service virtual void Collide(User *u, NickAlias *na) = 0; virtual void Release(NickAlias *na) = 0; }; - -#endif // NICKSERV_H diff --git a/include/modules/redis.h b/include/modules/redis.h index a5e878eac..fcd4e20ed 100644 --- a/include/modules/redis.h +++ b/include/modules/redis.h @@ -6,6 +6,8 @@ * Please read COPYING and README for further details. */ +#pragma once + namespace Redis { struct Reply @@ -47,7 +49,7 @@ namespace Redis Module *owner; Interface(Module *m) : owner(m) { } - virtual ~Interface() { } + virtual ~Interface() = default; virtual void OnResult(const Reply &r) = 0; virtual void OnError(const Anope::string &error) { Log(owner) << error; } diff --git a/include/modules/sasl.h b/include/modules/sasl.h index 405fa6e46..b3f5f1faa 100644 --- a/include/modules/sasl.h +++ b/include/modules/sasl.h @@ -6,6 +6,8 @@ * Please read COPYING and README for further details. */ +#pragma once + namespace SASL { struct Message @@ -82,7 +84,7 @@ namespace SASL public: IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass, const Anope::string &h, const Anope::string &i) : ::IdentifyRequest(m, acc, pass), uid(id), hostname(h), ip(i) { } - void OnSuccess() anope_override + void OnSuccess() override { if (!sasl) return; @@ -108,7 +110,7 @@ namespace SASL } } - void OnFail() anope_override + void OnFail() override { if (!sasl) return; diff --git a/include/modules/set_misc.h b/include/modules/set_misc.h index b989555a2..df4925592 100644 --- a/include/modules/set_misc.h +++ b/include/modules/set_misc.h @@ -6,12 +6,15 @@ * Please read COPYING and README for further details. */ +#pragma once + struct MiscData { Anope::string object; Anope::string name; Anope::string data; - MiscData() { } - virtual ~MiscData() { } + virtual ~MiscData() = default; + protected: + MiscData() = default; }; diff --git a/include/modules/sql.h b/include/modules/sql.h index 50f916814..e94a36a1b 100644 --- a/include/modules/sql.h +++ b/include/modules/sql.h @@ -6,6 +6,8 @@ * Please read COPYING and README for further details. */ +#pragma once + namespace SQL { @@ -21,7 +23,7 @@ namespace SQL Clear(); } - std::iostream& operator[](const Anope::string &key) anope_override + std::iostream& operator[](const Anope::string &key) override { std::stringstream *&ss = data[key]; if (!ss) @@ -29,7 +31,7 @@ namespace SQL return *ss; } - std::set<Anope::string> KeySet() const anope_override + std::set<Anope::string> KeySet() const override { std::set<Anope::string> keys; for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -37,7 +39,7 @@ namespace SQL return keys; } - size_t Hash() const anope_override + size_t Hash() const override { size_t hash = 0; for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -61,12 +63,12 @@ namespace SQL this->data.clear(); } - void SetType(const Anope::string &key, Type t) anope_override + void SetType(const Anope::string &key, Type t) override { this->types[key] = t; } - Type GetType(const Anope::string &key) const anope_override + Type GetType(const Anope::string &key) const override { std::map<Anope::string, Type>::const_iterator it = this->types.find(key); if (it != this->types.end()) @@ -82,7 +84,7 @@ namespace SQL public: Exception(const Anope::string &reason) : ModuleException(reason) { } - virtual ~Exception() throw() { } + virtual ~Exception() noexcept = default; }; /** A SQL query @@ -141,10 +143,10 @@ namespace SQL Query query; Anope::string error; public: - unsigned int id; + unsigned int id = 0; Anope::string finished_query; - Result() : id(0) { } + Result() = default; Result(unsigned int i, const Query &q, const Anope::string &fq, const Anope::string &err = "") : query(q), error(err), id(i), finished_query(fq) { } inline operator bool() const { return this->error.empty(); } @@ -187,7 +189,7 @@ namespace SQL Module *owner; Interface(Module *m) : owner(m) { } - virtual ~Interface() { } + virtual ~Interface() = default; virtual void OnResult(const Result &r) = 0; virtual void OnError(const Result &r) = 0; diff --git a/include/modules/ssl.h b/include/modules/ssl.h index 314edd4f2..9492fd349 100644 --- a/include/modules/ssl.h +++ b/include/modules/ssl.h @@ -6,6 +6,8 @@ * Please read COPYING and README for further details. */ +#pragma once + class SSLService : public Service { public: diff --git a/include/modules/suspend.h b/include/modules/suspend.h index 22140937f..9cee5b62a 100644 --- a/include/modules/suspend.h +++ b/include/modules/suspend.h @@ -9,11 +9,13 @@ * Based on the original code of Services by Andy Church. */ +#pragma once + struct SuspendInfo { Anope::string what, by, reason; time_t when, expires; - SuspendInfo() { } - virtual ~SuspendInfo() { } + SuspendInfo() = default; + virtual ~SuspendInfo() = default; }; diff --git a/include/modules/xmlrpc.h b/include/modules/xmlrpc.h index 81c61c0a7..9a197f4f6 100644 --- a/include/modules/xmlrpc.h +++ b/include/modules/xmlrpc.h @@ -6,6 +6,8 @@ * Please read COPYING and README for further details. */ +#pragma once + #include "httpd.h" class XMLRPCRequest @@ -28,7 +30,7 @@ class XMLRPCServiceInterface; class XMLRPCEvent { public: - virtual ~XMLRPCEvent() { } + virtual ~XMLRPCEvent() = default; virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0; }; |
