mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-02 12:30:31 +00:00
AK: Add two helpers to DeprecatedStringCodePointIterator
This commit is contained in:
parent
f4c1269d4c
commit
6b497b8710
Notes:
sideshowbarker
2024-07-17 00:59:26 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6b497b8710
1 changed files with 12 additions and 0 deletions
|
@ -141,6 +141,18 @@ public:
|
|||
return value;
|
||||
}
|
||||
|
||||
[[nodiscard]] Optional<u32> peek() const
|
||||
{
|
||||
if (m_it.done())
|
||||
return {};
|
||||
return *m_it;
|
||||
}
|
||||
|
||||
[[nodiscard]] size_t byte_offset() const
|
||||
{
|
||||
return Utf8View(m_string).byte_offset_of(m_it);
|
||||
}
|
||||
|
||||
DeprecatedStringCodePointIterator(DeprecatedString string)
|
||||
: m_string(move(string))
|
||||
, m_it(Utf8View(m_string).begin())
|
||||
|
|
Loading…
Reference in a new issue