LEFT | RIGHT |
1 // © 2018 and later: Unicode, Inc. and others. | 1 // © 2018 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 #include "unicode/utypes.h" | 4 #include "unicode/utypes.h" |
5 | 5 |
6 #if !UCONFIG_NO_FORMATTING | 6 #if !UCONFIG_NO_FORMATTING |
7 #ifndef __NUMPARSE_CURRENCY_H__ | 7 #ifndef __NUMPARSE_CURRENCY_H__ |
8 #define __NUMPARSE_CURRENCY_H__ | 8 #define __NUMPARSE_CURRENCY_H__ |
9 | 9 |
10 #include "numparse_types.h" | 10 #include "numparse_types.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 * Matches a currency, either a custom currency or one from the data bundle. The
class is called | 22 * Matches a currency, either a custom currency or one from the data bundle. The
class is called |
23 * "combined" to emphasize that the currency string may come from one of multipl
e sources. | 23 * "combined" to emphasize that the currency string may come from one of multipl
e sources. |
24 * | 24 * |
25 * Will match currency spacing either before or after the number depending on wh
ether we are currently in | 25 * Will match currency spacing either before or after the number depending on wh
ether we are currently in |
26 * the prefix or suffix. | 26 * the prefix or suffix. |
27 * | 27 * |
28 * The implementation of this class is slightly different between J and C. See #
13584 for a follow-up. | 28 * The implementation of this class is slightly different between J and C. See #
13584 for a follow-up. |
29 * | 29 * |
30 * @author sffc | 30 * @author sffc |
31 */ | 31 */ |
32 class CombinedCurrencyMatcher : public NumberParseMatcher, public UMemory { | 32 // Exported as U_I18N_API for tests |
| 33 class U_I18N_API CombinedCurrencyMatcher : public NumberParseMatcher, public UMe
mory { |
33 public: | 34 public: |
34 CombinedCurrencyMatcher() = default; // WARNING: Leaves the object in an un
usable state | 35 CombinedCurrencyMatcher() = default; // WARNING: Leaves the object in an un
usable state |
35 | 36 |
36 CombinedCurrencyMatcher(const CurrencySymbols& currencySymbols, const Decima
lFormatSymbols& dfs, UErrorCode& status); | 37 CombinedCurrencyMatcher(const CurrencySymbols& currencySymbols, const Decima
lFormatSymbols& dfs, |
| 38 parse_flags_t parseFlags, UErrorCode& status); |
37 | 39 |
38 bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status)
const override; | 40 bool match(StringSegment& segment, ParsedNumber& result, UErrorCode& status)
const override; |
39 | 41 |
40 bool smokeTest(const StringSegment& segment) const override; | 42 bool smokeTest(const StringSegment& segment) const override; |
41 | 43 |
42 UnicodeString toString() const override; | 44 UnicodeString toString() const override; |
43 | 45 |
44 private: | 46 private: |
45 UChar fCurrencyCode[4]; | 47 UChar fCurrencyCode[4]; |
46 UnicodeString fCurrency1; | 48 UnicodeString fCurrency1; |
47 UnicodeString fCurrency2; | 49 UnicodeString fCurrency2; |
| 50 |
| 51 bool fUseFullCurrencyData; |
| 52 UnicodeString fLocalLongNames[StandardPlural::COUNT]; |
48 | 53 |
49 UnicodeString afterPrefixInsert; | 54 UnicodeString afterPrefixInsert; |
50 UnicodeString beforeSuffixInsert; | 55 UnicodeString beforeSuffixInsert; |
51 | 56 |
52 // We could use Locale instead of CharString here, but | 57 // We could use Locale instead of CharString here, but |
53 // Locale has a non-trivial default constructor. | 58 // Locale has a non-trivial default constructor. |
54 CharString fLocaleName; | 59 CharString fLocaleName; |
55 | 60 |
56 // TODO: See comments in constructor in numparse_currency.cpp | 61 // TODO: See comments in constructor in numparse_currency.cpp |
57 // UnicodeSet fLeadCodePoints; | 62 // UnicodeSet fLeadCodePoints; |
58 | 63 |
59 /** Matches the currency string without concern for currency spacing. */ | 64 /** Matches the currency string without concern for currency spacing. */ |
60 bool matchCurrency(StringSegment& segment, ParsedNumber& result, UErrorCode&
status) const; | 65 bool matchCurrency(StringSegment& segment, ParsedNumber& result, UErrorCode&
status) const; |
61 }; | 66 }; |
62 | 67 |
63 | 68 |
64 } // namespace impl | 69 } // namespace impl |
65 } // namespace numparse | 70 } // namespace numparse |
66 U_NAMESPACE_END | 71 U_NAMESPACE_END |
67 | 72 |
68 #endif //__NUMPARSE_CURRENCY_H__ | 73 #endif //__NUMPARSE_CURRENCY_H__ |
69 #endif /* #if !UCONFIG_NO_FORMATTING */ | 74 #endif /* #if !UCONFIG_NO_FORMATTING */ |
LEFT | RIGHT |