mirror of
https://github.com/SerenityOS/serenity
synced 2026-04-25 17:15:42 +02:00
AK: Add a comparison operator for Utf32View
(cherry picked from commit 0703ba118b56aaa924346ae36c8826764dadd409)
This commit is contained in:
committed by
Nico Weber
parent
d0f3347017
commit
814f13db04
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user