| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************** | 2 ******************************************************************************** |
| 3 * Copyright (C) 1997-2013, International Business Machines | 3 * Copyright (C) 1997-2014, International Business Machines |
| 4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
| 5 ******************************************************************************** | 5 ******************************************************************************** |
| 6 * | 6 * |
| 7 * File DECIMFMT.H | 7 * File DECIMFMT.H |
| 8 * | 8 * |
| 9 * Modification History: | 9 * Modification History: |
| 10 * | 10 * |
| 11 * Date Name Description | 11 * Date Name Description |
| 12 * 02/19/97 aliu Converted from java. | 12 * 02/19/97 aliu Converted from java. |
| 13 * 03/20/97 clhuang Updated per C++ implementation. | 13 * 03/20/97 clhuang Updated per C++ implementation. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 class CurrencyPluralInfo; | 56 class CurrencyPluralInfo; |
| 57 class Hashtable; | 57 class Hashtable; |
| 58 class UnicodeSet; | 58 class UnicodeSet; |
| 59 class FieldPositionHandler; | 59 class FieldPositionHandler; |
| 60 class DecimalFormatStaticSets; | 60 class DecimalFormatStaticSets; |
| 61 class FixedDecimal; | 61 class FixedDecimal; |
| 62 | 62 |
| 63 // explicit template instantiation. see digitlst.h | 63 // explicit template instantiation. see digitlst.h |
| 64 #if defined (_MSC_VER) | 64 #if defined (_MSC_VER) |
| 65 template class U_I18N_API EnumSet<UNumberFormatAttribute, | 65 template class U_I18N_API EnumSet<UNumberFormatAttribute, |
| 66 UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1, | 66 UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1, |
| 67 UNUM_LIMIT_BOOLEAN_ATTRIBUTE>; | 67 UNUM_LIMIT_BOOLEAN_ATTRIBUTE>; |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * DecimalFormat is a concrete subclass of NumberFormat that formats decimal | 71 * DecimalFormat is a concrete subclass of NumberFormat that formats decimal |
| 72 * numbers. It has a variety of features designed to make it possible to parse | 72 * numbers. It has a variety of features designed to make it possible to parse |
| 73 * and format numbers in any locale, including support for Western, Arabic, or | 73 * and format numbers in any locale, including support for Western, Arabic, or |
| 74 * Indic digits. It also supports different flavors of numbers, including | 74 * Indic digits. It also supports different flavors of numbers, including |
| 75 * integers ("123"), fixed-point numbers ("123.4"), scientific notation | 75 * integers ("123"), fixed-point numbers ("123.4"), scientific notation |
| 76 * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", | 76 * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 kRoundFloor, /**< Round towards negative infinity */ | 671 kRoundFloor, /**< Round towards negative infinity */ |
| 672 kRoundDown, /**< Round towards zero */ | 672 kRoundDown, /**< Round towards zero */ |
| 673 kRoundUp, /**< Round away from zero */ | 673 kRoundUp, /**< Round away from zero */ |
| 674 kRoundHalfEven, /**< Round towards the nearest integer, or | 674 kRoundHalfEven, /**< Round towards the nearest integer, or |
| 675 towards the nearest even integer if equidistant */ | 675 towards the nearest even integer if equidistant */ |
| 676 kRoundHalfDown, /**< Round towards the nearest integer, or | 676 kRoundHalfDown, /**< Round towards the nearest integer, or |
| 677 towards zero if equidistant */ | 677 towards zero if equidistant */ |
| 678 kRoundHalfUp, /**< Round towards the nearest integer, or | 678 kRoundHalfUp, /**< Round towards the nearest integer, or |
| 679 away from zero if equidistant */ | 679 away from zero if equidistant */ |
| 680 /** | 680 /** |
| 681 * Return U_FORMAT_INEXACT_ERROR if number does not format exactly. | 681 * Return U_FORMAT_INEXACT_ERROR if number does not format exactly. |
| 682 * @stable ICU 4.8 | 682 * @stable ICU 4.8 |
| 683 */ | 683 */ |
| 684 kRoundUnnecessary | 684 kRoundUnnecessary |
| 685 }; | 685 }; |
| 686 | 686 |
| 687 /** | 687 /** |
| 688 * Pad position. | 688 * Pad position. |
| 689 * @stable ICU 2.4 | 689 * @stable ICU 2.4 |
| 690 */ | 690 */ |
| 691 enum EPadPosition { | 691 enum EPadPosition { |
| 692 kPadBeforePrefix, | 692 kPadBeforePrefix, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 | 778 |
| 779 | 779 |
| 780 /** | 780 /** |
| 781 * Set an integer attribute on this DecimalFormat. | 781 * Set an integer attribute on this DecimalFormat. |
| 782 * May return U_UNSUPPORTED_ERROR if this instance does not support | 782 * May return U_UNSUPPORTED_ERROR if this instance does not support |
| 783 * the specified attribute. | 783 * the specified attribute. |
| 784 * @param attr the attribute to set | 784 * @param attr the attribute to set |
| 785 * @param newvalue new value | 785 * @param newvalue new value |
| 786 * @param status the error type | 786 * @param status the error type |
| 787 * @return *this - for chaining (example: format.setAttribute(...).setAttrib
ute(...) ) | 787 * @return *this - for chaining (example: format.setAttribute(...).setAttrib
ute(...) ) |
| 788 * @draft ICU 51 | 788 * @stable ICU 51 |
| 789 */ | 789 */ |
| 790 virtual DecimalFormat& setAttribute( UNumberFormatAttribute attr, | 790 virtual DecimalFormat& setAttribute( UNumberFormatAttribute attr, |
| 791 int32_t newvalue, | 791 int32_t newvalue, |
| 792 UErrorCode &status); | 792 UErrorCode &status); |
| 793 | 793 |
| 794 /** | 794 /** |
| 795 * Get an integer | 795 * Get an integer |
| 796 * May return U_UNSUPPORTED_ERROR if this instance does not support | 796 * May return U_UNSUPPORTED_ERROR if this instance does not support |
| 797 * the specified attribute. | 797 * the specified attribute. |
| 798 * @param attr the attribute to set | 798 * @param attr the attribute to set |
| 799 * @param status the error type | 799 * @param status the error type |
| 800 * @return the attribute value. Undefined if there is an error. | 800 * @return the attribute value. Undefined if there is an error. |
| 801 * @draft ICU 51 | 801 * @stable ICU 51 |
| 802 */ | 802 */ |
| 803 virtual int32_t getAttribute( UNumberFormatAttribute attr, | 803 virtual int32_t getAttribute( UNumberFormatAttribute attr, |
| 804 UErrorCode &status) const; | 804 UErrorCode &status) const; |
| 805 | 805 |
| 806 |
| 807 /** |
| 808 * Set whether or not grouping will be used in this format. |
| 809 * @param newValue True, grouping will be used in this format. |
| 810 * @see getGroupingUsed |
| 811 * @draft ICU 53 |
| 812 */ |
| 813 virtual void setGroupingUsed(UBool newValue); |
| 806 | 814 |
| 815 /** |
| 816 * Sets whether or not numbers should be parsed as integers only. |
| 817 * @param value set True, this format will parse numbers as integers |
| 818 * only. |
| 819 * @see isParseIntegerOnly |
| 820 * @draft ICU 53 |
| 821 */ |
| 822 virtual void setParseIntegerOnly(UBool value); |
| 823 |
| 824 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since
it is virtual */ |
| 825 /** |
| 826 * Set a particular UDisplayContext value in the formatter, such as |
| 827 * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. |
| 828 * @param value The UDisplayContext value to set. |
| 829 * @param status Input/output status. If at entry this indicates a failure |
| 830 * status, the function will do nothing; otherwise this will b
e |
| 831 * updated with any new status from the function. |
| 832 * @draft ICU 53 |
| 833 */ |
| 834 virtual void setContext(UDisplayContext value, UErrorCode& status); |
| 807 | 835 |
| 808 /** | 836 /** |
| 809 * Create a DecimalFormat from the given pattern and symbols. | 837 * Create a DecimalFormat from the given pattern and symbols. |
| 810 * Use this constructor when you need to completely customize the | 838 * Use this constructor when you need to completely customize the |
| 811 * behavior of the format. | 839 * behavior of the format. |
| 812 * <P> | 840 * <P> |
| 813 * To obtain standard formats for a given | 841 * To obtain standard formats for a given |
| 814 * locale, use the factory methods on NumberFormat such as | 842 * locale, use the factory methods on NumberFormat such as |
| 815 * createInstance or createCurrencyInstance. If you need only minor adjustme
nts | 843 * createInstance or createCurrencyInstance. If you need only minor adjustme
nts |
| 816 * to a standard format, you can modify the format returned by | 844 * to a standard format, you can modify the format returned by |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 * @return Reference to 'appendTo' parameter. | 1086 * @return Reference to 'appendTo' parameter. |
| 1059 * @stable 4.4 | 1087 * @stable 4.4 |
| 1060 */ | 1088 */ |
| 1061 virtual UnicodeString& format(const StringPiece &number, | 1089 virtual UnicodeString& format(const StringPiece &number, |
| 1062 UnicodeString& appendTo, | 1090 UnicodeString& appendTo, |
| 1063 FieldPositionIterator* posIter, | 1091 FieldPositionIterator* posIter, |
| 1064 UErrorCode& status) const; | 1092 UErrorCode& status) const; |
| 1065 | 1093 |
| 1066 | 1094 |
| 1067 /** | 1095 /** |
| 1068 * Format a decimal number. | 1096 * Format a decimal number. |
| 1069 * The number is a DigitList wrapper onto a floating point decimal number. | 1097 * The number is a DigitList wrapper onto a floating point decimal number. |
| 1070 * The default implementation in NumberFormat converts the decimal number | 1098 * The default implementation in NumberFormat converts the decimal number |
| 1071 * to a double and formats that. | 1099 * to a double and formats that. |
| 1072 * | 1100 * |
| 1073 * @param number The number, a DigitList format Decimal Floating Point. | 1101 * @param number The number, a DigitList format Decimal Floating Point. |
| 1074 * @param appendTo Output parameter to receive result. | 1102 * @param appendTo Output parameter to receive result. |
| 1075 * Result is appended to existing contents. | 1103 * Result is appended to existing contents. |
| 1076 * @param posIter On return, can be used to iterate over positions | 1104 * @param posIter On return, can be used to iterate over positions |
| 1077 * of fields generated by this format call. | 1105 * of fields generated by this format call. |
| 1078 * @param status Output param filled with success/failure status. | 1106 * @param status Output param filled with success/failure status. |
| 1079 * @return Reference to 'appendTo' parameter. | 1107 * @return Reference to 'appendTo' parameter. |
| 1080 * @internal | 1108 * @internal |
| 1081 */ | 1109 */ |
| 1082 virtual UnicodeString& format(const DigitList &number, | 1110 virtual UnicodeString& format(const DigitList &number, |
| 1083 UnicodeString& appendTo, | 1111 UnicodeString& appendTo, |
| 1084 FieldPositionIterator* posIter, | 1112 FieldPositionIterator* posIter, |
| 1085 UErrorCode& status) const; | 1113 UErrorCode& status) const; |
| 1086 | 1114 |
| 1087 /** | 1115 /** |
| 1088 * Format a decimal number. | 1116 * Format a decimal number. |
| 1089 * The number is a DigitList wrapper onto a floating point decimal number. | 1117 * The number is a DigitList wrapper onto a floating point decimal number. |
| 1090 * The default implementation in NumberFormat converts the decimal number | 1118 * The default implementation in NumberFormat converts the decimal number |
| 1091 * to a double and formats that. | 1119 * to a double and formats that. |
| 1092 * | 1120 * |
| 1093 * @param number The number, a DigitList format Decimal Floating Point. | 1121 * @param number The number, a DigitList format Decimal Floating Point. |
| 1094 * @param appendTo Output parameter to receive result. | 1122 * @param appendTo Output parameter to receive result. |
| 1095 * Result is appended to existing contents. | 1123 * Result is appended to existing contents. |
| 1096 * @param pos On input: an alignment field, if desired. | 1124 * @param pos On input: an alignment field, if desired. |
| 1097 * On output: the offsets of the alignment field. | 1125 * On output: the offsets of the alignment field. |
| 1098 * @param status Output param filled with success/failure status. | 1126 * @param status Output param filled with success/failure status. |
| 1099 * @return Reference to 'appendTo' parameter. | 1127 * @return Reference to 'appendTo' parameter. |
| 1100 * @internal | 1128 * @internal |
| 1101 */ | 1129 */ |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 * Get the rounding mode. | 1358 * Get the rounding mode. |
| 1331 * @return A rounding mode | 1359 * @return A rounding mode |
| 1332 * @see #setRoundingIncrement | 1360 * @see #setRoundingIncrement |
| 1333 * @see #getRoundingIncrement | 1361 * @see #getRoundingIncrement |
| 1334 * @see #setRoundingMode | 1362 * @see #setRoundingMode |
| 1335 * @stable ICU 2.0 | 1363 * @stable ICU 2.0 |
| 1336 */ | 1364 */ |
| 1337 virtual ERoundingMode getRoundingMode(void) const; | 1365 virtual ERoundingMode getRoundingMode(void) const; |
| 1338 | 1366 |
| 1339 /** | 1367 /** |
| 1340 * Set the rounding mode. | 1368 * Set the rounding mode. |
| 1341 * @param roundingMode A rounding mode | 1369 * @param roundingMode A rounding mode |
| 1342 * @see #setRoundingIncrement | 1370 * @see #setRoundingIncrement |
| 1343 * @see #getRoundingIncrement | 1371 * @see #getRoundingIncrement |
| 1344 * @see #getRoundingMode | 1372 * @see #getRoundingMode |
| 1345 * @stable ICU 2.0 | 1373 * @stable ICU 2.0 |
| 1346 */ | 1374 */ |
| 1347 virtual void setRoundingMode(ERoundingMode roundingMode); | 1375 virtual void setRoundingMode(ERoundingMode roundingMode); |
| 1348 | 1376 |
| 1349 /** | 1377 /** |
| 1350 * Get the width to which the output of format() is padded. | 1378 * Get the width to which the output of format() is padded. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 /** | 1624 /** |
| 1597 * Allows you to set the behavior of the decimal separator with integers. | 1625 * Allows you to set the behavior of the decimal separator with integers. |
| 1598 * (The decimal separator will always appear with decimals.) | 1626 * (The decimal separator will always appear with decimals.) |
| 1599 * | 1627 * |
| 1600 * @param newValue set TRUE if the decimal separator will always appear w
ith decimals. | 1628 * @param newValue set TRUE if the decimal separator will always appear w
ith decimals. |
| 1601 * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 | 1629 * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 |
| 1602 * @stable ICU 2.0 | 1630 * @stable ICU 2.0 |
| 1603 */ | 1631 */ |
| 1604 virtual void setDecimalSeparatorAlwaysShown(UBool newValue); | 1632 virtual void setDecimalSeparatorAlwaysShown(UBool newValue); |
| 1605 | 1633 |
| 1634 #ifndef U_HIDE_DRAFT_API |
| 1635 /** |
| 1636 * Allows you to get the parse behavior of the pattern decimal mark. |
| 1637 * |
| 1638 * @return TRUE if input must contain a match to decimal mark in pattern |
| 1639 * @draft ICU 54 |
| 1640 */ |
| 1641 UBool isDecimalPatternMatchRequired(void) const; |
| 1642 #endif /* U_HIDE_DRAFT_API */ |
| 1643 |
| 1644 /** |
| 1645 * Allows you to set the behavior of the pattern decimal mark. |
| 1646 * |
| 1647 * if TRUE, the input must have a decimal mark if one was specified in the p
attern. When |
| 1648 * FALSE the decimal mark may be omitted from the input. |
| 1649 * |
| 1650 * @param newValue set TRUE if input must contain a match to decimal mark
in pattern |
| 1651 * @draft ICU 54 |
| 1652 */ |
| 1653 virtual void setDecimalPatternMatchRequired(UBool newValue); |
| 1654 |
| 1655 |
| 1606 /** | 1656 /** |
| 1607 * Synthesizes a pattern string that represents the current state | 1657 * Synthesizes a pattern string that represents the current state |
| 1608 * of this Format object. | 1658 * of this Format object. |
| 1609 * | 1659 * |
| 1610 * @param result Output param which will receive the pattern. | 1660 * @param result Output param which will receive the pattern. |
| 1611 * Previous contents are deleted. | 1661 * Previous contents are deleted. |
| 1612 * @return A reference to 'result'. | 1662 * @return A reference to 'result'. |
| 1613 * @see applyPattern | 1663 * @see applyPattern |
| 1614 * @stable ICU 2.0 | 1664 * @stable ICU 2.0 |
| 1615 */ | 1665 */ |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 */ | 1887 */ |
| 1838 virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec); | 1888 virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec); |
| 1839 | 1889 |
| 1840 /** | 1890 /** |
| 1841 * Sets the currency used to display currency amounts. See | 1891 * Sets the currency used to display currency amounts. See |
| 1842 * setCurrency(const UChar*, UErrorCode&). | 1892 * setCurrency(const UChar*, UErrorCode&). |
| 1843 * @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&). | 1893 * @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&). |
| 1844 */ | 1894 */ |
| 1845 virtual void setCurrency(const UChar* theCurrency); | 1895 virtual void setCurrency(const UChar* theCurrency); |
| 1846 | 1896 |
| 1897 #ifndef U_HIDE_DRAFT_API |
| 1898 /** |
| 1899 * Sets the <tt>Currency Context</tt> object used to display currency. |
| 1900 * This takes effect immediately, if this format is a |
| 1901 * currency format. |
| 1902 * @param currencyContext new currency context object to use. |
| 1903 * @draft ICU 54 |
| 1904 */ |
| 1905 void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec); |
| 1906 |
| 1907 /** |
| 1908 * Returns the <tt>Currency Context</tt> object used to display currency |
| 1909 * @draft ICU 54 |
| 1910 */ |
| 1911 UCurrencyUsage getCurrencyUsage() const; |
| 1912 #endif /* U_HIDE_DRAFT_API */ |
| 1913 |
| 1914 |
| 1915 #ifndef U_HIDE_DEPRECATED_API |
| 1847 /** | 1916 /** |
| 1848 * The resource tags we use to retrieve decimal format data from | 1917 * The resource tags we use to retrieve decimal format data from |
| 1849 * locale resource bundles. | 1918 * locale resource bundles. |
| 1850 * @deprecated ICU 3.4. This string has no public purpose. Please don't use
it. | 1919 * @deprecated ICU 3.4. This string has no public purpose. Please don't use
it. |
| 1851 */ | 1920 */ |
| 1852 static const char fgNumberPatterns[]; | 1921 static const char fgNumberPatterns[]; |
| 1922 #endif /* U_HIDE_DEPRECATED_API */ |
| 1853 | 1923 |
| 1854 #ifndef U_HIDE_INTERNAL_API | 1924 #ifndef U_HIDE_INTERNAL_API |
| 1855 /** | 1925 /** |
| 1856 * Get a FixedDecimal corresponding to a double as it would be | 1926 * Get a FixedDecimal corresponding to a double as it would be |
| 1857 * formatted by this DecimalFormat. | 1927 * formatted by this DecimalFormat. |
| 1858 * Internal, not intended for public use. | 1928 * Internal, not intended for public use. |
| 1859 * @internal | 1929 * @internal |
| 1860 */ | 1930 */ |
| 1861 FixedDecimal getFixedDecimal(double number, UErrorCode &status) const; | 1931 FixedDecimal getFixedDecimal(double number, UErrorCode &status) const; |
| 1862 | 1932 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 * @param appendTo Output parameter to receive result. | 2051 * @param appendTo Output parameter to receive result. |
| 1982 * Result is appended to existing contents. | 2052 * Result is appended to existing contents. |
| 1983 * @param handler Records information about field positions. | 2053 * @param handler Records information about field positions. |
| 1984 * @param digits the digits to be formatted. | 2054 * @param digits the digits to be formatted. |
| 1985 * @param isInteger if TRUE format the digits as Integer. | 2055 * @param isInteger if TRUE format the digits as Integer. |
| 1986 * @return Reference to 'appendTo' parameter. | 2056 * @return Reference to 'appendTo' parameter. |
| 1987 */ | 2057 */ |
| 1988 UnicodeString& subformat(UnicodeString& appendTo, | 2058 UnicodeString& subformat(UnicodeString& appendTo, |
| 1989 FieldPositionHandler& handler, | 2059 FieldPositionHandler& handler, |
| 1990 DigitList& digits, | 2060 DigitList& digits, |
| 1991 UBool isInteger, | 2061 UBool isInteger, |
| 1992 UErrorCode &status) const; | 2062 UErrorCode &status) const; |
| 1993 | 2063 |
| 1994 | 2064 |
| 1995 void parse(const UnicodeString& text, | 2065 void parse(const UnicodeString& text, |
| 1996 Formattable& result, | 2066 Formattable& result, |
| 1997 ParsePosition& pos, | 2067 ParsePosition& pos, |
| 1998 UChar* currency) const; | 2068 UChar* currency) const; |
| 1999 | 2069 |
| 2000 enum { | 2070 enum { |
| 2001 fgStatusInfinite, | 2071 fgStatusInfinite, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 void setupCurrencyAffixPatterns(UErrorCode& status); | 2200 void setupCurrencyAffixPatterns(UErrorCode& status); |
| 2131 | 2201 |
| 2132 // set up the currency affixes used in currency plural formatting. | 2202 // set up the currency affixes used in currency plural formatting. |
| 2133 // It sets up both fAffixesForCurrency for currency pattern if the current | 2203 // It sets up both fAffixesForCurrency for currency pattern if the current |
| 2134 // pattern contains 3 currency signs, | 2204 // pattern contains 3 currency signs, |
| 2135 // and it sets up fPluralAffixesForCurrency for currency plural patterns. | 2205 // and it sets up fPluralAffixesForCurrency for currency plural patterns. |
| 2136 void setupCurrencyAffixes(const UnicodeString& pattern, | 2206 void setupCurrencyAffixes(const UnicodeString& pattern, |
| 2137 UBool setupForCurrentPattern, | 2207 UBool setupForCurrentPattern, |
| 2138 UBool setupForPluralPattern, | 2208 UBool setupForPluralPattern, |
| 2139 UErrorCode& status); | 2209 UErrorCode& status); |
| 2210 |
| 2211 // get the currency rounding with respect to currency usage |
| 2212 double getCurrencyRounding(const UChar* currency, |
| 2213 UErrorCode* ec) const; |
| 2214 |
| 2215 // get the currency fraction with respect to currency usage |
| 2216 int getCurrencyFractionDigits(const UChar* currency, |
| 2217 UErrorCode* ec) const; |
| 2140 | 2218 |
| 2141 // hashtable operations | 2219 // hashtable operations |
| 2142 Hashtable* initHashForAffixPattern(UErrorCode& status); | 2220 Hashtable* initHashForAffixPattern(UErrorCode& status); |
| 2143 Hashtable* initHashForAffix(UErrorCode& status); | 2221 Hashtable* initHashForAffix(UErrorCode& status); |
| 2144 | 2222 |
| 2145 void deleteHashForAffixPattern(); | 2223 void deleteHashForAffixPattern(); |
| 2146 void deleteHashForAffix(Hashtable*& table); | 2224 void deleteHashForAffix(Hashtable*& table); |
| 2147 | 2225 |
| 2148 void copyHashForAffixPattern(const Hashtable* source, | 2226 void copyHashForAffixPattern(const Hashtable* source, |
| 2149 Hashtable* target, UErrorCode& status); | 2227 Hashtable* target, UErrorCode& status); |
| 2150 void copyHashForAffix(const Hashtable* source, | 2228 void copyHashForAffix(const Hashtable* source, |
| 2151 Hashtable* target, UErrorCode& status); | 2229 Hashtable* target, UErrorCode& status); |
| 2152 | 2230 |
| 2153 UnicodeString& _format(int64_t number, | 2231 UnicodeString& _format(int64_t number, |
| 2154 UnicodeString& appendTo, | 2232 UnicodeString& appendTo, |
| 2155 FieldPositionHandler& handler, | 2233 FieldPositionHandler& handler, |
| 2156 UErrorCode &status) const; | 2234 UErrorCode &status) const; |
| 2157 UnicodeString& _format(double number, | 2235 UnicodeString& _format(double number, |
| 2158 UnicodeString& appendTo, | 2236 UnicodeString& appendTo, |
| 2159 FieldPositionHandler& handler, | 2237 FieldPositionHandler& handler, |
| 2160 UErrorCode &status) const; | 2238 UErrorCode &status) const; |
| 2161 UnicodeString& _format(const DigitList &number, | 2239 UnicodeString& _format(const DigitList &number, |
| 2162 UnicodeString& appendTo, | 2240 UnicodeString& appendTo, |
| 2163 FieldPositionHandler& handler, | 2241 FieldPositionHandler& handler, |
| 2164 UErrorCode &status) const; | 2242 UErrorCode &status) const; |
| 2165 | 2243 |
| 2166 // currency sign count | |
| 2167 enum { | |
| 2168 fgCurrencySignCountZero, | |
| 2169 fgCurrencySignCountInSymbolFormat, | |
| 2170 fgCurrencySignCountInISOFormat, | |
| 2171 fgCurrencySignCountInPluralFormat | |
| 2172 } CurrencySignCount; | |
| 2173 | |
| 2174 /** | 2244 /** |
| 2175 * Constants. | 2245 * Constants. |
| 2176 */ | 2246 */ |
| 2177 | 2247 |
| 2178 UnicodeString fPositivePrefix; | 2248 UnicodeString fPositivePrefix; |
| 2179 UnicodeString fPositiveSuffix; | 2249 UnicodeString fPositiveSuffix; |
| 2180 UnicodeString fNegativePrefix; | 2250 UnicodeString fNegativePrefix; |
| 2181 UnicodeString fNegativeSuffix; | 2251 UnicodeString fNegativeSuffix; |
| 2182 UnicodeString* fPosPrefixPattern; | 2252 UnicodeString* fPosPrefixPattern; |
| 2183 UnicodeString* fPosSuffixPattern; | 2253 UnicodeString* fPosSuffixPattern; |
| 2184 UnicodeString* fNegPrefixPattern; | 2254 UnicodeString* fNegPrefixPattern; |
| 2185 UnicodeString* fNegSuffixPattern; | 2255 UnicodeString* fNegSuffixPattern; |
| 2186 | 2256 |
| 2187 /** | 2257 /** |
| 2188 * Formatter for ChoiceFormat-based currency names. If this field | 2258 * Formatter for ChoiceFormat-based currency names. If this field |
| 2189 * is not null, then delegate to it to format currency symbols. | 2259 * is not null, then delegate to it to format currency symbols. |
| 2190 * @since ICU 2.6 | 2260 * @since ICU 2.6 |
| 2191 */ | 2261 */ |
| 2192 ChoiceFormat* fCurrencyChoice; | 2262 ChoiceFormat* fCurrencyChoice; |
| 2193 | 2263 |
| 2194 DigitList * fMultiplier; // NULL for multiplier of one | 2264 DigitList * fMultiplier; // NULL for multiplier of one |
| 2195 int32_t fScale; | 2265 int32_t fScale; |
| 2196 int32_t fGroupingSize; | 2266 int32_t fGroupingSize; |
| 2197 int32_t fGroupingSize2; | 2267 int32_t fGroupingSize2; |
| 2198 UBool fDecimalSeparatorAlwaysShown; | 2268 UBool fDecimalSeparatorAlwaysShown; |
| 2199 DecimalFormatSymbols* fSymbols; | 2269 DecimalFormatSymbols* fSymbols; |
| 2200 | 2270 |
| 2201 UBool fUseSignificantDigits; | 2271 UBool fUseSignificantDigits; |
| 2202 int32_t fMinSignificantDigits; | 2272 int32_t fMinSignificantDigits; |
| 2203 int32_t fMaxSignificantDigits; | 2273 int32_t fMaxSignificantDigits; |
| 2204 | 2274 |
| 2205 UBool fUseExponentialNotation; | 2275 UBool fUseExponentialNotation; |
| 2206 int8_t fMinExponentDigits; | 2276 int8_t fMinExponentDigits; |
| 2207 UBool fExponentSignAlwaysShown; | 2277 UBool fExponentSignAlwaysShown; |
| 2208 | 2278 |
| 2209 EnumSet<UNumberFormatAttribute, | 2279 EnumSet<UNumberFormatAttribute, |
| 2210 UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1, | 2280 UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1, |
| 2211 UNUM_LIMIT_BOOLEAN_ATTRIBUTE> | 2281 UNUM_LIMIT_BOOLEAN_ATTRIBUTE> |
| 2212 fBoolFlags; | 2282 fBoolFlags; |
| 2213 | 2283 |
| 2214 DigitList* fRoundingIncrement; // NULL if no rounding incremen
t specified. | 2284 DigitList* fRoundingIncrement; // NULL if no rounding incremen
t specified. |
| 2215 ERoundingMode fRoundingMode; | 2285 ERoundingMode fRoundingMode; |
| 2216 | 2286 |
| 2217 UChar32 fPad; | 2287 UChar32 fPad; |
| 2218 int32_t fFormatWidth; | 2288 int32_t fFormatWidth; |
| 2219 EPadPosition fPadPosition; | 2289 EPadPosition fPadPosition; |
| 2220 | 2290 |
| 2221 /* | 2291 /* |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 | 2398 |
| 2329 // Information needed for DecimalFormat to format/parse currency plural. | 2399 // Information needed for DecimalFormat to format/parse currency plural. |
| 2330 CurrencyPluralInfo* fCurrencyPluralInfo; | 2400 CurrencyPluralInfo* fCurrencyPluralInfo; |
| 2331 | 2401 |
| 2332 #if UCONFIG_HAVE_PARSEALLINPUT | 2402 #if UCONFIG_HAVE_PARSEALLINPUT |
| 2333 UNumberFormatAttributeValue fParseAllInput; | 2403 UNumberFormatAttributeValue fParseAllInput; |
| 2334 #endif | 2404 #endif |
| 2335 | 2405 |
| 2336 // Decimal Format Static Sets singleton. | 2406 // Decimal Format Static Sets singleton. |
| 2337 const DecimalFormatStaticSets *fStaticSets; | 2407 const DecimalFormatStaticSets *fStaticSets; |
| 2338 | 2408 » |
| 2409 // Currency Usage(STANDARD vs CASH) |
| 2410 UCurrencyUsage fCurrencyUsage; |
| 2339 | 2411 |
| 2340 protected: | 2412 protected: |
| 2341 | 2413 |
| 2342 #ifndef U_HIDE_INTERNAL_API | 2414 #ifndef U_HIDE_INTERNAL_API |
| 2343 /** | 2415 /** |
| 2344 * Rounds a value according to the rules of this object. | 2416 * Rounds a value according to the rules of this object. |
| 2345 * @internal | 2417 * @internal |
| 2346 */ | 2418 */ |
| 2347 DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& is
Negative, UErrorCode& status) const; | 2419 DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& is
Negative, UErrorCode& status) const; |
| 2348 #endif /* U_HIDE_INTERNAL_API */ | 2420 #endif /* U_HIDE_INTERNAL_API */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2374 * this number, it wouldn't make sense anyway, and this is just to make sure | 2446 * this number, it wouldn't make sense anyway, and this is just to make sure |
| 2375 * that someone turning on scientific mode with default settings doesn't | 2447 * that someone turning on scientific mode with default settings doesn't |
| 2376 * end up with lots of zeroes. | 2448 * end up with lots of zeroes. |
| 2377 * @stable ICU 2.8 | 2449 * @stable ICU 2.8 |
| 2378 */ | 2450 */ |
| 2379 static const int32_t kMaxScientificIntegerDigits; | 2451 static const int32_t kMaxScientificIntegerDigits; |
| 2380 | 2452 |
| 2381 #if UCONFIG_FORMAT_FASTPATHS_49 | 2453 #if UCONFIG_FORMAT_FASTPATHS_49 |
| 2382 private: | 2454 private: |
| 2383 /** | 2455 /** |
| 2384 * Internal state. | 2456 * Internal state. |
| 2385 * @internal | 2457 * @internal |
| 2386 */ | 2458 */ |
| 2387 uint8_t fReserved[UNUM_DECIMALFORMAT_INTERNAL_SIZE]; | 2459 uint8_t fReserved[UNUM_DECIMALFORMAT_INTERNAL_SIZE]; |
| 2388 | 2460 |
| 2389 | 2461 |
| 2390 /** | 2462 /** |
| 2391 * Called whenever any state changes. Recomputes whether fastpath is OK to u
se. | 2463 * Called whenever any state changes. Recomputes whether fastpath is OK to u
se. |
| 2392 */ | 2464 */ |
| 2393 void handleChanged(); | 2465 void handleChanged(); |
| 2394 #endif | 2466 #endif |
| 2395 }; | 2467 }; |
| 2396 | 2468 |
| 2397 inline const UnicodeString & | 2469 inline const UnicodeString & |
| 2398 DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol)
const { | 2470 DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol)
const { |
| 2399 return fSymbols->getConstSymbol(symbol); | 2471 return fSymbols->getConstSymbol(symbol); |
| 2400 } | 2472 } |
| 2401 | 2473 |
| 2402 U_NAMESPACE_END | 2474 U_NAMESPACE_END |
| 2403 | 2475 |
| 2404 #endif /* #if !UCONFIG_NO_FORMATTING */ | 2476 #endif /* #if !UCONFIG_NO_FORMATTING */ |
| 2405 | 2477 |
| 2406 #endif // _DECIMFMT | 2478 #endif // _DECIMFMT |
| 2407 //eof | 2479 //eof |
| OLD | NEW |