OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 1997-2014, International Business Machines Corporation and other
s. | 3 * Copyright (C) 1997-2015, International Business Machines Corporation and other
s. |
4 * All Rights Reserved. | 4 * All Rights Reserved. |
5 * Modification History: | 5 * Modification History: |
6 * | 6 * |
7 * Date Name Description | 7 * Date Name Description |
8 * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixe
s | 8 * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixe
s |
9 ******************************************************************************* | 9 ******************************************************************************* |
10 */ | 10 */ |
11 | 11 |
12 #ifndef _UNUM | 12 #ifndef _UNUM |
13 #define _UNUM | 13 #define _UNUM |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 * Decimal format defined by a pattern string. | 141 * Decimal format defined by a pattern string. |
142 * @stable ICU 3.0 | 142 * @stable ICU 3.0 |
143 */ | 143 */ |
144 UNUM_PATTERN_DECIMAL=0, | 144 UNUM_PATTERN_DECIMAL=0, |
145 /** | 145 /** |
146 * Decimal format ("normal" style). | 146 * Decimal format ("normal" style). |
147 * @stable ICU 2.0 | 147 * @stable ICU 2.0 |
148 */ | 148 */ |
149 UNUM_DECIMAL=1, | 149 UNUM_DECIMAL=1, |
150 /** | 150 /** |
151 * Currency format with a currency symbol, e.g., "$1.00". | 151 * Currency format (generic). |
| 152 * Defaults to UNUM_CURRENCY_STANDARD style |
| 153 * (using currency symbol, e.g., "$1.00", with non-accounting |
| 154 * style for negative values e.g. using minus sign). |
| 155 * The specific style may be specified using the -cf- locale key. |
152 * @stable ICU 2.0 | 156 * @stable ICU 2.0 |
153 */ | 157 */ |
154 UNUM_CURRENCY=2, | 158 UNUM_CURRENCY=2, |
155 /** | 159 /** |
156 * Percent format | 160 * Percent format |
157 * @stable ICU 2.0 | 161 * @stable ICU 2.0 |
158 */ | 162 */ |
159 UNUM_PERCENT=3, | 163 UNUM_PERCENT=3, |
160 /** | 164 /** |
161 * Scientific format | 165 * Scientific format |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 * Currency format with an ISO currency code, e.g., "USD1.00". | 199 * Currency format with an ISO currency code, e.g., "USD1.00". |
196 * @stable ICU 4.8 | 200 * @stable ICU 4.8 |
197 */ | 201 */ |
198 UNUM_CURRENCY_ISO=10, | 202 UNUM_CURRENCY_ISO=10, |
199 /** | 203 /** |
200 * Currency format with a pluralized currency name, | 204 * Currency format with a pluralized currency name, |
201 * e.g., "1.00 US dollar" and "3.00 US dollars". | 205 * e.g., "1.00 US dollar" and "3.00 US dollars". |
202 * @stable ICU 4.8 | 206 * @stable ICU 4.8 |
203 */ | 207 */ |
204 UNUM_CURRENCY_PLURAL=11, | 208 UNUM_CURRENCY_PLURAL=11, |
205 #ifndef U_HIDE_DRAFT_API | |
206 /** | 209 /** |
207 * Currency format for accounting, e.g., "($3.00)" for | 210 * Currency format for accounting, e.g., "($3.00)" for |
208 * negative currency amount instead of "-$3.00" ({@link #UNUM_CURRENCY}). | 211 * negative currency amount instead of "-$3.00" ({@link #UNUM_CURRENCY}). |
209 * @draft ICU 53 | 212 * Overrides any style specified using -cf- key in locale. |
| 213 * @stable ICU 53 |
210 */ | 214 */ |
211 UNUM_CURRENCY_ACCOUNTING=12, | 215 UNUM_CURRENCY_ACCOUNTING=12, |
212 /** | 216 /** |
213 * Currency format with a currency symbol given CASH usage, e.g., | 217 * Currency format with a currency symbol given CASH usage, e.g., |
214 * "NT$3" instead of "NT$3.23". | 218 * "NT$3" instead of "NT$3.23". |
215 * @draft ICU 54 | 219 * @stable ICU 54 |
216 */ | 220 */ |
217 UNUM_CASH_CURRENCY=13, | 221 UNUM_CASH_CURRENCY=13, |
| 222 #ifndef U_HIDE_DRAFT_API |
| 223 /** |
| 224 * Decimal format expressed using compact notation |
| 225 * (short form, corresponds to UNumberCompactStyle=UNUM_SHORT) |
| 226 * e.g. "23K", "45B" |
| 227 * @draft ICU 56 |
| 228 */ |
| 229 UNUM_DECIMAL_COMPACT_SHORT=14, |
| 230 /** |
| 231 * Decimal format expressed using compact notation |
| 232 * (long form, corresponds to UNumberCompactStyle=UNUM_LONG) |
| 233 * e.g. "23 thousand", "45 billion" |
| 234 * @draft ICU 56 |
| 235 */ |
| 236 UNUM_DECIMAL_COMPACT_LONG=15, |
| 237 /** |
| 238 * Currency format with a currency symbol, e.g., "$1.00", |
| 239 * using non-accounting style for negative values (e.g. minus sign). |
| 240 * Overrides any style specified using -cf- key in locale. |
| 241 * @draft ICU 56 |
| 242 */ |
| 243 UNUM_CURRENCY_STANDARD=16, |
218 #endif /* U_HIDE_DRAFT_API */ | 244 #endif /* U_HIDE_DRAFT_API */ |
219 | 245 |
220 /** | 246 /** |
221 * One more than the highest number format style constant. | 247 * One more than the highest number format style constant. |
222 * @stable ICU 4.8 | 248 * @stable ICU 4.8 |
223 */ | 249 */ |
224 UNUM_FORMAT_STYLE_COUNT=14, | 250 UNUM_FORMAT_STYLE_COUNT=17, |
225 | 251 |
226 /** | 252 /** |
227 * Default format | 253 * Default format |
228 * @stable ICU 2.0 | 254 * @stable ICU 2.0 |
229 */ | 255 */ |
230 UNUM_DEFAULT = UNUM_DECIMAL, | 256 UNUM_DEFAULT = UNUM_DECIMAL, |
231 /** | 257 /** |
232 * Alias for UNUM_PATTERN_DECIMAL | 258 * Alias for UNUM_PATTERN_DECIMAL |
233 * @stable ICU 3.0 | 259 * @stable ICU 3.0 |
234 */ | 260 */ |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 unum_formatUFormattable(const UNumberFormat* fmt, | 634 unum_formatUFormattable(const UNumberFormat* fmt, |
609 const UFormattable *number, | 635 const UFormattable *number, |
610 UChar *result, | 636 UChar *result, |
611 int32_t resultLength, | 637 int32_t resultLength, |
612 UFieldPosition *pos, | 638 UFieldPosition *pos, |
613 UErrorCode *status); | 639 UErrorCode *status); |
614 | 640 |
615 /** | 641 /** |
616 * Parse a string into an integer using a UNumberFormat. | 642 * Parse a string into an integer using a UNumberFormat. |
617 * The string will be parsed according to the UNumberFormat's locale. | 643 * The string will be parsed according to the UNumberFormat's locale. |
| 644 * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
| 645 * and UNUM_DECIMAL_COMPACT_LONG. |
618 * @param fmt The formatter to use. | 646 * @param fmt The formatter to use. |
619 * @param text The text to parse. | 647 * @param text The text to parse. |
620 * @param textLength The length of text, or -1 if null-terminated. | 648 * @param textLength The length of text, or -1 if null-terminated. |
621 * @param parsePos If not NULL, on input a pointer to an integer specifying the o
ffset at which | 649 * @param parsePos If not NULL, on input a pointer to an integer specifying the o
ffset at which |
622 * to begin parsing. If not NULL, on output the offset at which parsing ended. | 650 * to begin parsing. If not NULL, on output the offset at which parsing ended. |
623 * @param status A pointer to an UErrorCode to receive any errors | 651 * @param status A pointer to an UErrorCode to receive any errors |
624 * @return The value of the parsed integer | 652 * @return The value of the parsed integer |
625 * @see unum_parseInt64 | 653 * @see unum_parseInt64 |
626 * @see unum_parseDouble | 654 * @see unum_parseDouble |
627 * @see unum_format | 655 * @see unum_format |
628 * @see unum_formatInt64 | 656 * @see unum_formatInt64 |
629 * @see unum_formatDouble | 657 * @see unum_formatDouble |
630 * @stable ICU 2.0 | 658 * @stable ICU 2.0 |
631 */ | 659 */ |
632 U_STABLE int32_t U_EXPORT2 | 660 U_STABLE int32_t U_EXPORT2 |
633 unum_parse( const UNumberFormat* fmt, | 661 unum_parse( const UNumberFormat* fmt, |
634 const UChar* text, | 662 const UChar* text, |
635 int32_t textLength, | 663 int32_t textLength, |
636 int32_t *parsePos /* 0 = start */, | 664 int32_t *parsePos /* 0 = start */, |
637 UErrorCode *status); | 665 UErrorCode *status); |
638 | 666 |
639 /** | 667 /** |
640 * Parse a string into an int64 using a UNumberFormat. | 668 * Parse a string into an int64 using a UNumberFormat. |
641 * The string will be parsed according to the UNumberFormat's locale. | 669 * The string will be parsed according to the UNumberFormat's locale. |
| 670 * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
| 671 * and UNUM_DECIMAL_COMPACT_LONG. |
642 * @param fmt The formatter to use. | 672 * @param fmt The formatter to use. |
643 * @param text The text to parse. | 673 * @param text The text to parse. |
644 * @param textLength The length of text, or -1 if null-terminated. | 674 * @param textLength The length of text, or -1 if null-terminated. |
645 * @param parsePos If not NULL, on input a pointer to an integer specifying the o
ffset at which | 675 * @param parsePos If not NULL, on input a pointer to an integer specifying the o
ffset at which |
646 * to begin parsing. If not NULL, on output the offset at which parsing ended. | 676 * to begin parsing. If not NULL, on output the offset at which parsing ended. |
647 * @param status A pointer to an UErrorCode to receive any errors | 677 * @param status A pointer to an UErrorCode to receive any errors |
648 * @return The value of the parsed integer | 678 * @return The value of the parsed integer |
649 * @see unum_parse | 679 * @see unum_parse |
650 * @see unum_parseDouble | 680 * @see unum_parseDouble |
651 * @see unum_format | 681 * @see unum_format |
652 * @see unum_formatInt64 | 682 * @see unum_formatInt64 |
653 * @see unum_formatDouble | 683 * @see unum_formatDouble |
654 * @stable ICU 2.8 | 684 * @stable ICU 2.8 |
655 */ | 685 */ |
656 U_STABLE int64_t U_EXPORT2 | 686 U_STABLE int64_t U_EXPORT2 |
657 unum_parseInt64(const UNumberFormat* fmt, | 687 unum_parseInt64(const UNumberFormat* fmt, |
658 const UChar* text, | 688 const UChar* text, |
659 int32_t textLength, | 689 int32_t textLength, |
660 int32_t *parsePos /* 0 = start */, | 690 int32_t *parsePos /* 0 = start */, |
661 UErrorCode *status); | 691 UErrorCode *status); |
662 | 692 |
663 /** | 693 /** |
664 * Parse a string into a double using a UNumberFormat. | 694 * Parse a string into a double using a UNumberFormat. |
665 * The string will be parsed according to the UNumberFormat's locale. | 695 * The string will be parsed according to the UNumberFormat's locale. |
| 696 * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
| 697 * and UNUM_DECIMAL_COMPACT_LONG. |
666 * @param fmt The formatter to use. | 698 * @param fmt The formatter to use. |
667 * @param text The text to parse. | 699 * @param text The text to parse. |
668 * @param textLength The length of text, or -1 if null-terminated. | 700 * @param textLength The length of text, or -1 if null-terminated. |
669 * @param parsePos If not NULL, on input a pointer to an integer specifying the o
ffset at which | 701 * @param parsePos If not NULL, on input a pointer to an integer specifying the o
ffset at which |
670 * to begin parsing. If not NULL, on output the offset at which parsing ended. | 702 * to begin parsing. If not NULL, on output the offset at which parsing ended. |
671 * @param status A pointer to an UErrorCode to receive any errors | 703 * @param status A pointer to an UErrorCode to receive any errors |
672 * @return The value of the parsed double | 704 * @return The value of the parsed double |
673 * @see unum_parse | 705 * @see unum_parse |
674 * @see unum_parseInt64 | 706 * @see unum_parseInt64 |
675 * @see unum_format | 707 * @see unum_format |
676 * @see unum_formatInt64 | 708 * @see unum_formatInt64 |
677 * @see unum_formatDouble | 709 * @see unum_formatDouble |
678 * @stable ICU 2.0 | 710 * @stable ICU 2.0 |
679 */ | 711 */ |
680 U_STABLE double U_EXPORT2 | 712 U_STABLE double U_EXPORT2 |
681 unum_parseDouble( const UNumberFormat* fmt, | 713 unum_parseDouble( const UNumberFormat* fmt, |
682 const UChar* text, | 714 const UChar* text, |
683 int32_t textLength, | 715 int32_t textLength, |
684 int32_t *parsePos /* 0 = start */, | 716 int32_t *parsePos /* 0 = start */, |
685 UErrorCode *status); | 717 UErrorCode *status); |
686 | 718 |
687 | 719 |
688 /** | 720 /** |
689 * Parse a number from a string into an unformatted numeric string using a UNumbe
rFormat. | 721 * Parse a number from a string into an unformatted numeric string using a UNumbe
rFormat. |
690 * The input string will be parsed according to the UNumberFormat's locale. | 722 * The input string will be parsed according to the UNumberFormat's locale. |
691 * The syntax of the output is a "numeric string" | 723 * The syntax of the output is a "numeric string" |
692 * as defined in the Decimal Arithmetic Specification, available at | 724 * as defined in the Decimal Arithmetic Specification, available at |
693 * http://speleotrove.com/decimal | 725 * http://speleotrove.com/decimal |
| 726 * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
| 727 * and UNUM_DECIMAL_COMPACT_LONG. |
694 * @param fmt The formatter to use. | 728 * @param fmt The formatter to use. |
695 * @param text The text to parse. | 729 * @param text The text to parse. |
696 * @param textLength The length of text, or -1 if null-terminated. | 730 * @param textLength The length of text, or -1 if null-terminated. |
697 * @param parsePos If not NULL, on input a pointer to an integer specifying the o
ffset at which | 731 * @param parsePos If not NULL, on input a pointer to an integer specifying the o
ffset at which |
698 * to begin parsing. If not NULL, on output the offset at which
parsing ended. | 732 * to begin parsing. If not NULL, on output the offset at which
parsing ended. |
699 * @param outBuf A (char *) buffer to receive the parsed number as a string. The
output string | 733 * @param outBuf A (char *) buffer to receive the parsed number as a string. The
output string |
700 * will be nul-terminated if there is sufficient space. | 734 * will be nul-terminated if there is sufficient space. |
701 * @param outBufLength The size of the output buffer. May be zero, in which case | 735 * @param outBufLength The size of the output buffer. May be zero, in which case |
702 * the outBuf pointer may be NULL, and the function will return the | 736 * the outBuf pointer may be NULL, and the function will return the |
703 * size of the output string. | 737 * size of the output string. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 const UChar* text, | 777 const UChar* text, |
744 int32_t textLength, | 778 int32_t textLength, |
745 int32_t* parsePos, /* 0 = start */ | 779 int32_t* parsePos, /* 0 = start */ |
746 UChar* currency, | 780 UChar* currency, |
747 UErrorCode* status); | 781 UErrorCode* status); |
748 | 782 |
749 /** | 783 /** |
750 * Parse a UChar string into a UFormattable. | 784 * Parse a UChar string into a UFormattable. |
751 * Example code: | 785 * Example code: |
752 * \snippet test/cintltst/cnumtst.c unum_parseToUFormattable | 786 * \snippet test/cintltst/cnumtst.c unum_parseToUFormattable |
| 787 * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
| 788 * and UNUM_DECIMAL_COMPACT_LONG. |
753 * @param fmt the formatter to use | 789 * @param fmt the formatter to use |
754 * @param result the UFormattable to hold the result. If NULL, a new UFormattabl
e will be allocated (which the caller must close with ufmt_close). | 790 * @param result the UFormattable to hold the result. If NULL, a new UFormattabl
e will be allocated (which the caller must close with ufmt_close). |
755 * @param text the text to parse | 791 * @param text the text to parse |
756 * @param textLength the length of text, or -1 if null-terminated | 792 * @param textLength the length of text, or -1 if null-terminated |
757 * @param parsePos a pointer to an offset index into text at which to | 793 * @param parsePos a pointer to an offset index into text at which to |
758 * begin parsing. On output, *parsePos will point after the last | 794 * begin parsing. On output, *parsePos will point after the last |
759 * parsed character. This parameter may be NULL in which case parsing | 795 * parsed character. This parameter may be NULL in which case parsing |
760 * begins at offset 0. | 796 * begins at offset 0. |
761 * @param status a pointer to an input-output UErrorCode | 797 * @param status a pointer to an input-output UErrorCode |
762 * @return the UFormattable. Will be ==result unless NULL was passed in for res
ult, in which case it will be the newly opened UFormattable. | 798 * @return the UFormattable. Will be ==result unless NULL was passed in for res
ult, in which case it will be the newly opened UFormattable. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 * @internal | 864 * @internal |
829 */ | 865 */ |
830 typedef enum UNumberFormatAttributeValue { | 866 typedef enum UNumberFormatAttributeValue { |
831 #ifndef U_HIDE_INTERNAL_API | 867 #ifndef U_HIDE_INTERNAL_API |
832 /** @internal */ | 868 /** @internal */ |
833 UNUM_NO = 0, | 869 UNUM_NO = 0, |
834 /** @internal */ | 870 /** @internal */ |
835 UNUM_YES = 1, | 871 UNUM_YES = 1, |
836 /** @internal */ | 872 /** @internal */ |
837 UNUM_MAYBE = 2 | 873 UNUM_MAYBE = 2 |
| 874 #else |
| 875 /** @internal */ |
| 876 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN |
838 #endif /* U_HIDE_INTERNAL_API */ | 877 #endif /* U_HIDE_INTERNAL_API */ |
839 } UNumberFormatAttributeValue; | 878 } UNumberFormatAttributeValue; |
840 #endif | 879 #endif |
841 | 880 |
842 /** The possible UNumberFormat numeric attributes @stable ICU 2.0 */ | 881 /** The possible UNumberFormat numeric attributes @stable ICU 2.0 */ |
843 typedef enum UNumberFormatAttribute { | 882 typedef enum UNumberFormatAttribute { |
844 /** Parse integers only */ | 883 /** Parse integers only */ |
845 UNUM_PARSE_INT_ONLY, | 884 UNUM_PARSE_INT_ONLY, |
846 /** Use grouping separator */ | 885 /** Use grouping separator */ |
847 UNUM_GROUPING_USED, | 886 UNUM_GROUPING_USED, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 UNUM_MAX_SIGNIFICANT_DIGITS, | 923 UNUM_MAX_SIGNIFICANT_DIGITS, |
885 /** Lenient parse mode used by rule-based formats. | 924 /** Lenient parse mode used by rule-based formats. |
886 * @stable ICU 3.0 | 925 * @stable ICU 3.0 |
887 */ | 926 */ |
888 UNUM_LENIENT_PARSE, | 927 UNUM_LENIENT_PARSE, |
889 #if UCONFIG_HAVE_PARSEALLINPUT | 928 #if UCONFIG_HAVE_PARSEALLINPUT |
890 /** Consume all input. (may use fastpath). Set to UNUM_YES (require fastpath),
UNUM_NO (skip fastpath), or UNUM_MAYBE (heuristic). | 929 /** Consume all input. (may use fastpath). Set to UNUM_YES (require fastpath),
UNUM_NO (skip fastpath), or UNUM_MAYBE (heuristic). |
891 * This is an internal ICU API. Do not use. | 930 * This is an internal ICU API. Do not use. |
892 * @internal | 931 * @internal |
893 */ | 932 */ |
894 UNUM_PARSE_ALL_INPUT = UNUM_LENIENT_PARSE + 1, | 933 UNUM_PARSE_ALL_INPUT = 20, |
895 #endif | 934 #endif |
896 /** | 935 /** |
897 * Scale, which adjusts the position of the | 936 * Scale, which adjusts the position of the |
898 * decimal point when formatting. Amounts will be multiplied by 10 ^ (scale) | 937 * decimal point when formatting. Amounts will be multiplied by 10 ^ (scale) |
899 * before they are formatted. The default value for the scale is 0 ( no adju
stment ). | 938 * before they are formatted. The default value for the scale is 0 ( no adju
stment ). |
900 * | 939 * |
901 * <p>Example: setting the scale to 3, 123 formats as "123,000" | 940 * <p>Example: setting the scale to 3, 123 formats as "123,000" |
902 * <p>Example: setting the scale to -4, 123 formats as "0.0123" | 941 * <p>Example: setting the scale to -4, 123 formats as "0.0123" |
903 * | 942 * |
904 * @stable ICU 51 */ | 943 * @stable ICU 51 */ |
905 UNUM_SCALE = UNUM_LENIENT_PARSE + 2, | 944 UNUM_SCALE = 21, |
906 | |
907 #ifndef U_HIDE_INTERNAL_API | 945 #ifndef U_HIDE_INTERNAL_API |
908 /** Count of "regular" numeric attributes. | 946 /** |
909 * @internal */ | 947 * Minimum grouping digits, technology preview. |
910 UNUM_NUMERIC_ATTRIBUTE_COUNT = UNUM_LENIENT_PARSE + 3, | 948 * See DecimalFormat::getMinimumGroupingDigits(). |
| 949 * |
| 950 * @internal technology preview |
| 951 */ |
| 952 UNUM_MINIMUM_GROUPING_DIGITS = 22, |
| 953 /* TODO: test C API when it becomes @draft */ |
911 #endif /* U_HIDE_INTERNAL_API */ | 954 #endif /* U_HIDE_INTERNAL_API */ |
912 | 955 |
913 #ifndef U_HIDE_DRAFT_API | |
914 /** | 956 /** |
915 * if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose, | 957 * if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose, |
916 * otherwise it is UNUM_CURRENCY_CASH purpose | 958 * otherwise it is UNUM_CURRENCY_CASH purpose |
917 * Default: 0 (UNUM_CURRENCY_STANDARD purpose) | 959 * Default: 0 (UNUM_CURRENCY_STANDARD purpose) |
918 * @draft ICU 54 | 960 * @stable ICU 54 |
919 */ | 961 */ |
920 UNUM_CURRENCY_USAGE = UNUM_LENIENT_PARSE + 4, | 962 UNUM_CURRENCY_USAGE = 23, |
921 #endif /* U_HIDE_DRAFT_API */ | |
922 | 963 |
923 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file vari
able declararions */ | 964 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file vari
able declararions */ |
924 /** One below the first bitfield-boolean item. | 965 /** One below the first bitfield-boolean item. |
925 * All items after this one are stored in boolean form. | 966 * All items after this one are stored in boolean form. |
926 * @internal */ | 967 * @internal */ |
927 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF, | 968 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF, |
928 | 969 |
929 /** If 1, specifies that if setting the "max integer digits" attribute would t
runcate a value, set an error status rather than silently truncating. | 970 /** If 1, specifies that if setting the "max integer digits" attribute would t
runcate a value, set an error status rather than silently truncating. |
930 * For example, formatting the value 1234 with 4 max int digits would succeed
, but formatting 12345 would fail. There is no effect on parsing. | 971 * For example, formatting the value 1234 with 4 max int digits would succeed
, but formatting 12345 would fail. There is no effect on parsing. |
931 * Default: 0 (not set) | 972 * Default: 0 (not set) |
932 * @stable ICU 50 | 973 * @stable ICU 50 |
933 */ | 974 */ |
934 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000, | 975 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000, |
935 /** | 976 /** |
936 * if this attribute is set to 1, specifies that, if the pattern doesn't conta
in an exponent, the exponent will not be parsed. If the pattern does contain an
exponent, this attribute has no effect. | 977 * if this attribute is set to 1, specifies that, if the pattern doesn't conta
in an exponent, the exponent will not be parsed. If the pattern does contain an
exponent, this attribute has no effect. |
937 * Has no effect on formatting. | 978 * Has no effect on formatting. |
938 * Default: 0 (unset) | 979 * Default: 0 (unset) |
939 * @stable ICU 50 | 980 * @stable ICU 50 |
940 */ | 981 */ |
941 UNUM_PARSE_NO_EXPONENT, | 982 UNUM_PARSE_NO_EXPONENT, |
942 | 983 |
943 #ifndef U_HIDE_DRAFT_API | |
944 /** | 984 /** |
945 * if this attribute is set to 1, specifies that, if the pattern contains a | 985 * if this attribute is set to 1, specifies that, if the pattern contains a |
946 * decimal mark the input is required to have one. If this attribute is set to
0, | 986 * decimal mark the input is required to have one. If this attribute is set to
0, |
947 * specifies that input does not have to contain a decimal mark. | 987 * specifies that input does not have to contain a decimal mark. |
948 * Has no effect on formatting. | 988 * Has no effect on formatting. |
949 * Default: 0 (unset) | 989 * Default: 0 (unset) |
950 * @draft ICU 54 | 990 * @stable ICU 54 |
951 */ | 991 */ |
952 UNUM_PARSE_DECIMAL_MARK_REQUIRED = UNUM_PARSE_NO_EXPONENT+1, | 992 UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002, |
953 #endif /* U_HIDE_DRAFT_API */ | |
954 | 993 |
955 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file vari
able declararions */ | 994 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file vari
able declararions */ |
956 /** Limit of boolean attributes. | 995 /** Limit of boolean attributes. |
957 * @internal */ | 996 * @internal */ |
958 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = UNUM_PARSE_NO_EXPONENT+2 | 997 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003 |
959 } UNumberFormatAttribute; | 998 } UNumberFormatAttribute; |
960 | 999 |
961 /** | 1000 /** |
962 * Get a numeric attribute associated with a UNumberFormat. | 1001 * Get a numeric attribute associated with a UNumberFormat. |
963 * An example of a numeric attribute is the number of integer digits a formatter
will produce. | 1002 * An example of a numeric attribute is the number of integer digits a formatter
will produce. |
964 * @param fmt The formatter to query. | 1003 * @param fmt The formatter to query. |
965 * @param attr The attribute to query; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_
USED, | 1004 * @param attr The attribute to query; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_
USED, |
966 * UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, U
NUM_INTEGER_DIGITS, | 1005 * UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, U
NUM_INTEGER_DIGITS, |
967 * UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM
_MULTIPLIER, | 1006 * UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM
_MULTIPLIER, |
968 * UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITI
ON, UNUM_SECONDARY_GROUPING_SIZE, | 1007 * UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITI
ON, UNUM_SECONDARY_GROUPING_SIZE, |
969 * UNUM_SCALE. | 1008 * UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS. |
970 * @return The value of attr. | 1009 * @return The value of attr. |
971 * @see unum_setAttribute | 1010 * @see unum_setAttribute |
972 * @see unum_getDoubleAttribute | 1011 * @see unum_getDoubleAttribute |
973 * @see unum_setDoubleAttribute | 1012 * @see unum_setDoubleAttribute |
974 * @see unum_getTextAttribute | 1013 * @see unum_getTextAttribute |
975 * @see unum_setTextAttribute | 1014 * @see unum_setTextAttribute |
976 * @stable ICU 2.0 | 1015 * @stable ICU 2.0 |
977 */ | 1016 */ |
978 U_STABLE int32_t U_EXPORT2 | 1017 U_STABLE int32_t U_EXPORT2 |
979 unum_getAttribute(const UNumberFormat* fmt, | 1018 unum_getAttribute(const UNumberFormat* fmt, |
980 UNumberFormatAttribute attr); | 1019 UNumberFormatAttribute attr); |
981 | 1020 |
982 /** | 1021 /** |
983 * Set a numeric attribute associated with a UNumberFormat. | 1022 * Set a numeric attribute associated with a UNumberFormat. |
984 * An example of a numeric attribute is the number of integer digits a formatter
will produce. If the | 1023 * An example of a numeric attribute is the number of integer digits a formatter
will produce. If the |
985 * formatter does not understand the attribute, the call is ignored. Rule-based
formatters only understand | 1024 * formatter does not understand the attribute, the call is ignored. Rule-based
formatters only understand |
986 * the lenient-parse attribute. | 1025 * the lenient-parse attribute. |
987 * @param fmt The formatter to set. | 1026 * @param fmt The formatter to set. |
988 * @param attr The attribute to set; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_US
ED, | 1027 * @param attr The attribute to set; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_US
ED, |
989 * UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, U
NUM_INTEGER_DIGITS, | 1028 * UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, U
NUM_INTEGER_DIGITS, |
990 * UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM
_MULTIPLIER, | 1029 * UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM
_MULTIPLIER, |
991 * UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITI
ON, UNUM_SECONDARY_GROUPING_SIZE, | 1030 * UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITI
ON, UNUM_SECONDARY_GROUPING_SIZE, |
992 * UNUM_LENIENT_PARSE, or UNUM_SCALE. | 1031 * UNUM_LENIENT_PARSE, UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS. |
993 * @param newValue The new value of attr. | 1032 * @param newValue The new value of attr. |
994 * @see unum_getAttribute | 1033 * @see unum_getAttribute |
995 * @see unum_getDoubleAttribute | 1034 * @see unum_getDoubleAttribute |
996 * @see unum_setDoubleAttribute | 1035 * @see unum_setDoubleAttribute |
997 * @see unum_getTextAttribute | 1036 * @see unum_getTextAttribute |
998 * @see unum_setTextAttribute | 1037 * @see unum_setTextAttribute |
999 * @stable ICU 2.0 | 1038 * @stable ICU 2.0 |
1000 */ | 1039 */ |
1001 U_STABLE void U_EXPORT2 | 1040 U_STABLE void U_EXPORT2 |
1002 unum_setAttribute( UNumberFormat* fmt, | 1041 unum_setAttribute( UNumberFormat* fmt, |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 UNUM_SEVEN_DIGIT_SYMBOL = 24, | 1260 UNUM_SEVEN_DIGIT_SYMBOL = 24, |
1222 /** Eight | 1261 /** Eight |
1223 * @stable ICU 4.6 | 1262 * @stable ICU 4.6 |
1224 */ | 1263 */ |
1225 UNUM_EIGHT_DIGIT_SYMBOL = 25, | 1264 UNUM_EIGHT_DIGIT_SYMBOL = 25, |
1226 /** Nine | 1265 /** Nine |
1227 * @stable ICU 4.6 | 1266 * @stable ICU 4.6 |
1228 */ | 1267 */ |
1229 UNUM_NINE_DIGIT_SYMBOL = 26, | 1268 UNUM_NINE_DIGIT_SYMBOL = 26, |
1230 | 1269 |
1231 #ifndef U_HIDE_DRAFT_API | |
1232 /** Multiplication sign | 1270 /** Multiplication sign |
1233 * @draft ICU 54 | 1271 * @stable ICU 54 |
1234 */ | 1272 */ |
1235 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27, | 1273 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27, |
1236 #endif /* U_HIDE_DRAFT_API */ | |
1237 | 1274 |
1238 /** count symbol constants */ | 1275 /** count symbol constants */ |
1239 UNUM_FORMAT_SYMBOL_COUNT = 28 | 1276 UNUM_FORMAT_SYMBOL_COUNT = 28 |
1240 } UNumberFormatSymbol; | 1277 } UNumberFormatSymbol; |
1241 | 1278 |
1242 /** | 1279 /** |
1243 * Get a symbol associated with a UNumberFormat. | 1280 * Get a symbol associated with a UNumberFormat. |
1244 * A UNumberFormat uses symbols to represent the special locale-dependent | 1281 * A UNumberFormat uses symbols to represent the special locale-dependent |
1245 * characters in a number, for example the percent sign. This API is not | 1282 * characters in a number, for example the percent sign. This API is not |
1246 * supported for rule-based formatters. | 1283 * supported for rule-based formatters. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 * @param type type of the locale we're looking for (valid or actual) | 1327 * @param type type of the locale we're looking for (valid or actual) |
1291 * @param status error code for the operation | 1328 * @param status error code for the operation |
1292 * @return the locale name | 1329 * @return the locale name |
1293 * @stable ICU 2.8 | 1330 * @stable ICU 2.8 |
1294 */ | 1331 */ |
1295 U_STABLE const char* U_EXPORT2 | 1332 U_STABLE const char* U_EXPORT2 |
1296 unum_getLocaleByType(const UNumberFormat *fmt, | 1333 unum_getLocaleByType(const UNumberFormat *fmt, |
1297 ULocDataLocaleType type, | 1334 ULocDataLocaleType type, |
1298 UErrorCode* status); | 1335 UErrorCode* status); |
1299 | 1336 |
1300 #ifndef U_HIDE_DRAFT_API | |
1301 /** | 1337 /** |
1302 * Set a particular UDisplayContext value in the formatter, such as | 1338 * Set a particular UDisplayContext value in the formatter, such as |
1303 * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. | 1339 * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. |
1304 * @param fmt The formatter for which to set a UDisplayContext value. | 1340 * @param fmt The formatter for which to set a UDisplayContext value. |
1305 * @param value The UDisplayContext value to set. | 1341 * @param value The UDisplayContext value to set. |
1306 * @param status A pointer to an UErrorCode to receive any errors | 1342 * @param status A pointer to an UErrorCode to receive any errors |
1307 * @draft ICU 53 | 1343 * @stable ICU 53 |
1308 */ | 1344 */ |
1309 U_DRAFT void U_EXPORT2 | 1345 U_STABLE void U_EXPORT2 |
1310 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status); | 1346 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status); |
1311 | 1347 |
1312 /** | 1348 /** |
1313 * Get the formatter's UDisplayContext value for the specified UDisplayContextTy
pe, | 1349 * Get the formatter's UDisplayContext value for the specified UDisplayContextTy
pe, |
1314 * such as UDISPCTX_TYPE_CAPITALIZATION. | 1350 * such as UDISPCTX_TYPE_CAPITALIZATION. |
1315 * @param fmt The formatter to query. | 1351 * @param fmt The formatter to query. |
1316 * @param type The UDisplayContextType whose value to return | 1352 * @param type The UDisplayContextType whose value to return |
1317 * @param status A pointer to an UErrorCode to receive any errors | 1353 * @param status A pointer to an UErrorCode to receive any errors |
1318 * @return The UDisplayContextValue for the specified type. | 1354 * @return The UDisplayContextValue for the specified type. |
1319 * @draft ICU 53 | 1355 * @stable ICU 53 |
1320 */ | 1356 */ |
1321 U_DRAFT UDisplayContext U_EXPORT2 | 1357 U_STABLE UDisplayContext U_EXPORT2 |
1322 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode*
status); | 1358 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode*
status); |
1323 | 1359 |
1324 #endif /* U_HIDE_DRAFT_API */ | |
1325 | |
1326 #endif /* #if !UCONFIG_NO_FORMATTING */ | 1360 #endif /* #if !UCONFIG_NO_FORMATTING */ |
1327 | 1361 |
1328 #endif | 1362 #endif |
OLD | NEW |