OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 1996-2014, International Business Machines | 3 * Copyright (C) 1996-2015, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 * Modification History: | 6 * Modification History: |
7 * | 7 * |
8 * Date Name Description | 8 * Date Name Description |
9 * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixe
s | 9 * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixe
s |
10 ******************************************************************************* | 10 ******************************************************************************* |
11 */ | 11 */ |
12 | 12 |
13 #include "unicode/utypes.h" | 13 #include "unicode/utypes.h" |
14 | 14 |
15 #if !UCONFIG_NO_FORMATTING | 15 #if !UCONFIG_NO_FORMATTING |
16 | 16 |
17 #include "unicode/unum.h" | 17 #include "unicode/unum.h" |
18 | 18 |
19 #include "unicode/uloc.h" | 19 #include "unicode/uloc.h" |
20 #include "unicode/numfmt.h" | 20 #include "unicode/numfmt.h" |
21 #include "unicode/decimfmt.h" | 21 #include "unicode/decimfmt.h" |
22 #include "unicode/rbnf.h" | 22 #include "unicode/rbnf.h" |
| 23 #include "unicode/compactdecimalformat.h" |
23 #include "unicode/ustring.h" | 24 #include "unicode/ustring.h" |
24 #include "unicode/fmtable.h" | 25 #include "unicode/fmtable.h" |
25 #include "unicode/dcfmtsym.h" | 26 #include "unicode/dcfmtsym.h" |
26 #include "unicode/curramt.h" | 27 #include "unicode/curramt.h" |
27 #include "unicode/localpointer.h" | 28 #include "unicode/localpointer.h" |
28 #include "unicode/udisplaycontext.h" | 29 #include "unicode/udisplaycontext.h" |
29 #include "uassert.h" | 30 #include "uassert.h" |
30 #include "cpputils.h" | 31 #include "cpputils.h" |
31 #include "cstring.h" | 32 #include "cstring.h" |
32 | 33 |
(...skipping 16 matching lines...) Expand all Loading... |
49 | 50 |
50 switch(style) { | 51 switch(style) { |
51 case UNUM_DECIMAL: | 52 case UNUM_DECIMAL: |
52 case UNUM_CURRENCY: | 53 case UNUM_CURRENCY: |
53 case UNUM_PERCENT: | 54 case UNUM_PERCENT: |
54 case UNUM_SCIENTIFIC: | 55 case UNUM_SCIENTIFIC: |
55 case UNUM_CURRENCY_ISO: | 56 case UNUM_CURRENCY_ISO: |
56 case UNUM_CURRENCY_PLURAL: | 57 case UNUM_CURRENCY_PLURAL: |
57 case UNUM_CURRENCY_ACCOUNTING: | 58 case UNUM_CURRENCY_ACCOUNTING: |
58 case UNUM_CASH_CURRENCY: | 59 case UNUM_CASH_CURRENCY: |
| 60 case UNUM_CURRENCY_STANDARD: |
59 retVal = NumberFormat::createInstance(Locale(locale), style, *status); | 61 retVal = NumberFormat::createInstance(Locale(locale), style, *status); |
60 break; | 62 break; |
61 | 63 |
62 case UNUM_PATTERN_DECIMAL: { | 64 case UNUM_PATTERN_DECIMAL: { |
63 UParseError tErr; | 65 UParseError tErr; |
64 /* UnicodeString can handle the case when patternLength = -1. */ | 66 /* UnicodeString can handle the case when patternLength = -1. */ |
65 const UnicodeString pat(pattern, patternLength); | 67 const UnicodeString pat(pattern, patternLength); |
66 | 68 |
67 if(parseErr==NULL){ | 69 if(parseErr==NULL){ |
68 parseErr = &tErr; | 70 parseErr = &tErr; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 109 |
108 case UNUM_DURATION: | 110 case UNUM_DURATION: |
109 retVal = new RuleBasedNumberFormat(URBNF_DURATION, Locale(locale), *stat
us); | 111 retVal = new RuleBasedNumberFormat(URBNF_DURATION, Locale(locale), *stat
us); |
110 break; | 112 break; |
111 | 113 |
112 case UNUM_NUMBERING_SYSTEM: | 114 case UNUM_NUMBERING_SYSTEM: |
113 retVal = new RuleBasedNumberFormat(URBNF_NUMBERING_SYSTEM, Locale(locale
), *status); | 115 retVal = new RuleBasedNumberFormat(URBNF_NUMBERING_SYSTEM, Locale(locale
), *status); |
114 break; | 116 break; |
115 #endif | 117 #endif |
116 | 118 |
| 119 case UNUM_DECIMAL_COMPACT_SHORT: |
| 120 retVal = CompactDecimalFormat::createInstance(Locale(locale), UNUM_SHORT
, *status); |
| 121 break; |
| 122 |
| 123 case UNUM_DECIMAL_COMPACT_LONG: |
| 124 retVal = CompactDecimalFormat::createInstance(Locale(locale), UNUM_LONG,
*status); |
| 125 break; |
| 126 |
117 default: | 127 default: |
118 *status = U_UNSUPPORTED_ERROR; | 128 *status = U_UNSUPPORTED_ERROR; |
119 return NULL; | 129 return NULL; |
120 } | 130 } |
121 | 131 |
122 if(retVal == NULL && U_SUCCESS(*status)) { | 132 if(retVal == NULL && U_SUCCESS(*status)) { |
123 *status = U_MEMORY_ALLOCATION_ERROR; | 133 *status = U_MEMORY_ALLOCATION_ERROR; |
124 } | 134 } |
125 | 135 |
126 return reinterpret_cast<UNumberFormat *>(retVal); | 136 return reinterpret_cast<UNumberFormat *>(retVal); |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 867 |
858 if(pos != 0) { | 868 if(pos != 0) { |
859 pos->beginIndex = fp.getBeginIndex(); | 869 pos->beginIndex = fp.getBeginIndex(); |
860 pos->endIndex = fp.getEndIndex(); | 870 pos->endIndex = fp.getEndIndex(); |
861 } | 871 } |
862 | 872 |
863 return res.extract(result, resultLength, *status); | 873 return res.extract(result, resultLength, *status); |
864 } | 874 } |
865 | 875 |
866 #endif /* #if !UCONFIG_NO_FORMATTING */ | 876 #endif /* #if !UCONFIG_NO_FORMATTING */ |
OLD | NEW |