V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
js-number-format-inl.h
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 ACCESSORS2(JSNumberFormat, locale, String, kLocaleOffset)
22 ACCESSORS(JSNumberFormat, icu_number_format, Managed<icu::NumberFormat>,
23  kICUNumberFormatOffset)
24 ACCESSORS(JSNumberFormat, bound_format, Object, kBoundFormatOffset)
25 SMI_ACCESSORS(JSNumberFormat, flags, kFlagsOffset)
26 
27 inline void JSNumberFormat::set_style(Style style) {
28  DCHECK_LT(style, Style::COUNT);
29  int hints = flags();
30  hints = StyleBits::update(hints, style);
31  set_flags(hints);
32 }
33 
34 inline JSNumberFormat::Style JSNumberFormat::style() const {
35  return StyleBits::decode(flags());
36 }
37 
38 inline void JSNumberFormat::set_currency_display(
39  CurrencyDisplay currency_display) {
40  DCHECK_LT(currency_display, CurrencyDisplay::COUNT);
41  int hints = flags();
42  hints = CurrencyDisplayBits::update(hints, currency_display);
43  set_flags(hints);
44 }
45 
46 inline JSNumberFormat::CurrencyDisplay JSNumberFormat::currency_display()
47  const {
48  return CurrencyDisplayBits::decode(flags());
49 }
50 
51 CAST_ACCESSOR(JSNumberFormat);
52 
53 } // namespace internal
54 } // namespace v8
55 
56 #include "src/objects/object-macros-undef.h"
57 
58 #endif // V8_OBJECTS_JS_NUMBER_FORMAT_INL_H_
Definition: libplatform.h:13