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 {
38 class SimpleDateFormat;
46 // Creates an ObjectTemplate with one internal field.
47 static Handle<ObjectTemplateInfo> GetTemplate(Isolate* isolate);
49 // Creates an ObjectTemplate with two internal fields.
50 static Handle<ObjectTemplateInfo> GetTemplate2(Isolate* isolate);
59 // Create a formatter for the specificied locale and options. Returns the
60 // resolved settings for the locale / options.
61 static icu::SimpleDateFormat* InitializeDateTimeFormat(
63 Handle<String> locale,
64 Handle<JSObject> options,
65 Handle<JSObject> resolved);
67 // Unpacks date format object from corresponding JavaScript object.
68 static icu::SimpleDateFormat* UnpackDateFormat(Isolate* isolate,
69 Handle<JSObject> obj);
71 // Release memory we allocated for the DateFormat once the JS object that
72 // holds the pointer gets garbage collected.
73 static void DeleteDateFormat(v8::Isolate* isolate,
74 Persistent<v8::Value>* object,
83 // Create a formatter for the specificied locale and options. Returns the
84 // resolved settings for the locale / options.
85 static icu::DecimalFormat* InitializeNumberFormat(
87 Handle<String> locale,
88 Handle<JSObject> options,
89 Handle<JSObject> resolved);
91 // Unpacks number format object from corresponding JavaScript object.
92 static icu::DecimalFormat* UnpackNumberFormat(Isolate* isolate,
93 Handle<JSObject> obj);
95 // Release memory we allocated for the NumberFormat once the JS object that
96 // holds the pointer gets garbage collected.
97 static void DeleteNumberFormat(v8::Isolate* isolate,
98 Persistent<v8::Value>* object,
107 // Create a collator for the specificied locale and options. Returns the
108 // resolved settings for the locale / options.
109 static icu::Collator* InitializeCollator(
111 Handle<String> locale,
112 Handle<JSObject> options,
113 Handle<JSObject> resolved);
115 // Unpacks collator object from corresponding JavaScript object.
116 static icu::Collator* UnpackCollator(Isolate* isolate, Handle<JSObject> obj);
118 // Release memory we allocated for the Collator once the JS object that holds
119 // the pointer gets garbage collected.
120 static void DeleteCollator(v8::Isolate* isolate,
121 Persistent<v8::Value>* object,
127 } } // namespace v8::internal