summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
Diffstat (limited to 'AK')
-rw-r--r--AK/DeprecatedFlyString.cpp4
-rw-r--r--AK/DeprecatedFlyString.h2
-rw-r--r--AK/DeprecatedString.cpp4
-rw-r--r--AK/DeprecatedString.h11
-rw-r--r--AK/FlyString.cpp3
-rw-r--r--AK/StringUtils.cpp2
-rw-r--r--AK/StringUtils.h2
-rw-r--r--AK/StringView.cpp4
-rw-r--r--AK/StringView.h11
-rw-r--r--AK/URLParser.cpp4
10 files changed, 24 insertions, 23 deletions
diff --git a/AK/DeprecatedFlyString.cpp b/AK/DeprecatedFlyString.cpp
index 84e6fc9c7a..bb302df90b 100644
--- a/AK/DeprecatedFlyString.cpp
+++ b/AK/DeprecatedFlyString.cpp
@@ -107,9 +107,9 @@ Optional<float> DeprecatedFlyString::to_float(TrimWhitespace trim_whitespace) co
}
#endif
-bool DeprecatedFlyString::equals_ignoring_case(StringView other) const
+bool DeprecatedFlyString::equals_ignoring_ascii_case(StringView other) const
{
- return StringUtils::equals_ignoring_case(view(), other);
+ return StringUtils::equals_ignoring_ascii_case(view(), other);
}
bool DeprecatedFlyString::starts_with(StringView str, CaseSensitivity case_sensitivity) const
diff --git a/AK/DeprecatedFlyString.h b/AK/DeprecatedFlyString.h
index 395cb1496e..76d924da09 100644
--- a/AK/DeprecatedFlyString.h
+++ b/AK/DeprecatedFlyString.h
@@ -78,7 +78,7 @@ public:
Optional<float> to_float(TrimWhitespace = TrimWhitespace::Yes) const;
#endif
- bool equals_ignoring_case(StringView) const;
+ bool equals_ignoring_ascii_case(StringView) const;
bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
diff --git a/AK/DeprecatedString.cpp b/AK/DeprecatedString.cpp
index 437b27a71a..ac1a07a7ee 100644
--- a/AK/DeprecatedString.cpp
+++ b/AK/DeprecatedString.cpp
@@ -346,9 +346,9 @@ bool DeprecatedString::contains(char needle, CaseSensitivity case_sensitivity) c
return StringUtils::contains(*this, StringView(&needle, 1), case_sensitivity);
}
-bool DeprecatedString::equals_ignoring_case(StringView other) const
+bool DeprecatedString::equals_ignoring_ascii_case(StringView other) const
{
- return StringUtils::equals_ignoring_case(view(), other);
+ return StringUtils::equals_ignoring_ascii_case(view(), other);
}
DeprecatedString DeprecatedString::reverse() const
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);
diff --git a/AK/FlyString.cpp b/AK/FlyString.cpp
index 648b8cf492..d745768ade 100644
--- a/AK/FlyString.cpp
+++ b/AK/FlyString.cpp
@@ -182,8 +182,7 @@ bool FlyString::equals_ignoring_ascii_case(FlyString const& other) const
{
if (*this == other)
return true;
- // FIXME: Rename StringUtils::equals_ignoring_case to equals_ignoring_ascii_case.
- return StringUtils::equals_ignoring_case(bytes_as_string_view(), other.bytes_as_string_view());
+ return StringUtils::equals_ignoring_ascii_case(bytes_as_string_view(), other.bytes_as_string_view());
}
}
diff --git a/AK/StringUtils.cpp b/AK/StringUtils.cpp
index b7b6dd030f..35730bfd34 100644
--- a/AK/StringUtils.cpp
+++ b/AK/StringUtils.cpp
@@ -254,7 +254,7 @@ template Optional<double> convert_to_floating_point(StringView str, TrimWhitespa
template Optional<float> convert_to_floating_point(StringView str, TrimWhitespace);
#endif
-bool equals_ignoring_case(StringView a, StringView b)
+bool equals_ignoring_ascii_case(StringView a, StringView b)
{
if (a.length() != b.length())
return false;
diff --git a/AK/StringUtils.h b/AK/StringUtils.h
index 8f7fb2f490..591340b993 100644
--- a/AK/StringUtils.h
+++ b/AK/StringUtils.h
@@ -79,7 +79,7 @@ Optional<T> convert_to_uint_from_octal(StringView, TrimWhitespace = TrimWhitespa
template<typename T>
Optional<T> convert_to_floating_point(StringView, TrimWhitespace = TrimWhitespace::Yes);
#endif
-bool equals_ignoring_case(StringView, StringView);
+bool equals_ignoring_ascii_case(StringView, StringView);
bool ends_with(StringView a, StringView b, CaseSensitivity);
bool starts_with(StringView, StringView, CaseSensitivity);
bool contains(StringView, StringView, CaseSensitivity);
diff --git a/AK/StringView.cpp b/AK/StringView.cpp
index 4252dcea35..66d8d54ab2 100644
--- a/AK/StringView.cpp
+++ b/AK/StringView.cpp
@@ -170,9 +170,9 @@ bool StringView::contains(StringView needle, CaseSensitivity case_sensitivity) c
return StringUtils::contains(*this, needle, case_sensitivity);
}
-bool StringView::equals_ignoring_case(StringView other) const
+bool StringView::equals_ignoring_ascii_case(StringView other) const
{
- return StringUtils::equals_ignoring_case(*this, other);
+ return StringUtils::equals_ignoring_ascii_case(*this, other);
}
#ifndef KERNEL
diff --git a/AK/StringView.h b/AK/StringView.h
index dd6fe9540e..aeccf623c4 100644
--- a/AK/StringView.h
+++ b/AK/StringView.h
@@ -104,7 +104,7 @@ public:
[[nodiscard]] bool contains(char) const;
[[nodiscard]] bool contains(u32) const;
[[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
- [[nodiscard]] bool equals_ignoring_case(StringView other) const;
+ [[nodiscard]] bool equals_ignoring_ascii_case(StringView) const;
[[nodiscard]] StringView trim(StringView characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); }
[[nodiscard]] StringView trim_whitespace(TrimMode mode = TrimMode::Both) const { return StringUtils::trim_whitespace(*this, mode); }
@@ -337,14 +337,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));
}());
}
@@ -359,6 +359,7 @@ struct Traits<StringView> : public GenericTraits<StringView> {
static unsigned hash(StringView s) { return s.hash(); }
};
+// FIXME: Rename this to indicate that it's about ASCII-only case insensitivity.
struct CaseInsensitiveStringViewTraits : public Traits<StringView> {
static unsigned hash(StringView s)
{
@@ -366,7 +367,7 @@ struct CaseInsensitiveStringViewTraits : public Traits<StringView> {
return 0;
return case_insensitive_string_hash(s.characters_without_null_termination(), s.length());
}
- static bool equals(StringView const& a, StringView const& b) { return a.equals_ignoring_case(b); }
+ static bool equals(StringView const& a, StringView const& b) { return a.equals_ignoring_ascii_case(b); }
};
}
diff --git a/AK/URLParser.cpp b/AK/URLParser.cpp
index 50eec3d167..ee949c2a92 100644
--- a/AK/URLParser.cpp
+++ b/AK/URLParser.cpp
@@ -108,12 +108,12 @@ constexpr bool is_normalized_windows_drive_letter(StringView input)
constexpr bool is_single_dot_path_segment(StringView input)
{
- return input == "."sv || input.equals_ignoring_case("%2e"sv);
+ return input == "."sv || input.equals_ignoring_ascii_case("%2e"sv);
}
constexpr bool is_double_dot_path_segment(StringView input)
{
- return input == ".."sv || input.equals_ignoring_case(".%2e"sv) || input.equals_ignoring_case("%2e."sv) || input.equals_ignoring_case("%2e%2e"sv);
+ return input == ".."sv || input.equals_ignoring_ascii_case(".%2e"sv) || input.equals_ignoring_ascii_case("%2e."sv) || input.equals_ignoring_ascii_case("%2e%2e"sv);
}
// https://url.spec.whatwg.org/#string-percent-encode-after-encoding