mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:57:34 +00:00
LibJS: Start implementing Intl Segment Iterator objects
This commit is contained in:
parent
9802b16298
commit
6c26a02aa8
7 changed files with 129 additions and 0 deletions
35
Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.h
Normal file
35
Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/Intl/Segmenter.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
|
||||
namespace JS::Intl {
|
||||
|
||||
class SegmentIterator final : public Object {
|
||||
JS_OBJECT(SegmentIterator, Object);
|
||||
|
||||
public:
|
||||
static SegmentIterator* create(GlobalObject&, Segmenter&, String);
|
||||
|
||||
SegmentIterator(GlobalObject&, Segmenter&, String);
|
||||
virtual ~SegmentIterator() override = default;
|
||||
|
||||
Segmenter const& iterating_segmenter() const { return m_iterating_segmenter; }
|
||||
String const& iterated_string() const { return m_iterated_string; }
|
||||
size_t iterated_string_next_segment_code_unit_index() const { return m_iterated_string_next_segment_code_unit_index; }
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Segmenter& m_iterating_segmenter; // [[IteratingSegmenter]]
|
||||
String m_iterated_string; // [[IteratedString]]
|
||||
size_t m_iterated_string_next_segment_code_unit_index { 0 }; // [[IteratedStringNextSegmentCodeUnitIndex]]
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue