mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-24 16:40:21 +00:00
AK: Add a comparison operator for Utf32View
This commit is contained in:
parent
cf9693169c
commit
0703ba118b
Notes:
github-actions[bot]
2024-10-20 06:50:56 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/0703ba118b5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1861
2 changed files with 10 additions and 0 deletions
|
@ -27,6 +27,14 @@ Optional<u32> Utf32CodePointIterator::peek(size_t offset) const
|
|||
return *new_iterator;
|
||||
}
|
||||
|
||||
bool Utf32View::operator==(Utf32View const& other) const
|
||||
{
|
||||
ReadonlySpan<u32> code_points { m_code_points, m_length };
|
||||
ReadonlySpan<u32> other_code_points { other.m_code_points, other.m_length };
|
||||
|
||||
return code_points == other_code_points;
|
||||
}
|
||||
|
||||
ErrorOr<void> Formatter<Utf32View>::format(FormatBuilder& builder, Utf32View const& string)
|
||||
{
|
||||
return builder.builder().try_append(string);
|
||||
|
|
|
@ -119,6 +119,8 @@ public:
|
|||
return substring_view(offset, length() - offset);
|
||||
}
|
||||
|
||||
bool operator==(Utf32View const& other) const;
|
||||
|
||||
private:
|
||||
u32 const* begin_ptr() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue