V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
js-segment-iterator-inl.h
1 // Copyright 2018 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_INTL_SUPPORT
6 #error Internationalization is expected to be enabled.
7 #endif // V8_INTL_SUPPORT
8 
9 #ifndef V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
10 #define V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
11 
12 #include "src/objects-inl.h"
13 #include "src/objects/js-segment-iterator.h"
14 
15 // Has to be the last include (doesn't have include guards):
16 #include "src/objects/object-macros.h"
17 
18 namespace v8 {
19 namespace internal {
20 
21 // Base segment iterator accessors.
22 ACCESSORS(JSSegmentIterator, icu_break_iterator, Managed<icu::BreakIterator>,
23  kICUBreakIteratorOffset)
24 ACCESSORS(JSSegmentIterator, unicode_string, Managed<icu::UnicodeString>,
25  kUnicodeStringOffset)
26 
27 SMI_ACCESSORS(JSSegmentIterator, flags, kFlagsOffset)
28 
29 CAST_ACCESSOR(JSSegmentIterator);
30 
31 inline void JSSegmentIterator::set_granularity(
32  JSSegmenter::Granularity granularity) {
33  DCHECK_GT(JSSegmenter::Granularity::COUNT, granularity);
34  int hints = flags();
35  hints = GranularityBits::update(hints, granularity);
36  set_flags(hints);
37 }
38 
39 inline JSSegmenter::Granularity JSSegmentIterator::granularity() const {
40  return GranularityBits::decode(flags());
41 }
42 
43 } // namespace internal
44 } // namespace v8
45 
46 #include "src/objects/object-macros-undef.h"
47 
48 #endif // V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
Definition: libplatform.h:13