1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 // limitations under the License.
32 #include "unicode/uversion.h"
35 namespace U_ICU_NAMESPACE {
39 class SimpleDateFormat;
47 // Creates an ObjectTemplate with one internal field.
48 static Handle<ObjectTemplateInfo> GetTemplate(Isolate* isolate);
50 // Creates an ObjectTemplate with two internal fields.
51 static Handle<ObjectTemplateInfo> GetTemplate2(Isolate* isolate);
60 // Create a formatter for the specificied locale and options. Returns the
61 // resolved settings for the locale / options.
62 static icu::SimpleDateFormat* InitializeDateTimeFormat(
64 Handle<String> locale,
65 Handle<JSObject> options,
66 Handle<JSObject> resolved);
68 // Unpacks date format object from corresponding JavaScript object.
69 static icu::SimpleDateFormat* UnpackDateFormat(Isolate* isolate,
70 Handle<JSObject> obj);
72 // Release memory we allocated for the DateFormat once the JS object that
73 // holds the pointer gets garbage collected.
74 static void DeleteDateFormat(v8::Isolate* isolate,
75 Persistent<v8::Value>* object,
84 // Create a formatter for the specificied locale and options. Returns the
85 // resolved settings for the locale / options.
86 static icu::DecimalFormat* InitializeNumberFormat(
88 Handle<String> locale,
89 Handle<JSObject> options,
90 Handle<JSObject> resolved);
92 // Unpacks number format object from corresponding JavaScript object.
93 static icu::DecimalFormat* UnpackNumberFormat(Isolate* isolate,
94 Handle<JSObject> obj);
96 // Release memory we allocated for the NumberFormat once the JS object that
97 // holds the pointer gets garbage collected.
98 static void DeleteNumberFormat(v8::Isolate* isolate,
99 Persistent<v8::Value>* object,
108 // Create a collator for the specificied locale and options. Returns the
109 // resolved settings for the locale / options.
110 static icu::Collator* InitializeCollator(
112 Handle<String> locale,
113 Handle<JSObject> options,
114 Handle<JSObject> resolved);
116 // Unpacks collator object from corresponding JavaScript object.
117 static icu::Collator* UnpackCollator(Isolate* isolate, Handle<JSObject> obj);
119 // Release memory we allocated for the Collator once the JS object that holds
120 // the pointer gets garbage collected.
121 static void DeleteCollator(v8::Isolate* isolate,
122 Persistent<v8::Value>* object,
128 class BreakIterator {
130 // Create a BreakIterator for the specificied locale and options. Returns the
131 // resolved settings for the locale / options.
132 static icu::BreakIterator* InitializeBreakIterator(
134 Handle<String> locale,
135 Handle<JSObject> options,
136 Handle<JSObject> resolved);
138 // Unpacks break iterator object from corresponding JavaScript object.
139 static icu::BreakIterator* UnpackBreakIterator(Isolate* isolate,
140 Handle<JSObject> obj);
142 // Release memory we allocated for the BreakIterator once the JS object that
143 // holds the pointer gets garbage collected.
144 static void DeleteBreakIterator(v8::Isolate* isolate,
145 Persistent<v8::Value>* object,
152 } } // namespace v8::internal