1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:47:34 +00:00

Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case

Let's make it clear that these functions deal with ASCII case only.
This commit is contained in:
Andreas Kling 2023-03-10 08:48:54 +01:00
parent 03cc45e5a2
commit a504ac3e2a
76 changed files with 480 additions and 476 deletions

View file

@ -148,7 +148,7 @@ public:
return trimmed_view;
}
[[nodiscard]] bool equals_ignoring_case(StringView) const;
[[nodiscard]] bool equals_ignoring_ascii_case(StringView) const;
[[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool contains(char, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
@ -310,14 +310,14 @@ public:
}
template<typename... Ts>
[[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of_ignoring_case(Ts&&... strings) const
[[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of_ignoring_ascii_case(Ts&&... strings) const
{
return (... ||
[this, &strings]() -> bool {
if constexpr (requires(Ts a) { a.view()->StringView; })
return this->equals_ignoring_case(forward<Ts>(strings.view()));
return this->equals_ignoring_ascii_case(forward<Ts>(strings.view()));
else
return this->equals_ignoring_case(forward<Ts>(strings));
return this->equals_ignoring_ascii_case(forward<Ts>(strings));
}());
}
@ -330,9 +330,10 @@ struct Traits<DeprecatedString> : public GenericTraits<DeprecatedString> {
static unsigned hash(DeprecatedString const& s) { return s.impl() ? s.impl()->hash() : 0; }
};
// FIXME: Rename this to indicate that it's about ASCII-only case insensitivity.
struct CaseInsensitiveStringTraits : public Traits<DeprecatedString> {
static unsigned hash(DeprecatedString const& s) { return s.impl() ? s.impl()->case_insensitive_hash() : 0; }
static bool equals(DeprecatedString const& a, DeprecatedString const& b) { return a.equals_ignoring_case(b); }
static bool equals(DeprecatedString const& a, DeprecatedString const& b) { return a.equals_ignoring_ascii_case(b); }
};
DeprecatedString escape_html_entities(StringView html);