mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
AK: Add a way to get the number of valid bytes in a Utf8View
This commit is contained in:
parent
07c765e258
commit
a4e0b585fe
Notes:
sideshowbarker
2024-07-19 06:31:46 +09:00
Author: https://github.com/alimpfard
Commit: a4e0b585fe
Pull-request: https://github.com/SerenityOS/serenity/pull/2278
3 changed files with 24 additions and 9 deletions
|
@ -37,7 +37,7 @@ class Utf8CodepointIterator {
|
|||
friend class Utf8View;
|
||||
|
||||
public:
|
||||
~Utf8CodepointIterator() {}
|
||||
~Utf8CodepointIterator() { }
|
||||
|
||||
bool operator==(const Utf8CodepointIterator&) const;
|
||||
bool operator!=(const Utf8CodepointIterator&) const;
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
explicit Utf8View(const String&);
|
||||
explicit Utf8View(const StringView&);
|
||||
explicit Utf8View(const char*);
|
||||
~Utf8View() {}
|
||||
~Utf8View() { }
|
||||
|
||||
const StringView& as_string() const { return m_string; }
|
||||
|
||||
|
@ -70,7 +70,12 @@ public:
|
|||
Utf8View substring_view(int byte_offset, int byte_length) const;
|
||||
bool is_empty() const { return m_string.is_empty(); }
|
||||
|
||||
bool validate() const;
|
||||
bool validate(size_t& valid_bytes) const;
|
||||
bool validate() const
|
||||
{
|
||||
size_t valid_bytes;
|
||||
return validate(valid_bytes);
|
||||
}
|
||||
|
||||
size_t length_in_codepoints() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue