diff options
author | Andreas Kling <kling@serenityos.org> | 2023-03-10 08:48:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-10 13:15:44 +0100 |
commit | a504ac3e2a57654b96501b3a1ba80f37b3381dc8 (patch) | |
tree | 767a7e21a858e4b5c6dfec77dd52b540a0e4cf49 /AK/DeprecatedString.h | |
parent | 03cc45e5a2ecc5d173aa121404d7ed8251c109f8 (diff) | |
download | serenity-a504ac3e2a57654b96501b3a1ba80f37b3381dc8.zip |
Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
Diffstat (limited to 'AK/DeprecatedString.h')
-rw-r--r-- | AK/DeprecatedString.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/AK/DeprecatedString.h b/AK/DeprecatedString.h index 9f6091404d..21952cd4b2 100644 --- a/AK/DeprecatedString.h +++ b/AK/DeprecatedString.h @@ -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); |