11cb0ef41Sopenharmony_ci// Copyright 2020 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci#ifndef V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
51cb0ef41Sopenharmony_ci#define V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci#ifndef V8_INTL_SUPPORT
81cb0ef41Sopenharmony_ci#error Internationalization is expected to be enabled.
91cb0ef41Sopenharmony_ci#endif  // V8_INTL_SUPPORT
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci#include "src/objects/js-segment-iterator.h"
121cb0ef41Sopenharmony_ci#include "src/objects/objects-inl.h"
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci// Has to be the last include (doesn't have include guards):
151cb0ef41Sopenharmony_ci#include "src/objects/object-macros.h"
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cinamespace v8 {
181cb0ef41Sopenharmony_cinamespace internal {
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci#include "torque-generated/src/objects/js-segment-iterator-tq-inl.inc"
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ciTQ_OBJECT_CONSTRUCTORS_IMPL(JSSegmentIterator)
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci// Base segment iterator accessors.
251cb0ef41Sopenharmony_ciACCESSORS(JSSegmentIterator, icu_break_iterator, Managed<icu::BreakIterator>,
261cb0ef41Sopenharmony_ci          kIcuBreakIteratorOffset)
271cb0ef41Sopenharmony_ciACCESSORS(JSSegmentIterator, unicode_string, Managed<icu::UnicodeString>,
281cb0ef41Sopenharmony_ci          kUnicodeStringOffset)
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciinline void JSSegmentIterator::set_granularity(
311cb0ef41Sopenharmony_ci    JSSegmenter::Granularity granularity) {
321cb0ef41Sopenharmony_ci  DCHECK_GE(GranularityBits::kMax, granularity);
331cb0ef41Sopenharmony_ci  int hints = flags();
341cb0ef41Sopenharmony_ci  hints = GranularityBits::update(hints, granularity);
351cb0ef41Sopenharmony_ci  set_flags(hints);
361cb0ef41Sopenharmony_ci}
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ciinline JSSegmenter::Granularity JSSegmentIterator::granularity() const {
391cb0ef41Sopenharmony_ci  return GranularityBits::decode(flags());
401cb0ef41Sopenharmony_ci}
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci}  // namespace internal
431cb0ef41Sopenharmony_ci}  // namespace v8
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ci#include "src/objects/object-macros-undef.h"
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci#endif  // V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
48