1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:28:13 +00:00

AK: Add some more utility methods to Utf8View

This commit is contained in:
Sergey Bugaev 2019-09-04 23:40:36 +03:00 committed by Andreas Kling
parent 95fe775d81
commit c379f43d2a
2 changed files with 27 additions and 1 deletions

View file

@ -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: