mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 10:05:32 +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:
parent
55fa51b4e2
commit
a245ea1743
|
@ -81,6 +81,14 @@ public:
|
|||
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; }
|
||||
bool is_empty() const { return m_length == 0; }
|
||||
bool is_null() const { return !m_code_points; }
|
||||
|
|
Loading…
Reference in a new issue