- static int32_t skipBidiMarks(const UnicodeString& text, int32_t pos);
-
- int32_t compareComplexAffix(const UnicodeString& affixPat,
- const UnicodeString& input,
- int32_t pos,
- int8_t type,
- UChar* currency) const;
-
- static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
-
- static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
-
- static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol,
- UnicodeSet *sset, UChar32 schar);
-
- static UBool matchDecimal(UChar32 symbolChar,
- UBool sawDecimal, UChar32 sawDecimalChar,
- const UnicodeSet *sset, UChar32 schar);
-
- static UBool matchGrouping(UChar32 groupingChar,
- UBool sawGrouping, UChar32 sawGroupingChar,
- const UnicodeSet *sset,
- UChar32 decimalChar, const UnicodeSet *decimalSet,
- UChar32 schar);
-
- /**
- * Get a decimal format symbol.
- * Returns a const reference to the symbol string.
- * @internal
- */
- inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
-
- int32_t appendAffix(UnicodeString& buf,
- double number,
- FieldPositionHandler& handler,
- UBool isNegative,
- UBool isPrefix) const;
-
- /**
- * Append an affix to the given UnicodeString, using quotes if
- * there are special characters. Single quotes themselves must be
- * escaped in either case.
- */
- void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
- UBool localized) const;
-
- void appendAffixPattern(UnicodeString& appendTo,
- const UnicodeString* affixPattern,
- const UnicodeString& expAffix, UBool localized) const;
-
- void expandAffix(const UnicodeString& pattern,
- UnicodeString& affix,
- double number,
- FieldPositionHandler& handler,
- UBool doFormat,
- const UnicodeString* pluralCount) const;
-
- void expandAffixes(const UnicodeString* pluralCount);
-
- void addPadding(UnicodeString& appendTo,
- FieldPositionHandler& handler,
- int32_t prefixLen, int32_t suffixLen) const;
-
- UBool isGroupingPosition(int32_t pos) const;
-
- void setCurrencyForSymbols();
-
- // similar to setCurrency without re-compute the affixes for currency.
- // If currency changes, the affix pattern for currency is not changed,
- // but the affix will be changed. So, affixes need to be
- // re-computed in setCurrency(), but not in setCurrencyInternally().
- virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
-
- // set up currency affix patterns for mix parsing.
- // The patterns saved here are the affix patterns of default currency
- // pattern and the unique affix patterns of the plural currency patterns.
- // Those patterns are used by parseForCurrency().
- void setupCurrencyAffixPatterns(UErrorCode& status);
-
- // set up the currency affixes used in currency plural formatting.
- // It sets up both fAffixesForCurrency for currency pattern if the current
- // pattern contains 3 currency signs,
- // and it sets up fPluralAffixesForCurrency for currency plural patterns.
- void setupCurrencyAffixes(const UnicodeString& pattern,
- UBool setupForCurrentPattern,
- UBool setupForPluralPattern,
- UErrorCode& status);
-
- // hashtable operations
- Hashtable* initHashForAffixPattern(UErrorCode& status);
- Hashtable* initHashForAffix(UErrorCode& status);
-
- void deleteHashForAffixPattern();
- void deleteHashForAffix(Hashtable*& table);
-
- void copyHashForAffixPattern(const Hashtable* source,
- Hashtable* target, UErrorCode& status);
- void copyHashForAffix(const Hashtable* source,
- Hashtable* target, UErrorCode& status);
-
- UnicodeString& _format(int64_t number,
- UnicodeString& appendTo,
- FieldPositionHandler& handler,
- UErrorCode &status) const;
- UnicodeString& _format(double number,
- UnicodeString& appendTo,
- FieldPositionHandler& handler,
- UErrorCode &status) const;
- UnicodeString& _format(const DigitList &number,
- UnicodeString& appendTo,
- FieldPositionHandler& handler,
- UErrorCode &status) const;
-
- /**
- * Constants.
- */
-
- UnicodeString fPositivePrefix;
- UnicodeString fPositiveSuffix;
- UnicodeString fNegativePrefix;
- UnicodeString fNegativeSuffix;
- UnicodeString* fPosPrefixPattern;
- UnicodeString* fPosSuffixPattern;
- UnicodeString* fNegPrefixPattern;
- UnicodeString* fNegSuffixPattern;
-
- /**
- * Formatter for ChoiceFormat-based currency names. If this field
- * is not null, then delegate to it to format currency symbols.
- * @since ICU 2.6
- */
- ChoiceFormat* fCurrencyChoice;
-
- DigitList * fMultiplier; // NULL for multiplier of one
- int32_t fScale;
- int32_t fGroupingSize;
- int32_t fGroupingSize2;
- UBool fDecimalSeparatorAlwaysShown;
- DecimalFormatSymbols* fSymbols;
-
- UBool fUseSignificantDigits;
- int32_t fMinSignificantDigits;
- int32_t fMaxSignificantDigits;
-
- UBool fUseExponentialNotation;
- int8_t fMinExponentDigits;
- UBool fExponentSignAlwaysShown;
-
- EnumSet<UNumberFormatAttribute,
- UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
- UNUM_LIMIT_BOOLEAN_ATTRIBUTE>
- fBoolFlags;
-
- DigitList* fRoundingIncrement; // NULL if no rounding increment specified.
- ERoundingMode fRoundingMode;
-
- UChar32 fPad;
- int32_t fFormatWidth;
- EPadPosition fPadPosition;
-
- /*
- * Following are used for currency format
- */
- // pattern used in this formatter
- UnicodeString fFormatPattern;
- // style is only valid when decimal formatter is constructed by
- // DecimalFormat(pattern, decimalFormatSymbol, style)
- int fStyle;
- /*
- * Represents whether this is a currency format, and which
- * currency format style.
- * 0: not currency format type;
- * 1: currency style -- symbol name, such as "$" for US dollar.
- * 2: currency style -- ISO name, such as USD for US dollar.
- * 3: currency style -- plural long name, such as "US Dollar" for
- * "1.00 US Dollar", or "US Dollars" for
- * "3.00 US Dollars".
- */
- int fCurrencySignCount;
-
-
- /* For currency parsing purose,
- * Need to remember all prefix patterns and suffix patterns of
- * every currency format pattern,
- * including the pattern of default currecny style
- * and plural currency style. And the patterns are set through applyPattern.
- */
- // TODO: innerclass?
- /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
- struct AffixPatternsForCurrency : public UMemory {
- // negative prefix pattern
- UnicodeString negPrefixPatternForCurrency;
- // negative suffix pattern
- UnicodeString negSuffixPatternForCurrency;
- // positive prefix pattern
- UnicodeString posPrefixPatternForCurrency;
- // positive suffix pattern
- UnicodeString posSuffixPatternForCurrency;
- int8_t patternType;
-
- AffixPatternsForCurrency(const UnicodeString& negPrefix,
- const UnicodeString& negSuffix,
- const UnicodeString& posPrefix,
- const UnicodeString& posSuffix,
- int8_t type) {
- negPrefixPatternForCurrency = negPrefix;
- negSuffixPatternForCurrency = negSuffix;
- posPrefixPatternForCurrency = posPrefix;
- posSuffixPatternForCurrency = posSuffix;
- patternType = type;
- }
- };
- */
-
- /* affix for currency formatting when the currency sign in the pattern
- * equals to 3, such as the pattern contains 3 currency sign or
- * the formatter style is currency plural format style.
- */
- /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
- struct AffixesForCurrency : public UMemory {
- // negative prefix
- UnicodeString negPrefixForCurrency;
- // negative suffix
- UnicodeString negSuffixForCurrency;
- // positive prefix
- UnicodeString posPrefixForCurrency;
- // positive suffix
- UnicodeString posSuffixForCurrency;
-
- int32_t formatWidth;
-
- AffixesForCurrency(const UnicodeString& negPrefix,
- const UnicodeString& negSuffix,
- const UnicodeString& posPrefix,
- const UnicodeString& posSuffix) {
- negPrefixForCurrency = negPrefix;
- negSuffixForCurrency = negSuffix;
- posPrefixForCurrency = posPrefix;
- posSuffixForCurrency = posSuffix;
- }
- };
- */
-
- // Affix pattern set for currency.
- // It is a set of AffixPatternsForCurrency,
- // each element of the set saves the negative prefix pattern,
- // negative suffix pattern, positive prefix pattern,
- // and positive suffix pattern of a pattern.
- // It is used for currency mixed style parsing.
- // It is actually is a set.
- // The set contains the default currency pattern from the locale,
- // and the currency plural patterns.
- // Since it is a set, it does not contain duplicated items.
- // For example, if 2 currency plural patterns are the same, only one pattern
- // is included in the set. When parsing, we do not check whether the plural
- // count match or not.
- Hashtable* fAffixPatternsForCurrency;
-
- // Following 2 are affixes for currency.
- // It is a hash map from plural count to AffixesForCurrency.
- // AffixesForCurrency saves the negative prefix,
- // negative suffix, positive prefix, and positive suffix of a pattern.
- // It is used during currency formatting only when the currency sign count
- // is 3. In which case, the affixes are getting from here, not
- // from the fNegativePrefix etc.
- Hashtable* fAffixesForCurrency; // for current pattern
- Hashtable* fPluralAffixesForCurrency; // for plural pattern
-
- // Information needed for DecimalFormat to format/parse currency plural.
- CurrencyPluralInfo* fCurrencyPluralInfo;