mirror of
https://github.com/zebrajr/ladybird.git
synced 2026-01-15 12:15:15 +00:00
AK: Provide a length_in_code_units API for UTF-8 strings
This is just to afford API symmetry with UTF-16 strings to help in templated methods.
This commit is contained in:
committed by
Andreas Kling
parent
41eaf0d966
commit
b1fe816336
@@ -74,6 +74,7 @@ public:
|
||||
[[nodiscard]] ReadonlyBytes bytes() const;
|
||||
[[nodiscard]] u32 hash() const;
|
||||
[[nodiscard]] size_t byte_count() const;
|
||||
[[nodiscard]] ALWAYS_INLINE size_t length_in_code_units() const { return byte_count(); }
|
||||
|
||||
[[nodiscard]] bool operator==(StringBase const&) const;
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ public:
|
||||
|
||||
unsigned char const* bytes() const { return begin_ptr(); }
|
||||
size_t byte_length() const { return m_string.length(); }
|
||||
[[nodiscard]] ALWAYS_INLINE size_t length_in_code_units() const { return byte_length(); }
|
||||
|
||||
size_t code_point_offset_of(size_t code_unit_offset) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user