This commit is contained in:
2025-09-24 18:23:17 +03:00
parent b1a48d2b77
commit f729799335
5 changed files with 203 additions and 83 deletions

View File

@@ -16,15 +16,15 @@
#include "mcc_traits.h"
namespace mcc
namespace mcc::network
{
namespace utils
{
static constexpr bool mcc_char_subrange_compare(const traits::mcc_char_view auto& what,
const traits::mcc_char_view auto& where,
bool case_insensitive = false)
static constexpr bool mcc_char_range_compare(const traits::mcc_char_view auto& what,
const traits::mcc_char_view auto& where,
bool case_insensitive = false)
{
if (std::ranges::size(what) == std::ranges::size(where)) {
if (case_insensitive) {
@@ -201,7 +201,7 @@ public:
if (isLocal()) { // check for special values
idx = 0;
if (std::ranges::any_of(validLocalProtoTypes, [&idx, this](const auto& el) {
bool ok = utils::mcc_char_subrange_compare(_host, el, true);
bool ok = utils::mcc_char_range_compare(_host, el, true);
if (!ok) {
++idx;
}
@@ -398,7 +398,7 @@ protected:
// case-insensitive look-up
bool found = std::ranges::any_of(MccServerEndpoint::validProtoMarks, [&idx, &proto_mark](const auto& el) {
bool ok = utils::mcc_char_subrange_compare(proto_mark, el, true);
bool ok = utils::mcc_char_range_compare(proto_mark, el, true);
if (!ok) {
++idx;
@@ -509,4 +509,4 @@ protected:
}
};
} // namespace mcc
} // namespace mcc::network