Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1050)

Side by Side Diff: src/i18n.cc

Issue 2738503008: Prepare for ICU's switch to char16_t (Closed)
Patch Set: do not include uvernum.h in runtime-i18n.cc : no longer necessary Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/runtime/runtime-i18n.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // limitations under the License. 4 // limitations under the License.
5 5
6 #include "src/i18n.h" 6 #include "src/i18n.h"
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/api.h" 10 #include "src/api.h"
(...skipping 12 matching lines...) Expand all
23 #include "unicode/locid.h" 23 #include "unicode/locid.h"
24 #include "unicode/numfmt.h" 24 #include "unicode/numfmt.h"
25 #include "unicode/numsys.h" 25 #include "unicode/numsys.h"
26 #include "unicode/rbbi.h" 26 #include "unicode/rbbi.h"
27 #include "unicode/smpdtfmt.h" 27 #include "unicode/smpdtfmt.h"
28 #include "unicode/timezone.h" 28 #include "unicode/timezone.h"
29 #include "unicode/uchar.h" 29 #include "unicode/uchar.h"
30 #include "unicode/ucol.h" 30 #include "unicode/ucol.h"
31 #include "unicode/ucurr.h" 31 #include "unicode/ucurr.h"
32 #include "unicode/unum.h" 32 #include "unicode/unum.h"
33 #include "unicode/uvernum.h"
33 #include "unicode/uversion.h" 34 #include "unicode/uversion.h"
34 35
36 #if U_ICU_VERSION_MAJOR_NUM >= 59
37 #include "unicode/char16ptr.h"
38 #endif
39
35 namespace v8 { 40 namespace v8 {
36 namespace internal { 41 namespace internal {
37 42
38 namespace { 43 namespace {
39 44
40 bool ExtractStringSetting(Isolate* isolate, 45 bool ExtractStringSetting(Isolate* isolate,
41 Handle<JSObject> options, 46 Handle<JSObject> options,
42 const char* key, 47 const char* key,
43 icu::UnicodeString* setting) { 48 icu::UnicodeString* setting) {
44 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked(key); 49 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked(key);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 268
264 number_format = static_cast<icu::DecimalFormat*>( 269 number_format = static_cast<icu::DecimalFormat*>(
265 icu::NumberFormat::createInstance(icu_locale, format_style, status)); 270 icu::NumberFormat::createInstance(icu_locale, format_style, status));
266 271
267 if (U_FAILURE(status)) { 272 if (U_FAILURE(status)) {
268 delete number_format; 273 delete number_format;
269 return NULL; 274 return NULL;
270 } 275 }
271 276
272 UErrorCode status_digits = U_ZERO_ERROR; 277 UErrorCode status_digits = U_ZERO_ERROR;
278 #if U_ICU_VERSION_MAJOR_NUM >= 59
273 uint32_t fraction_digits = ucurr_getDefaultFractionDigits( 279 uint32_t fraction_digits = ucurr_getDefaultFractionDigits(
274 currency.getTerminatedBuffer(), &status_digits); 280 icu::toUCharPtr(currency.getTerminatedBuffer()), &status_digits);
281 #else
282 uint32_t fraction_digits = ucurr_getDefaultFractionDigits(
283 currency.getTerminatedBuffer(), &status_digits);
284 #endif
275 if (U_SUCCESS(status_digits)) { 285 if (U_SUCCESS(status_digits)) {
276 number_format->setMinimumFractionDigits(fraction_digits); 286 number_format->setMinimumFractionDigits(fraction_digits);
277 number_format->setMaximumFractionDigits(fraction_digits); 287 number_format->setMaximumFractionDigits(fraction_digits);
278 } else { 288 } else {
279 // Set min & max to default values (previously in i18n.js) 289 // Set min & max to default values (previously in i18n.js)
280 number_format->setMinimumFractionDigits(0); 290 number_format->setMinimumFractionDigits(0);
281 number_format->setMaximumFractionDigits(3); 291 number_format->setMaximumFractionDigits(3);
282 } 292 }
283 } else if (style == UNICODE_STRING_SIMPLE("percent")) { 293 } else if (style == UNICODE_STRING_SIMPLE("percent")) {
284 number_format = static_cast<icu::DecimalFormat*>( 294 number_format = static_cast<icu::DecimalFormat*>(
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 904
895 void V8BreakIterator::DeleteBreakIterator( 905 void V8BreakIterator::DeleteBreakIterator(
896 const v8::WeakCallbackInfo<void>& data) { 906 const v8::WeakCallbackInfo<void>& data) {
897 delete reinterpret_cast<icu::BreakIterator*>(data.GetInternalField(0)); 907 delete reinterpret_cast<icu::BreakIterator*>(data.GetInternalField(0));
898 delete reinterpret_cast<icu::UnicodeString*>(data.GetInternalField(1)); 908 delete reinterpret_cast<icu::UnicodeString*>(data.GetInternalField(1));
899 GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); 909 GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter()));
900 } 910 }
901 911
902 } // namespace internal 912 } // namespace internal
903 } // namespace v8 913 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/runtime/runtime-i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698