LEFT | RIGHT |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html | 2 // License & terms of use: http://www.unicode.org/copyright.html |
3 /* | 3 /* |
4 ******************************************************************************* | 4 ******************************************************************************* |
5 * Copyright (C) 1997-2016, International Business Machines Corporation and | 5 * Copyright (C) 1997-2016, International Business Machines Corporation and |
6 * others. All Rights Reserved. | 6 * others. All Rights Reserved. |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * | 8 * |
9 * File DCFMTSYM.CPP | 9 * File DCFMTSYM.CPP |
10 * | 10 * |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 NULL, /* seven digit - get it from the numbering system */ | 90 NULL, /* seven digit - get it from the numbering system */ |
91 NULL, /* eight digit - get it from the numbering system */ | 91 NULL, /* eight digit - get it from the numbering system */ |
92 NULL, /* nine digit - get it from the numbering system */ | 92 NULL, /* nine digit - get it from the numbering system */ |
93 "superscriptingExponent", /* Multiplication (x) symbol for exponents */ | 93 "superscriptingExponent", /* Multiplication (x) symbol for exponents */ |
94 }; | 94 }; |
95 | 95 |
96 // ------------------------------------- | 96 // ------------------------------------- |
97 // Initializes this with the decimal format symbols in the default locale. | 97 // Initializes this with the decimal format symbols in the default locale. |
98 | 98 |
99 DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status) | 99 DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status) |
100 : UObject(), | 100 : UObject(), locale() { |
101 locale() | |
102 { | |
103 initialize(locale, status, TRUE); | 101 initialize(locale, status, TRUE); |
104 } | 102 } |
105 | 103 |
106 // ------------------------------------- | 104 // ------------------------------------- |
107 // Initializes this with the decimal format symbols in the desired locale. | 105 // Initializes this with the decimal format symbols in the desired locale. |
108 | 106 |
109 DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, UErrorCode& status
) | 107 DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, UErrorCode& status
) |
110 : UObject(), | 108 : UObject(), locale(loc) { |
111 locale(loc) | |
112 { | |
113 initialize(locale, status); | 109 initialize(locale, status); |
114 } | 110 } |
115 | 111 |
116 DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, const NumberingSys
tem& ns, UErrorCode& status) | 112 DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, const NumberingSys
tem& ns, UErrorCode& status) |
117 : UObject(), | 113 : UObject(), locale(loc) { |
118 locale(loc) | |
119 { | |
120 initialize(locale, status, FALSE, &ns); | 114 initialize(locale, status, FALSE, &ns); |
121 } | 115 } |
122 | 116 |
123 DecimalFormatSymbols::DecimalFormatSymbols() | 117 DecimalFormatSymbols::DecimalFormatSymbols() |
124 : UObject(), | 118 : UObject(), locale(Locale::getRoot()), currPattern(NULL) { |
125 locale(Locale::getRoot()), | |
126 currPattern(NULL) { | |
127 *validLocale = *actualLocale = 0; | 119 *validLocale = *actualLocale = 0; |
128 initialize(); | 120 initialize(); |
129 } | 121 } |
130 | 122 |
131 DecimalFormatSymbols* | 123 DecimalFormatSymbols* |
132 DecimalFormatSymbols::createWithLastResortData(UErrorCode& status) { | 124 DecimalFormatSymbols::createWithLastResortData(UErrorCode& status) { |
133 if (U_FAILURE(status)) { return NULL; } | 125 if (U_FAILURE(status)) { return NULL; } |
134 DecimalFormatSymbols* sym = new DecimalFormatSymbols(); | 126 DecimalFormatSymbols* sym = new DecimalFormatSymbols(); |
135 if (sym == NULL) { | 127 if (sym == NULL) { |
136 status = U_MEMORY_ALLOCATION_ERROR; | 128 status = U_MEMORY_ALLOCATION_ERROR; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 currPattern = NULL; | 349 currPattern = NULL; |
358 | 350 |
359 // First initialize all the symbols to the fallbacks for anything we can't f
ind | 351 // First initialize all the symbols to the fallbacks for anything we can't f
ind |
360 initialize(); | 352 initialize(); |
361 | 353 |
362 // | 354 // |
363 // Next get the numbering system for this locale and set zero digit | 355 // Next get the numbering system for this locale and set zero digit |
364 // and the digit string based on the numbering system for the locale | 356 // and the digit string based on the numbering system for the locale |
365 // | 357 // |
366 LocalPointer<NumberingSystem> nsLocal; | 358 LocalPointer<NumberingSystem> nsLocal; |
367 if (ns == NULL) { | 359 if (ns == nullptr) { |
368 // Use the numbering system according to the locale. | 360 // Use the numbering system according to the locale. |
369 // Save it into a LocalPointer so it gets cleaned up. | 361 // Save it into a LocalPointer so it gets cleaned up. |
370 nsLocal.adoptInstead(NumberingSystem::createInstance(loc, status)); | 362 nsLocal.adoptInstead(NumberingSystem::createInstance(loc, status)); |
371 ns = nsLocal.getAlias(); | 363 ns = nsLocal.getAlias(); |
372 } | 364 } |
373 const char *nsName; | 365 const char *nsName; |
374 if (U_SUCCESS(status) && ns->getRadix() == 10 && !ns->isAlgorithmic()) { | 366 if (U_SUCCESS(status) && ns->getRadix() == 10 && !ns->isAlgorithmic()) { |
375 nsName = ns->getName(); | 367 nsName = ns->getName(); |
376 UnicodeString digitString(ns->getDescription()); | 368 UnicodeString digitString(ns->getDescription()); |
377 int32_t digitIndex = 0; | 369 int32_t digitIndex = 0; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 currencySpcBeforeSym[(int32_t)type] = pattern; | 561 currencySpcBeforeSym[(int32_t)type] = pattern; |
570 } else { | 562 } else { |
571 currencySpcAfterSym[(int32_t)type] = pattern; | 563 currencySpcAfterSym[(int32_t)type] = pattern; |
572 } | 564 } |
573 } | 565 } |
574 U_NAMESPACE_END | 566 U_NAMESPACE_END |
575 | 567 |
576 #endif /* #if !UCONFIG_NO_FORMATTING */ | 568 #endif /* #if !UCONFIG_NO_FORMATTING */ |
577 | 569 |
578 //eof | 570 //eof |
LEFT | RIGHT |