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 19374 : ACCESSORS(JSDateTimeFormat, icu_locale, Managed<icu::Locale>, kICULocaleOffset)
24 20298 : ACCESSORS(JSDateTimeFormat, icu_simple_date_format,
25 : Managed<icu::SimpleDateFormat>, kICUSimpleDateFormatOffset)
26 2709 : ACCESSORS(JSDateTimeFormat, bound_format, Object, kBoundFormatOffset)
27 18340 : SMI_ACCESSORS(JSDateTimeFormat, flags, kFlagsOffset)
28 :
29 6268 : inline void JSDateTimeFormat::set_hour_cycle(Intl::HourCycle hour_cycle) {
30 : int hints = flags();
31 12536 : hints = HourCycleBits::update(hints, hour_cycle);
32 : set_flags(hints);
33 6268 : }
34 :
35 : inline Intl::HourCycle JSDateTimeFormat::hour_cycle() const {
36 2754 : return HourCycleBits::decode(flags());
37 : }
38 :
39 288 : inline void JSDateTimeFormat::set_date_style(
40 : JSDateTimeFormat::DateTimeStyle date_style) {
41 : int hints = flags();
42 576 : hints = DateStyleBits::update(hints, date_style);
43 : set_flags(hints);
44 288 : }
45 :
46 : inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::date_style() const {
47 2529 : return DateStyleBits::decode(flags());
48 : }
49 :
50 216 : inline void JSDateTimeFormat::set_time_style(
51 : JSDateTimeFormat::DateTimeStyle time_style) {
52 : int hints = flags();
53 432 : hints = TimeStyleBits::update(hints, time_style);
54 : set_flags(hints);
55 216 : }
56 :
57 : inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::time_style() const {
58 : return TimeStyleBits::decode(flags());
59 : }
60 :
61 : CAST_ACCESSOR(JSDateTimeFormat)
62 :
63 : } // namespace internal
64 : } // namespace v8
65 :
66 : #include "src/objects/object-macros-undef.h"
67 :
68 : #endif // V8_OBJECTS_JS_DATE_TIME_FORMAT_INL_H_
|