mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
AK: Add some more utility methods to Utf8View
This commit is contained in:
parent
95fe775d81
commit
c379f43d2a
Notes:
sideshowbarker
2024-07-19 12:16:26 +09:00
Author: https://github.com/bugaevc
Commit: c379f43d2a
Pull-request: https://github.com/SerenityOS/serenity/pull/520
Reviewed-by: https://github.com/awesomekling
2 changed files with 27 additions and 1 deletions
|
@ -26,6 +26,7 @@ private:
|
|||
|
||||
class Utf8View {
|
||||
public:
|
||||
explicit Utf8View(const String&);
|
||||
explicit Utf8View(const StringView&);
|
||||
~Utf8View() {}
|
||||
|
||||
|
@ -34,6 +35,12 @@ public:
|
|||
Utf8CodepointIterator begin() const;
|
||||
Utf8CodepointIterator end() const;
|
||||
|
||||
const unsigned char* bytes() const { return begin_ptr(); }
|
||||
int byte_length() const { return m_string.length(); }
|
||||
int byte_offset_of(const Utf8CodepointIterator&) const;
|
||||
Utf8View substring_view(int byte_offset, int byte_length) const;
|
||||
bool is_empty() const { return m_string.is_empty(); }
|
||||
|
||||
bool validate() const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue