/src/mozilla-central/intl/icu/source/i18n/compactdecimalformat.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | // © 2018 and later: Unicode, Inc. and others. |
2 | | // License & terms of use: http://www.unicode.org/copyright.html |
3 | | |
4 | | #include "unicode/utypes.h" |
5 | | |
6 | | #if !UCONFIG_NO_FORMATTING |
7 | | |
8 | | // Allow implicit conversion from char16_t* to UnicodeString for this file: |
9 | | // Helpful in toString methods and elsewhere. |
10 | | #define UNISTR_FROM_STRING_EXPLICIT |
11 | | |
12 | | #include "unicode/compactdecimalformat.h" |
13 | | #include "number_mapper.h" |
14 | | #include "number_decimfmtprops.h" |
15 | | |
16 | | using namespace icu; |
17 | | |
18 | | |
19 | | UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CompactDecimalFormat) |
20 | | |
21 | | |
22 | | CompactDecimalFormat* |
23 | | CompactDecimalFormat::createInstance(const Locale& inLocale, UNumberCompactStyle style, |
24 | 0 | UErrorCode& status) { |
25 | 0 | return new CompactDecimalFormat(inLocale, style, status); |
26 | 0 | } |
27 | | |
28 | | CompactDecimalFormat::CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style, |
29 | | UErrorCode& status) |
30 | 0 | : DecimalFormat(new DecimalFormatSymbols(inLocale, status), status) { |
31 | 0 | if (U_FAILURE(status)) return; |
32 | 0 | // Minimal properties: let the non-shim code path do most of the logic for us. |
33 | 0 | fields->properties->compactStyle = style; |
34 | 0 | fields->properties->groupingSize = -2; // do not forward grouping information |
35 | 0 | fields->properties->minimumGroupingDigits = 2; |
36 | 0 | touch(status); |
37 | 0 | } |
38 | | |
39 | 0 | CompactDecimalFormat::CompactDecimalFormat(const CompactDecimalFormat& source) = default; |
40 | | |
41 | 0 | CompactDecimalFormat::~CompactDecimalFormat() = default; |
42 | | |
43 | 0 | CompactDecimalFormat& CompactDecimalFormat::operator=(const CompactDecimalFormat& rhs) { |
44 | 0 | DecimalFormat::operator=(rhs); |
45 | 0 | return *this; |
46 | 0 | } |
47 | | |
48 | 0 | Format* CompactDecimalFormat::clone() const { |
49 | 0 | return new CompactDecimalFormat(*this); |
50 | 0 | } |
51 | | |
52 | | void |
53 | | CompactDecimalFormat::parse( |
54 | | const UnicodeString& /* text */, |
55 | | Formattable& /* result */, |
56 | 0 | ParsePosition& /* parsePosition */) const { |
57 | 0 | } |
58 | | |
59 | | void |
60 | | CompactDecimalFormat::parse( |
61 | | const UnicodeString& /* text */, |
62 | | Formattable& /* result */, |
63 | 0 | UErrorCode& status) const { |
64 | 0 | status = U_UNSUPPORTED_ERROR; |
65 | 0 | } |
66 | | |
67 | | CurrencyAmount* |
68 | | CompactDecimalFormat::parseCurrency( |
69 | | const UnicodeString& /* text */, |
70 | 0 | ParsePosition& /* pos */) const { |
71 | 0 | return nullptr; |
72 | 0 | } |
73 | | |
74 | | |
75 | | #endif /* #if !UCONFIG_NO_FORMATTING */ |