V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
js-segmenter-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_SEGMENTER_INL_H_
10 #define V8_OBJECTS_JS_SEGMENTER_INL_H_
11 
12 #include "src/objects-inl.h"
13 #include "src/objects/js-segmenter.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 segmenter accessors.
22 ACCESSORS2(JSSegmenter, locale, String, kLocaleOffset)
23 ACCESSORS(JSSegmenter, icu_break_iterator, Managed<icu::BreakIterator>,
24  kICUBreakIteratorOffset)
25 SMI_ACCESSORS(JSSegmenter, flags, kFlagsOffset)
26 
27 inline void JSSegmenter::set_line_break_style(LineBreakStyle line_break_style) {
28  DCHECK_GT(LineBreakStyle::COUNT, line_break_style);
29  int hints = flags();
30  hints = LineBreakStyleBits::update(hints, line_break_style);
31  set_flags(hints);
32 }
33 
34 inline JSSegmenter::LineBreakStyle JSSegmenter::line_break_style() const {
35  return LineBreakStyleBits::decode(flags());
36 }
37 
38 inline void JSSegmenter::set_granularity(Granularity granularity) {
39  DCHECK_GT(Granularity::COUNT, granularity);
40  int hints = flags();
41  hints = GranularityBits::update(hints, granularity);
42  set_flags(hints);
43 }
44 
45 inline JSSegmenter::Granularity JSSegmenter::granularity() const {
46  return GranularityBits::decode(flags());
47 }
48 
49 CAST_ACCESSOR(JSSegmenter);
50 
51 } // namespace internal
52 } // namespace v8
53 
54 #include "src/objects/object-macros-undef.h"
55 
56 #endif // V8_OBJECTS_JS_SEGMENTER_INL_H_
Definition: libplatform.h:13