Line data Source code
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 12276 : OBJECT_CONSTRUCTORS_IMPL(JSSegmenter, JSObject)
22 :
23 : // Base segmenter accessors.
24 7785 : ACCESSORS(JSSegmenter, locale, String, kLocaleOffset)
25 10395 : ACCESSORS(JSSegmenter, icu_break_iterator, Managed<icu::BreakIterator>,
26 : kICUBreakIteratorOffset)
27 21438 : SMI_ACCESSORS(JSSegmenter, flags, kFlagsOffset)
28 :
29 1215 : inline void JSSegmenter::set_line_break_style(LineBreakStyle line_break_style) {
30 : DCHECK_GT(LineBreakStyle::COUNT, line_break_style);
31 : int hints = flags();
32 2430 : hints = LineBreakStyleBits::update(hints, line_break_style);
33 : set_flags(hints);
34 1215 : }
35 :
36 : inline JSSegmenter::LineBreakStyle JSSegmenter::line_break_style() const {
37 945 : return LineBreakStyleBits::decode(flags());
38 : }
39 :
40 1215 : inline void JSSegmenter::set_granularity(Granularity granularity) {
41 : DCHECK_GT(Granularity::COUNT, granularity);
42 : int hints = flags();
43 2430 : hints = GranularityBits::update(hints, granularity);
44 : set_flags(hints);
45 1215 : }
46 :
47 4860 : inline JSSegmenter::Granularity JSSegmenter::granularity() const {
48 9720 : return GranularityBits::decode(flags());
49 : }
50 :
51 6138 : CAST_ACCESSOR(JSSegmenter);
52 :
53 : } // namespace internal
54 : } // namespace v8
55 :
56 : #include "src/objects/object-macros-undef.h"
57 :
58 : #endif // V8_OBJECTS_JS_SEGMENTER_INL_H_
|