6#error Internationalization is expected to be enabled.
22#include "unicode/brkiter.h"
34 icu::BreakIterator* incoming_break_iterator,
40 std::shared_ptr<icu::BreakIterator> break_iterator{
41 incoming_break_iterator->clone()};
47 break_iterator->first();
51 std::shared_ptr<icu::UnicodeString>
string =
52 std::make_shared<icu::UnicodeString>();
53 break_iterator->getText().getText(*
string);
57 break_iterator->setText(*
string);
65 segment_iterator->set_flags(0);
67 segment_iterator->set_icu_break_iterator(*managed_break_iterator);
68 segment_iterator->set_raw_string(*input_string);
71 return segment_iterator;
100 Factory* factory = isolate->factory();
101 icu::BreakIterator* icu_break_iterator =
102 segment_iterator->icu_break_iterator()->raw();
104 int32_t start_index = icu_break_iterator->current();
106 int32_t end_index = icu_break_iterator->next();
109 if (end_index == icu::BreakIterator::DONE) {
122 start_index == end_index - 1) {
125 uint16_t code = segment_iterator->raw_string()->Get(start_index);
132 isolate->native_context()->intl_segment_data_object_map(), isolate);
140 ?
Cast<String>(factory->single_character_string_table()->get(code))
149 isolate, segment_data,
151 isolate, segment_iterator->granularity(), icu_break_iterator,
153 *segment_iterator->unicode_string()->raw(), start_index,
static const uint16_t kMaxChar
Handle< HeapNumber > NewHeapNumber(double value)
Handle< String > LookupSingleCharacterStringFromCode(uint16_t code)
Handle< JSObject > NewJSObjectFromMap(DirectHandle< Map > map, AllocationType allocation=AllocationType::kYoung, DirectHandle< AllocationSite > allocation_site=DirectHandle< AllocationSite >::null(), NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
DirectHandle< JSIteratorResult > NewJSIteratorResult(DirectHandle< Object > value, bool done)
Handle< String > GranularityAsString(Isolate *isolate) const
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSReceiver > Next(Isolate *isolate, DirectHandle< JSSegmentIterator > segment_iterator_holder)
JSSegmenter::Granularity granularity() const
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSSegmentIterator > Create(Isolate *isolate, DirectHandle< String > input_string, icu::BreakIterator *icu_break_iterator, JSSegmenter::Granularity granularity)
static Handle< String > GetGranularityString(Isolate *isolate, Granularity granularity)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSSegmentDataObject > CreateSegmentDataObject(Isolate *isolate, JSSegmenter::Granularity granularity, icu::BreakIterator *break_iterator, DirectHandle< String > input_string, const icu::UnicodeString &unicode_string, int32_t start_index, int32_t end_index)
static DirectHandle< Managed< CppType > > From(Isolate *isolate, size_t estimated_size, std::shared_ptr< CppType > shared_ptr, AllocationType allocation_type=AllocationType::kYoung)
static constexpr Tagged< Smi > FromInt(int value)
static bool constexpr IsValid(T value)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call)
#define STACK_CHECK(isolate, result_value)
ZoneVector< RpoNumber > & result
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_NOT_NULL(val)