diff options
Diffstat (limited to 'include/modules/ldap.h')
-rw-r--r-- | include/modules/ldap.h | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/include/modules/ldap.h b/include/modules/ldap.h index dd3306d90..2342bd1ba 100644 --- a/include/modules/ldap.h +++ b/include/modules/ldap.h @@ -6,18 +6,17 @@ * Please read COPYING and README for further details. */ -#ifndef ANOPE_LDAP_H -#define ANOPE_LDAP_H +#pragma once -class LDAPException : public ModuleException +class DllExport LDAPException : public ModuleException { - public: +public: LDAPException(const Anope::string &reason) : ModuleException(reason) { } - virtual ~LDAPException() throw() { } + virtual ~LDAPException() noexcept = default; }; -struct LDAPModification +struct LDAPModification final { enum LDAPOperation { @@ -32,7 +31,8 @@ struct LDAPModification }; typedef std::vector<LDAPModification> LDAPMods; -struct LDAPAttributes : public std::map<Anope::string, std::vector<Anope::string> > +struct LDAPAttributes final + : public std::map<Anope::string, std::vector<Anope::string>> { size_t size(const Anope::string &attr) const { @@ -43,8 +43,8 @@ struct LDAPAttributes : public std::map<Anope::string, std::vector<Anope::string const std::vector<Anope::string> keys() const { std::vector<Anope::string> k; - for (const_iterator it = this->begin(), it_end = this->end(); it != it_end; ++it) - k.push_back(it->first); + for (const auto &[key, _] : *this) + k.push_back(key); return k; } @@ -75,7 +75,7 @@ enum QueryType QUERY_MODIFY }; -struct LDAPResult +struct LDAPResult final { std::vector<LDAPAttributes> messages; Anope::string error; @@ -112,20 +112,21 @@ struct LDAPResult class LDAPInterface { - public: +public: 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; virtual void OnDelete() { } }; -class LDAPProvider : public Service +class LDAPProvider + : public Service { - public: +public: LDAPProvider(Module *c, const Anope::string &n) : Service(c, "LDAPProvider", n) { } /** Attempt to bind to the LDAP server as an admin @@ -167,5 +168,3 @@ class LDAPProvider : public Service */ virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0; }; - -#endif // ANOPE_LDAP_H |