1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /* 4 ******************************************************************************* 5 * Copyright (C) 1997-2015, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 */ 9 #ifndef _DECIMAL_FORMAT_PATTERN 10 #define _DECIMAL_FORMAT_PATTERN 11 12 #include "unicode/utypes.h" 13 14 #if !UCONFIG_NO_FORMATTING 15 16 #include "unicode/uobject.h" 17 #include "unicode/unistr.h" 18 #include "digitlst.h" 19 #include "affixpatternparser.h" 20 21 U_NAMESPACE_BEGIN 22 23 // currency sign count 24 enum CurrencySignCount { 25 fgCurrencySignCountZero, 26 fgCurrencySignCountInSymbolFormat, 27 fgCurrencySignCountInISOFormat, 28 fgCurrencySignCountInPluralFormat 29 }; 30 31 class DecimalFormatSymbols; 32 33 struct DecimalFormatPattern : public UMemory { 34 enum EPadPosition { 35 kPadBeforePrefix, 36 kPadAfterPrefix, 37 kPadBeforeSuffix, 38 kPadAfterSuffix 39 }; 40 41 DecimalFormatPattern(); 42 43 int32_t fMinimumIntegerDigits; 44 int32_t fMaximumIntegerDigits; 45 int32_t fMinimumFractionDigits; 46 int32_t fMaximumFractionDigits; 47 UBool fUseSignificantDigits; 48 int32_t fMinimumSignificantDigits; 49 int32_t fMaximumSignificantDigits; 50 UBool fUseExponentialNotation; 51 int32_t fMinExponentDigits; 52 UBool fExponentSignAlwaysShown; 53 int32_t fCurrencySignCount; 54 UBool fGroupingUsed; 55 int32_t fGroupingSize; 56 int32_t fGroupingSize2; 57 int32_t fMultiplier; 58 UBool fDecimalSeparatorAlwaysShown; 59 int32_t fFormatWidth; 60 UBool fRoundingIncrementUsed; 61 DigitList fRoundingIncrement; 62 UChar32 fPad; 63 UBool fNegPatternsBogus; 64 UBool fPosPatternsBogus; 65 UnicodeString fNegPrefixPattern; 66 UnicodeString fNegSuffixPattern; 67 UnicodeString fPosPrefixPattern; 68 UnicodeString fPosSuffixPattern; 69 AffixPattern fNegPrefixAffix; 70 AffixPattern fNegSuffixAffix; 71 AffixPattern fPosPrefixAffix; 72 AffixPattern fPosSuffixAffix; 73 EPadPosition fPadPosition; 74 }; 75 76 class DecimalFormatPatternParser : public UMemory { 77 public: 78 DecimalFormatPatternParser(); 79 void useSymbols(const DecimalFormatSymbols& symbols); 80 81 void applyPatternWithoutExpandAffix( 82 const UnicodeString& pattern, 83 DecimalFormatPattern& out, 84 UParseError& parseError, 85 UErrorCode& status); 86 private: 87 DecimalFormatPatternParser(const DecimalFormatPatternParser&); 88 DecimalFormatPatternParser& operator=(DecimalFormatPatternParser& rhs); 89 UChar32 fZeroDigit; 90 UChar32 fSigDigit; 91 UnicodeString fGroupingSeparator; 92 UnicodeString fDecimalSeparator; 93 UnicodeString fPercent; 94 UnicodeString fPerMill; 95 UnicodeString fDigit; 96 UnicodeString fSeparator; 97 UnicodeString fExponent; 98 UnicodeString fPlus; 99 UnicodeString fMinus; 100 UnicodeString fPadEscape; 101 }; 102 103 U_NAMESPACE_END 104 105 #endif /* !UCONFIG_NO_FORMATTING */ 106 #endif 107