mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 16:28:54 +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:
parent
41eaf0d966
commit
b1fe816336
Notes:
github-actions[bot]
2025-08-22 12:08:12 +00:00
Author: https://github.com/trflynn89
Commit: b1fe816336
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5930
2 changed files with 2 additions and 0 deletions
|
@ -74,6 +74,7 @@ public:
|
||||||
[[nodiscard]] ReadonlyBytes bytes() const;
|
[[nodiscard]] ReadonlyBytes bytes() const;
|
||||||
[[nodiscard]] u32 hash() const;
|
[[nodiscard]] u32 hash() const;
|
||||||
[[nodiscard]] size_t byte_count() 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;
|
[[nodiscard]] bool operator==(StringBase const&) const;
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ public:
|
||||||
|
|
||||||
unsigned char const* bytes() const { return begin_ptr(); }
|
unsigned char const* bytes() const { return begin_ptr(); }
|
||||||
size_t byte_length() const { return m_string.length(); }
|
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;
|
size_t code_point_offset_of(size_t code_unit_offset) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue