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_DATE_TIME_FORMAT_INL_H_
10 : #define V8_OBJECTS_JS_DATE_TIME_FORMAT_INL_H_
11 :
12 : #include "src/objects-inl.h"
13 : #include "src/objects/js-date-time-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 : OBJECT_CONSTRUCTORS_IMPL(JSDateTimeFormat, JSObject)
22 :
23 19794 : ACCESSORS(JSDateTimeFormat, icu_locale, Managed<icu::Locale>, kICULocaleOffset)
24 20778 : ACCESSORS(JSDateTimeFormat, icu_simple_date_format,
25 : Managed<icu::SimpleDateFormat>, kICUSimpleDateFormatOffset)
26 261 : ACCESSORS(JSDateTimeFormat, icu_date_interval_format,
27 : Managed<icu::DateIntervalFormat>, kICUDateIntervalFormatOffset)
28 2709 : ACCESSORS(JSDateTimeFormat, bound_format, Object, kBoundFormatOffset)
29 21101 : SMI_ACCESSORS(JSDateTimeFormat, flags, kFlagsOffset)
30 :
31 6416 : inline void JSDateTimeFormat::set_hour_cycle(Intl::HourCycle hour_cycle) {
32 : int hints = flags();
33 12832 : hints = HourCycleBits::update(hints, hour_cycle);
34 : set_flags(hints);
35 6416 : }
36 :
37 : inline Intl::HourCycle JSDateTimeFormat::hour_cycle() const {
38 2754 : return HourCycleBits::decode(flags());
39 : }
40 :
41 288 : inline void JSDateTimeFormat::set_date_style(
42 : JSDateTimeFormat::DateTimeStyle date_style) {
43 : int hints = flags();
44 576 : hints = DateStyleBits::update(hints, date_style);
45 : set_flags(hints);
46 288 : }
47 :
48 : inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::date_style() const {
49 5058 : return DateStyleBits::decode(flags());
50 : }
51 :
52 216 : inline void JSDateTimeFormat::set_time_style(
53 : JSDateTimeFormat::DateTimeStyle time_style) {
54 : int hints = flags();
55 432 : hints = TimeStyleBits::update(hints, time_style);
56 : set_flags(hints);
57 216 : }
58 :
59 : inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::time_style() const {
60 2529 : return TimeStyleBits::decode(flags());
61 : }
62 :
63 : CAST_ACCESSOR(JSDateTimeFormat)
64 :
65 : } // namespace internal
66 : } // namespace v8
67 :
68 : #include "src/objects/object-macros-undef.h"
69 :
70 : #endif // V8_OBJECTS_JS_DATE_TIME_FORMAT_INL_H_
|