mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add the at()/operator[]() getter to Utf32View
This is trivial, and makes it easier to get the code point compared to the previous `.code_points()[index]` (which was not actually checked for in-bounds length).
This commit is contained in:
committed by
Ali Mohammad Pur
parent
55fa51b4e2
commit
a245ea1743
@@ -81,6 +81,14 @@ public:
|
|||||||
return { end_ptr(), 0 };
|
return { end_ptr(), 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 at(size_t index) const
|
||||||
|
{
|
||||||
|
VERIFY(index < m_length);
|
||||||
|
return m_code_points[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 operator[](size_t index) const { return at(index); }
|
||||||
|
|
||||||
const u32* code_points() const { return m_code_points; }
|
const u32* code_points() const { return m_code_points; }
|
||||||
bool is_empty() const { return m_length == 0; }
|
bool is_empty() const { return m_length == 0; }
|
||||||
bool is_null() const { return !m_code_points; }
|
bool is_null() const { return !m_code_points; }
|
||||||
|
|||||||
Reference in New Issue
Block a user