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/js-date-time-format.h"
13#include "src/objects/objects-inl.h"
14
15// Has to be the last include (doesn't have include guards):
16#include "src/objects/object-macros.h"
17
18namespace v8 {
19namespace internal {
20
21#include "torque-generated/src/objects/js-date-time-format-tq-inl.inc"
22
23TQ_OBJECT_CONSTRUCTORS_IMPL(JSDateTimeFormat)
24
25ACCESSORS(JSDateTimeFormat, icu_locale, Managed<icu::Locale>, kIcuLocaleOffset)
26ACCESSORS(JSDateTimeFormat, icu_simple_date_format,
27          Managed<icu::SimpleDateFormat>, kIcuSimpleDateFormatOffset)
28ACCESSORS(JSDateTimeFormat, icu_date_interval_format,
29          Managed<icu::DateIntervalFormat>, kIcuDateIntervalFormatOffset)
30
31BOOL_ACCESSORS(JSDateTimeFormat, flags, alt_calendar, AltCalendarBit::kShift)
32
33inline void JSDateTimeFormat::set_hour_cycle(HourCycle hour_cycle) {
34  int hints = flags();
35  hints = HourCycleBits::update(hints, hour_cycle);
36  set_flags(hints);
37}
38
39inline JSDateTimeFormat::HourCycle JSDateTimeFormat::hour_cycle() const {
40  return HourCycleBits::decode(flags());
41}
42
43inline void JSDateTimeFormat::set_date_style(
44    JSDateTimeFormat::DateTimeStyle date_style) {
45  int hints = flags();
46  hints = DateStyleBits::update(hints, date_style);
47  set_flags(hints);
48}
49
50inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::date_style() const {
51  return DateStyleBits::decode(flags());
52}
53
54inline void JSDateTimeFormat::set_time_style(
55    JSDateTimeFormat::DateTimeStyle time_style) {
56  int hints = flags();
57  hints = TimeStyleBits::update(hints, time_style);
58  set_flags(hints);
59}
60
61inline JSDateTimeFormat::DateTimeStyle JSDateTimeFormat::time_style() const {
62  return TimeStyleBits::decode(flags());
63}
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_
71