MCPcopy Create free account
hub / github.com/apache/trafficserver / test_eq

Method test_eq

plugins/header_rewrite/matcher.cc:55–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53// Special case for strings, to allow for insensitive case comparisons for std::string matchers.
54template <>
55bool
56Matchers<std::string>::test_eq(const std::string &t) const
57{
58 bool r = false;
59
60 if (_data.length() == t.length()) {
61 if (_nocase) {
62 // ToDo: in C++20, this would be nicer with std::range, e.g.
63 // r = std::ranges::equal(_data, t, [](char c1, char c2) { return std::tolower(c1) == std::tolower(c2); });
64 r = std::equal(_data.begin(), _data.end(), t.begin(), [](char c1, char c2) {
65 return std::tolower(static_cast<unsigned char>(c1)) == std::tolower(static_cast<unsigned char>(c2));
66 });
67 } else {
68 r = (t == _data);
69 }
70 }
71
72 if (pi_dbg_ctl.on()) {
73 debug_helper(t, " == ", r);
74 }
75
76 return r;
77}

Callers

nothing calls this directly

Calls 5

tolowerFunction · 0.85
lengthMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected