diff options
| author | 2022-11-21 13:14:19 +0000 | |
|---|---|---|
| committer | 2022-11-21 13:14:19 +0000 | |
| commit | 07246800fd2e44128adfa09fe91ce10b3ef0bcfc (patch) | |
| tree | 964d9fc4275dc612e5dfb083d2d1abb035fa1719 /include | |
| parent | Fix iterator_range when the range points to a string_view. (diff) | |
Use string_view in IsNick/IsIdent/IsChannel.
Diffstat (limited to 'include')
| -rw-r--r-- | include/channelmanager.h | 4 | ||||
| -rw-r--r-- | include/inspircd.h | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/channelmanager.h b/include/channelmanager.h index 69acf5a7a..de3d25cf3 100644 --- a/include/channelmanager.h +++ b/include/channelmanager.h @@ -31,14 +31,14 @@ private: public: /** Determines whether an channel name is valid. */ - std::function<bool(const std::string&)> IsChannel = DefaultIsChannel; + std::function<bool(const std::string_view&)> IsChannel = DefaultIsChannel; /** Determines whether a channel name is valid according to the RFC 1459 rules. * This is the default function for InspIRCd::IsChannel. * @param channel The channel name to validate. * @return True if the channel name is valid according to RFC 1459 rules; otherwise, false. */ - static bool DefaultIsChannel(const std::string& channel); + static bool DefaultIsChannel(const std::string_view& channel); /** Finds a channel by name. * @param channel The name of the channel to look up. diff --git a/include/inspircd.h b/include/inspircd.h index 8beeae9b1..0ca6bf8c4 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -373,24 +373,24 @@ public: static std::string Format(va_list& vaList, const char* formatString) ATTR_PRINTF(2, 0); /** Determines whether a nickname is valid. */ - std::function<bool(const std::string&)> IsNick; + std::function<bool(const std::string_view&)> IsNick; /** Determines whether a nickname is valid according to the RFC 1459 rules. * This is the default function for InspIRCd::IsNick. * @param nick The nickname to validate. * @return True if the nickname is valid according to RFC 1459 rules; otherwise, false. */ - static bool DefaultIsNick(const std::string& nick); + static bool DefaultIsNick(const std::string_view& nick); /** Determines whether an ident is valid. */ - std::function<bool(const std::string&)> IsIdent; + std::function<bool(const std::string_view&)> IsIdent; /** Determines whether a ident is valid according to the RFC 1459 rules. * This is the default function for InspIRCd::IsIdent. * @param ident The ident to validate. * @return True if the ident is valid according to RFC 1459 rules; otherwise, false. */ - static bool DefaultIsIdent(const std::string& ident); + static bool DefaultIsIdent(const std::string_view& ident); /** Match two strings using pattern matching, optionally, with a map * to check case against (may be NULL). If map is null, match will be case insensitive. |
