V8 Project
i18n.h
Go to the documentation of this file.
1 // Copyright 2013 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 // limitations under the License.
5 
6 #ifndef V8_I18N_H_
7 #define V8_I18N_H_
8 
9 #include "src/v8.h"
10 #include "unicode/uversion.h"
11 
12 namespace U_ICU_NAMESPACE {
13 class BreakIterator;
14 class Collator;
15 class DecimalFormat;
16 class SimpleDateFormat;
17 }
18 
19 namespace v8 {
20 namespace internal {
21 
22 class I18N {
23  public:
24  // Creates an ObjectTemplate with one internal field.
26 
27  // Creates an ObjectTemplate with two internal fields.
29 
30  private:
31  I18N();
32 };
33 
34 
35 class DateFormat {
36  public:
37  // Create a formatter for the specificied locale and options. Returns the
38  // resolved settings for the locale / options.
39  static icu::SimpleDateFormat* InitializeDateTimeFormat(
40  Isolate* isolate,
41  Handle<String> locale,
42  Handle<JSObject> options,
43  Handle<JSObject> resolved);
44 
45  // Unpacks date format object from corresponding JavaScript object.
46  static icu::SimpleDateFormat* UnpackDateFormat(Isolate* isolate,
47  Handle<JSObject> obj);
48 
49  // Release memory we allocated for the DateFormat once the JS object that
50  // holds the pointer gets garbage collected.
51  static void DeleteDateFormat(
53 
54  private:
56 };
57 
58 
59 class NumberFormat {
60  public:
61  // Create a formatter for the specificied locale and options. Returns the
62  // resolved settings for the locale / options.
63  static icu::DecimalFormat* InitializeNumberFormat(
64  Isolate* isolate,
65  Handle<String> locale,
66  Handle<JSObject> options,
67  Handle<JSObject> resolved);
68 
69  // Unpacks number format object from corresponding JavaScript object.
70  static icu::DecimalFormat* UnpackNumberFormat(Isolate* isolate,
71  Handle<JSObject> obj);
72 
73  // Release memory we allocated for the NumberFormat once the JS object that
74  // holds the pointer gets garbage collected.
75  static void DeleteNumberFormat(
77 
78  private:
80 };
81 
82 
83 class Collator {
84  public:
85  // Create a collator for the specificied locale and options. Returns the
86  // resolved settings for the locale / options.
87  static icu::Collator* InitializeCollator(
88  Isolate* isolate,
89  Handle<String> locale,
90  Handle<JSObject> options,
91  Handle<JSObject> resolved);
92 
93  // Unpacks collator object from corresponding JavaScript object.
94  static icu::Collator* UnpackCollator(Isolate* isolate, Handle<JSObject> obj);
95 
96  // Release memory we allocated for the Collator once the JS object that holds
97  // the pointer gets garbage collected.
98  static void DeleteCollator(
100 
101  private:
103 };
104 
106  public:
107  // Create a BreakIterator for the specificied locale and options. Returns the
108  // resolved settings for the locale / options.
109  static icu::BreakIterator* InitializeBreakIterator(
110  Isolate* isolate,
111  Handle<String> locale,
112  Handle<JSObject> options,
113  Handle<JSObject> resolved);
114 
115  // Unpacks break iterator object from corresponding JavaScript object.
116  static icu::BreakIterator* UnpackBreakIterator(Isolate* isolate,
117  Handle<JSObject> obj);
118 
119  // Release memory we allocated for the BreakIterator once the JS object that
120  // holds the pointer gets garbage collected.
121  static void DeleteBreakIterator(
123 
124  private:
126 };
127 
128 } } // namespace v8::internal
129 
130 #endif // V8_I18N_H_
static icu::BreakIterator * UnpackBreakIterator(Isolate *isolate, Handle< JSObject > obj)
Definition: i18n.cc:911
static icu::BreakIterator * InitializeBreakIterator(Isolate *isolate, Handle< String > locale, Handle< JSObject > options, Handle< JSObject > resolved)
Definition: i18n.cc:871
static void DeleteBreakIterator(const v8::WeakCallbackData< v8::Value, void > &data)
Definition: i18n.cc:925
static icu::Collator * UnpackCollator(Isolate *isolate, Handle< JSObject > obj)
Definition: i18n.cc:851
static void DeleteCollator(const v8::WeakCallbackData< v8::Value, void > &data)
Definition: i18n.cc:864
static icu::Collator * InitializeCollator(Isolate *isolate, Handle< String > locale, Handle< JSObject > options, Handle< JSObject > resolved)
Definition: i18n.cc:814
static icu::SimpleDateFormat * UnpackDateFormat(Isolate *isolate, Handle< JSObject > obj)
Definition: i18n.cc:716
static void DeleteDateFormat(const v8::WeakCallbackData< v8::Value, void > &data)
Definition: i18n.cc:746
static icu::SimpleDateFormat * InitializeDateTimeFormat(Isolate *isolate, Handle< String > locale, Handle< JSObject > options, Handle< JSObject > resolved)
Definition: i18n.cc:678
static Handle< ObjectTemplateInfo > GetTemplate(Isolate *isolate)
Definition: i18n.cc:666
static Handle< ObjectTemplateInfo > GetTemplate2(Isolate *isolate)
Definition: i18n.cc:672
static icu::DecimalFormat * InitializeNumberFormat(Isolate *isolate, Handle< String > locale, Handle< JSObject > options, Handle< JSObject > resolved)
Definition: i18n.cc:753
static icu::DecimalFormat * UnpackNumberFormat(Isolate *isolate, Handle< JSObject > obj)
Definition: i18n.cc:792
static void DeleteNumberFormat(const v8::WeakCallbackData< v8::Value, void > &data)
Definition: i18n.cc:807
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20