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_NUMBER_FORMAT_INL_H_
10 : #define V8_OBJECTS_JS_NUMBER_FORMAT_INL_H_
11 :
12 : #include "src/objects-inl.h"
13 : #include "src/objects/js-number-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(JSNumberFormat, JSObject)
22 :
23 11182 : ACCESSORS(JSNumberFormat, locale, String, kLocaleOffset)
24 14528 : ACCESSORS(JSNumberFormat, icu_number_format, Managed<icu::NumberFormat>,
25 : kICUNumberFormatOffset)
26 13990 : ACCESSORS(JSNumberFormat, bound_format, Object, kBoundFormatOffset)
27 5866 : SMI_ACCESSORS(JSNumberFormat, flags, kFlagsOffset)
28 :
29 2087 : inline void JSNumberFormat::set_style(Style style) {
30 : DCHECK_LT(style, Style::COUNT);
31 : int hints = flags();
32 4174 : hints = StyleBits::update(hints, style);
33 : set_flags(hints);
34 2087 : }
35 :
36 : inline JSNumberFormat::Style JSNumberFormat::style() const {
37 1494 : return StyleBits::decode(flags());
38 : }
39 :
40 117 : inline void JSNumberFormat::set_currency_display(
41 : CurrencyDisplay currency_display) {
42 : DCHECK_LT(currency_display, CurrencyDisplay::COUNT);
43 : int hints = flags();
44 234 : hints = CurrencyDisplayBits::update(hints, currency_display);
45 : set_flags(hints);
46 117 : }
47 :
48 : inline JSNumberFormat::CurrencyDisplay JSNumberFormat::currency_display()
49 : const {
50 9 : return CurrencyDisplayBits::decode(flags());
51 : }
52 :
53 : CAST_ACCESSOR(JSNumberFormat)
54 :
55 : } // namespace internal
56 : } // namespace v8
57 :
58 : #include "src/objects/object-macros-undef.h"
59 :
60 : #endif // V8_OBJECTS_JS_NUMBER_FORMAT_INL_H_
|