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_LIST_FORMAT_INL_H_
10 #define V8_OBJECTS_JS_LIST_FORMAT_INL_H_
11
12 #include "src/objects-inl.h"
13 #include "src/objects/js-list-format.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 list format accessors.
ACCESSORS(JSListFormat,locale,String,kLocaleOffset)22 ACCESSORS(JSListFormat, locale, String, kLocaleOffset)
23 ACCESSORS(JSListFormat, formatter, Foreign, kFormatterOffset)
24 SMI_ACCESSORS(JSListFormat, flags, kFlagsOffset)
25
26 inline void JSListFormat::set_style(Style style) {
27 DCHECK_GT(Style::COUNT, style);
28 int hints = flags();
29 hints = StyleBits::update(hints, style);
30 set_flags(hints);
31 }
32
style()33 inline JSListFormat::Style JSListFormat::style() const {
34 return StyleBits::decode(flags());
35 }
36
set_type(Type type)37 inline void JSListFormat::set_type(Type type) {
38 DCHECK_GT(Type::COUNT, type);
39 int hints = flags();
40 hints = TypeBits::update(hints, type);
41 set_flags(hints);
42 }
43
type()44 inline JSListFormat::Type JSListFormat::type() const {
45 return TypeBits::decode(flags());
46 }
47
48 CAST_ACCESSOR(JSListFormat);
49
50 } // namespace internal
51 } // namespace v8
52
53 #include "src/objects/object-macros-undef.h"
54
55 #endif // V8_OBJECTS_JS_LIST_FORMAT_INL_H_
56