ICU 68.2: unum.h Source File

ICU 68.2 68.2

unum.h
Go to the documentation of this file.
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 others.
6 * All Rights Reserved.
7 * Modification History:
8 *
9 * Date Name Description
10 * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes
11 *******************************************************************************
12 */
13
14 #ifndef _UNUM
15 #define _UNUM
16
17 #include "unicode/utypes.h"
18
19 #if !UCONFIG_NO_FORMATTING
20
21 #include "unicode/uloc.h"
22 #include "unicode/ucurr.h"
23 #include "unicode/umisc.h"
24 #include "unicode/parseerr.h"
25 #include "unicode/uformattable.h"
26 #include "unicode/udisplaycontext.h"
27 #include "unicode/ufieldpositer.h"
28
29 #if U_SHOW_CPLUSPLUS_API
30 #include "unicode/localpointer.h"
31 #endif // U_SHOW_CPLUSPLUS_API
32
144 typedef void* UNumberFormat;
145
149 typedef enum UNumberFormatStyle {
154 UNUM_PATTERN_DECIMAL=0,
159 UNUM_DECIMAL=1,
168 UNUM_CURRENCY=2,
173 UNUM_PERCENT=3,
178 UNUM_SCIENTIFIC=4,
185 UNUM_SPELLOUT=5,
192 UNUM_ORDINAL=6,
197 UNUM_DURATION=7,
202 UNUM_NUMBERING_SYSTEM=8,
207 UNUM_PATTERN_RULEBASED=9,
212 UNUM_CURRENCY_ISO=10,
218 UNUM_CURRENCY_PLURAL=11,
225 UNUM_CURRENCY_ACCOUNTING=12,
231 UNUM_CASH_CURRENCY=13,
238 UNUM_DECIMAL_COMPACT_SHORT=14,
245 UNUM_DECIMAL_COMPACT_LONG=15,
252 UNUM_CURRENCY_STANDARD=16,
253
254 #ifndef U_HIDE_DEPRECATED_API
255
259 UNUM_FORMAT_STYLE_COUNT=17,
260 #endif /* U_HIDE_DEPRECATED_API */
261
266 UNUM_DEFAULT = UNUM_DECIMAL,
271 UNUM_IGNORE = UNUM_PATTERN_DECIMAL
272 } UNumberFormatStyle;
273
282 typedef enum UNumberFormatRoundingMode {
283 UNUM_ROUND_CEILING,
284 UNUM_ROUND_FLOOR,
285 UNUM_ROUND_DOWN,
286 UNUM_ROUND_UP,
291 UNUM_ROUND_HALFEVEN,
292 #ifndef U_HIDE_DEPRECATED_API
293
297 UNUM_FOUND_HALFEVEN = UNUM_ROUND_HALFEVEN,
298 #endif /* U_HIDE_DEPRECATED_API */
299 UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
300 UNUM_ROUND_HALFUP,
305 UNUM_ROUND_UNNECESSARY
306 } UNumberFormatRoundingMode;
307
311 typedef enum UNumberFormatPadPosition {
312 UNUM_PAD_BEFORE_PREFIX,
313 UNUM_PAD_AFTER_PREFIX,
314 UNUM_PAD_BEFORE_SUFFIX,
315 UNUM_PAD_AFTER_SUFFIX
316 } UNumberFormatPadPosition;
317
322 typedef enum UNumberCompactStyle {
324 UNUM_SHORT,
326 UNUM_LONG
328 } UNumberCompactStyle;
329
334 enum UCurrencySpacing {
336 UNUM_CURRENCY_MATCH,
338 UNUM_CURRENCY_SURROUNDING_MATCH,
340 UNUM_CURRENCY_INSERT,
341
342 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
343 * it is needed for layout of DecimalFormatSymbols object. */
344 #ifndef U_FORCE_HIDE_DEPRECATED_API
345
349 UNUM_CURRENCY_SPACING_COUNT
350 #endif // U_FORCE_HIDE_DEPRECATED_API
351 };
352 typedef enum UCurrencySpacing UCurrencySpacing;
360 typedef enum UNumberFormatFields {
362 UNUM_INTEGER_FIELD,
364 UNUM_FRACTION_FIELD,
366 UNUM_DECIMAL_SEPARATOR_FIELD,
368 UNUM_EXPONENT_SYMBOL_FIELD,
370 UNUM_EXPONENT_SIGN_FIELD,
372 UNUM_EXPONENT_FIELD,
374 UNUM_GROUPING_SEPARATOR_FIELD,
376 UNUM_CURRENCY_FIELD,
378 UNUM_PERCENT_FIELD,
380 UNUM_PERMILL_FIELD,
382 UNUM_SIGN_FIELD,
384 UNUM_MEASURE_UNIT_FIELD,
386 UNUM_COMPACT_FIELD,
387
388 #ifndef U_HIDE_DEPRECATED_API
389
393 UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 3
394 #endif /* U_HIDE_DEPRECATED_API */
395 } UNumberFormatFields;
396
397
398 #ifndef U_HIDE_DRAFT_API
399
406 typedef enum UNumberFormatMinimumGroupingDigits {
411 UNUM_MINIMUM_GROUPING_DIGITS_AUTO = -2,
418 UNUM_MINIMUM_GROUPING_DIGITS_MIN2 = -3,
419 } UNumberFormatMinimumGroupingDigits;
420 #endif // U_HIDE_DRAFT_API
421
459 U_CAPI UNumberFormat* U_EXPORT2
460 unum_open( UNumberFormatStyle style,
461 const UChar* pattern,
462 int32_t patternLength,
463 const char* locale,
464 UParseError* parseErr,
465 UErrorCode* status);
466
467
474 U_CAPI void U_EXPORT2
475 unum_close(UNumberFormat* fmt);
476
477 #if U_SHOW_CPLUSPLUS_API
478
479 U_NAMESPACE_BEGIN
480
490 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
491
492 U_NAMESPACE_END
493
494 #endif
495
504 U_CAPI UNumberFormat* U_EXPORT2
505 unum_clone(const UNumberFormat *fmt,
506 UErrorCode *status);
507
532 U_CAPI int32_t U_EXPORT2
533 unum_format( const UNumberFormat* fmt,
534 int32_t number,
535 UChar* result,
536 int32_t resultLength,
537 UFieldPosition *pos,
538 UErrorCode* status);
539
564 U_CAPI int32_t U_EXPORT2
565 unum_formatInt64(const UNumberFormat *fmt,
566 int64_t number,
567 UChar* result,
568 int32_t resultLength,
569 UFieldPosition *pos,
570 UErrorCode* status);
571
596 U_CAPI int32_t U_EXPORT2
597 unum_formatDouble( const UNumberFormat* fmt,
598 double number,
599 UChar* result,
600 int32_t resultLength,
601 UFieldPosition *pos, /* 0 if ignore */
602 UErrorCode* status);
603
646 U_CAPI int32_t U_EXPORT2
647 unum_formatDoubleForFields(const UNumberFormat* format,
648 double number,
649 UChar* result,
650 int32_t resultLength,
651 UFieldPositionIterator* fpositer,
652 UErrorCode* status);
653
654
683 U_CAPI int32_t U_EXPORT2
684 unum_formatDecimal( const UNumberFormat* fmt,
685 const char * number,
686 int32_t length,
687 UChar* result,
688 int32_t resultLength,
689 UFieldPosition *pos, /* 0 if ignore */
690 UErrorCode* status);
691
716 U_CAPI int32_t U_EXPORT2
717 unum_formatDoubleCurrency(const UNumberFormat* fmt,
718 double number,
719 UChar* currency,
720 UChar* result,
721 int32_t resultLength,
722 UFieldPosition* pos,
723 UErrorCode* status);
724
745 U_CAPI int32_t U_EXPORT2
746 unum_formatUFormattable(const UNumberFormat* fmt,
747 const UFormattable *number,
748 UChar *result,
749 int32_t resultLength,
750 UFieldPosition *pos,
751 UErrorCode *status);
752
772 U_CAPI int32_t U_EXPORT2
773 unum_parse( const UNumberFormat* fmt,
774 const UChar* text,
775 int32_t textLength,
776 int32_t *parsePos /* 0 = start */,
777 UErrorCode *status);
778
798 U_CAPI int64_t U_EXPORT2
799 unum_parseInt64(const UNumberFormat* fmt,
800 const UChar* text,
801 int32_t textLength,
802 int32_t *parsePos /* 0 = start */,
803 UErrorCode *status);
804
824 U_CAPI double U_EXPORT2
825 unum_parseDouble( const UNumberFormat* fmt,
826 const UChar* text,
827 int32_t textLength,
828 int32_t *parsePos /* 0 = start */,
829 UErrorCode *status);
830
831
859 U_CAPI int32_t U_EXPORT2
860 unum_parseDecimal(const UNumberFormat* fmt,
861 const UChar* text,
862 int32_t textLength,
863 int32_t *parsePos /* 0 = start */,
864 char *outBuf,
865 int32_t outBufLength,
866 UErrorCode *status);
867
887 U_CAPI double U_EXPORT2
888 unum_parseDoubleCurrency(const UNumberFormat* fmt,
889 const UChar* text,
890 int32_t textLength,
891 int32_t* parsePos, /* 0 = start */
892 UChar* currency,
893 UErrorCode* status);
894
915 U_CAPI UFormattable* U_EXPORT2
916 unum_parseToUFormattable(const UNumberFormat* fmt,
917 UFormattable *result,
918 const UChar* text,
919 int32_t textLength,
920 int32_t* parsePos, /* 0 = start */
921 UErrorCode* status);
922
939 U_CAPI void U_EXPORT2
940 unum_applyPattern( UNumberFormat *format,
941 UBool localized,
942 const UChar *pattern,
943 int32_t patternLength,
944 UParseError *parseError,
945 UErrorCode *status
946 );
947
958 U_CAPI const char* U_EXPORT2
959 unum_getAvailable(int32_t localeIndex);
960
970 U_CAPI int32_t U_EXPORT2
971 unum_countAvailable(void);
972
973 #if UCONFIG_HAVE_PARSEALLINPUT
974 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
978 typedef enum UNumberFormatAttributeValue {
979 #ifndef U_HIDE_INTERNAL_API
980
981 UNUM_NO = 0,
983 UNUM_YES = 1,
985 UNUM_MAYBE = 2
986 #else
987
988 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
989 #endif /* U_HIDE_INTERNAL_API */
990 } UNumberFormatAttributeValue;
991 #endif
992
994 typedef enum UNumberFormatAttribute {
996 UNUM_PARSE_INT_ONLY,
998 UNUM_GROUPING_USED,
1000 UNUM_DECIMAL_ALWAYS_SHOWN,
1002 UNUM_MAX_INTEGER_DIGITS,
1004 UNUM_MIN_INTEGER_DIGITS,
1006 UNUM_INTEGER_DIGITS,
1008 UNUM_MAX_FRACTION_DIGITS,
1010 UNUM_MIN_FRACTION_DIGITS,
1012 UNUM_FRACTION_DIGITS,
1014 UNUM_MULTIPLIER,
1016 UNUM_GROUPING_SIZE,
1018 UNUM_ROUNDING_MODE,
1020 UNUM_ROUNDING_INCREMENT,
1022 UNUM_FORMAT_WIDTH,
1024 UNUM_PADDING_POSITION,
1026 UNUM_SECONDARY_GROUPING_SIZE,
1029 UNUM_SIGNIFICANT_DIGITS_USED,
1032 UNUM_MIN_SIGNIFICANT_DIGITS,
1035 UNUM_MAX_SIGNIFICANT_DIGITS,
1039 UNUM_LENIENT_PARSE,
1040 #if UCONFIG_HAVE_PARSEALLINPUT
1041
1045 UNUM_PARSE_ALL_INPUT = 20,
1046 #endif
1047
1058 UNUM_SCALE = 21,
1059
1068 UNUM_MINIMUM_GROUPING_DIGITS = 22,
1069
1076 UNUM_CURRENCY_USAGE = 23,
1077
1078 #ifndef U_HIDE_INTERNAL_API
1079
1082 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
1083 #endif /* U_HIDE_INTERNAL_API */
1084
1090 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
1097 UNUM_PARSE_NO_EXPONENT = 0x1001,
1098
1107 UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
1108
1114 UNUM_PARSE_CASE_SENSITIVE = 0x1003,
1115
1123 UNUM_SIGN_ALWAYS_SHOWN = 0x1004,
1124
1125 #ifndef U_HIDE_INTERNAL_API
1126
1129 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005,
1130 #endif /* U_HIDE_INTERNAL_API */
1131
1132 } UNumberFormatAttribute;
1133
1151 U_CAPI int32_t U_EXPORT2
1152 unum_getAttribute(const UNumberFormat* fmt,
1153 UNumberFormatAttribute attr);
1154
1174 U_CAPI void U_EXPORT2
1175 unum_setAttribute( UNumberFormat* fmt,
1176 UNumberFormatAttribute attr,
1177 int32_t newValue);
1178
1179
1194 U_CAPI double U_EXPORT2
1195 unum_getDoubleAttribute(const UNumberFormat* fmt,
1196 UNumberFormatAttribute attr);
1197
1212 U_CAPI void U_EXPORT2
1213 unum_setDoubleAttribute( UNumberFormat* fmt,
1214 UNumberFormatAttribute attr,
1215 double newValue);
1216
1218 typedef enum UNumberFormatTextAttribute {
1220 UNUM_POSITIVE_PREFIX,
1222 UNUM_POSITIVE_SUFFIX,
1224 UNUM_NEGATIVE_PREFIX,
1226 UNUM_NEGATIVE_SUFFIX,
1228 UNUM_PADDING_CHARACTER,
1230 UNUM_CURRENCY_CODE,
1239 UNUM_DEFAULT_RULESET,
1248 UNUM_PUBLIC_RULESETS
1249 } UNumberFormatTextAttribute;
1250
1269 U_CAPI int32_t U_EXPORT2
1270 unum_getTextAttribute( const UNumberFormat* fmt,
1271 UNumberFormatTextAttribute tag,
1272 UChar* result,
1273 int32_t resultLength,
1274 UErrorCode* status);
1275
1292 U_CAPI void U_EXPORT2
1293 unum_setTextAttribute( UNumberFormat* fmt,
1294 UNumberFormatTextAttribute tag,
1295 const UChar* newValue,
1296 int32_t newValueLength,
1297 UErrorCode *status);
1298
1315 U_CAPI int32_t U_EXPORT2
1316 unum_toPattern( const UNumberFormat* fmt,
1317 UBool isPatternLocalized,
1318 UChar* result,
1319 int32_t resultLength,
1320 UErrorCode* status);
1321
1322
1327 typedef enum UNumberFormatSymbol {
1329 UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
1331 UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
1333 UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
1335 UNUM_PERCENT_SYMBOL = 3,
1337 UNUM_ZERO_DIGIT_SYMBOL = 4,
1339 UNUM_DIGIT_SYMBOL = 5,
1341 UNUM_MINUS_SIGN_SYMBOL = 6,
1343 UNUM_PLUS_SIGN_SYMBOL = 7,
1345 UNUM_CURRENCY_SYMBOL = 8,
1347 UNUM_INTL_CURRENCY_SYMBOL = 9,
1349 UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
1351 UNUM_EXPONENTIAL_SYMBOL = 11,
1353 UNUM_PERMILL_SYMBOL = 12,
1355 UNUM_PAD_ESCAPE_SYMBOL = 13,
1357 UNUM_INFINITY_SYMBOL = 14,
1359 UNUM_NAN_SYMBOL = 15,
1362 UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
1366 UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
1370 UNUM_ONE_DIGIT_SYMBOL = 18,
1374 UNUM_TWO_DIGIT_SYMBOL = 19,
1378 UNUM_THREE_DIGIT_SYMBOL = 20,
1382 UNUM_FOUR_DIGIT_SYMBOL = 21,
1386 UNUM_FIVE_DIGIT_SYMBOL = 22,
1390 UNUM_SIX_DIGIT_SYMBOL = 23,
1394 UNUM_SEVEN_DIGIT_SYMBOL = 24,
1398 UNUM_EIGHT_DIGIT_SYMBOL = 25,
1402 UNUM_NINE_DIGIT_SYMBOL = 26,
1403
1407 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27,
1408
1409 #ifndef U_HIDE_DEPRECATED_API
1410
1414 UNUM_FORMAT_SYMBOL_COUNT = 28
1415 #endif /* U_HIDE_DEPRECATED_API */
1416 } UNumberFormatSymbol;
1417
1434 U_CAPI int32_t U_EXPORT2
1435 unum_getSymbol(const UNumberFormat *fmt,
1436 UNumberFormatSymbol symbol,
1437 UChar *buffer,
1438 int32_t size,
1439 UErrorCode *status);
1440
1454 U_CAPI void U_EXPORT2
1455 unum_setSymbol(UNumberFormat *fmt,
1456 UNumberFormatSymbol symbol,
1457 const UChar *value,
1458 int32_t length,
1459 UErrorCode *status);
1460
1461
1471 U_CAPI const char* U_EXPORT2
1472 unum_getLocaleByType(const UNumberFormat *fmt,
1473 ULocDataLocaleType type,
1474 UErrorCode* status);
1475
1484 U_CAPI void U_EXPORT2
1485 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status);
1486
1496 U_CAPI UDisplayContext U_EXPORT2
1497 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1498
1499 #endif /* #if !UCONFIG_NO_FORMATTING */
1500
1501 #endif
UNUM_INTL_CURRENCY_SYMBOL
@ UNUM_INTL_CURRENCY_SYMBOL
The international currency symbol.
Definition: unum.h:1347
UNUM_MONETARY_SEPARATOR_SYMBOL
@ UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
Definition: unum.h:1349
unum_open
U_CAPI UNumberFormat * unum_open(UNumberFormatStyle style, const UChar *pattern, int32_t patternLength, const char *locale, UParseError *parseErr, UErrorCode *status)
Create and return a new UNumberFormat for formatting and parsing numbers.
UNUM_SIGNIFICANT_DIGIT_SYMBOL
@ UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
Definition: unum.h:1362
unum_getDoubleAttribute
U_CAPI double unum_getDoubleAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Get a numeric attribute associated with a UNumberFormat.
UNUM_CURRENCY_STANDARD
@ UNUM_CURRENCY_STANDARD
Currency format with a currency symbol, e.g., "$1.00", using non-accounting style for negative values...
Definition: unum.h:252
UNUM_SIGN_ALWAYS_SHOWN
@ UNUM_SIGN_ALWAYS_SHOWN
Formatting: if set to 1, whether to show the plus sign on non-negative numbers.
Definition: unum.h:1123
parseerr.h
C API: Parse Error Information.
UNUM_CURRENCY_CODE
@ UNUM_CURRENCY_CODE
The ISO currency code.
Definition: unum.h:1230
UNUM_PLUS_SIGN_SYMBOL
@ UNUM_PLUS_SIGN_SYMBOL
The plus sign.
Definition: unum.h:1343
UNUM_MINIMUM_GROUPING_DIGITS_AUTO
@ UNUM_MINIMUM_GROUPING_DIGITS_AUTO
Display grouping using the default strategy for all locales.
Definition: unum.h:411
UNUM_NAN_SYMBOL
@ UNUM_NAN_SYMBOL
Nan symbol.
Definition: unum.h:1359
UNUM_LONG
@ UNUM_LONG
Definition: unum.h:326
unum_setContext
U_CAPI void unum_setContext(UNumberFormat *fmt, UDisplayContext value, UErrorCode *status)
Set a particular UDisplayContext value in the formatter, such as UDISPCTX_CAPITALIZATION_FOR_STANDALO...
UNUM_DECIMAL_COMPACT_SHORT
@ UNUM_DECIMAL_COMPACT_SHORT
Decimal format expressed using compact notation (short form, corresponds to UNumberCompactStyle=UNUM_...
Definition: unum.h:238
UNUM_INTEGER_FIELD
@ UNUM_INTEGER_FIELD
Definition: unum.h:362
UFormattable
void * UFormattable
Opaque type representing various types of data which may be used for formatting and parsing operation...
Definition: uformattable.h:72
unum_formatDoubleForFields
U_CAPI int32_t unum_formatDoubleForFields(const UNumberFormat *format, double number, UChar *result, int32_t resultLength, UFieldPositionIterator *fpositer, UErrorCode *status)
Format a double using a UNumberFormat according to the UNumberFormat's locale, and initialize a UFiel...
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UNumberFormatFields
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
Definition: unum.h:360
unum_setDoubleAttribute
U_CAPI void unum_setDoubleAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, double newValue)
Set a numeric attribute associated with a UNumberFormat.
LocalUNumberFormatPointer
"Smart pointer" class, closes a UNumberFormat via unum_close().
UNUM_CURRENCY_SPACING_COUNT
@ UNUM_CURRENCY_SPACING_COUNT
One more than the highest normal UCurrencySpacing value.
Definition: unum.h:349
UNUM_CASH_CURRENCY
@ UNUM_CASH_CURRENCY
Currency format with a currency symbol given CASH usage, e.g., "NT$3" instead of "NT$3....
Definition: unum.h:231
UNUM_DEFAULT_RULESET
@ UNUM_DEFAULT_RULESET
The default rule set, such as "%spellout-numbering-year:", "%spellout-cardinal:", "%spellout-ordinal-...
Definition: unum.h:1239
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
@ UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:1129
UNUM_COMPACT_FIELD
@ UNUM_COMPACT_FIELD
Definition: unum.h:386
UNUM_PUBLIC_RULESETS
@ UNUM_PUBLIC_RULESETS
The public rule sets.
Definition: unum.h:1248
UNUM_FRACTION_DIGITS
@ UNUM_FRACTION_DIGITS
Fraction digits.
Definition: unum.h:1012
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
unum_formatDecimal
U_CAPI int32_t unum_formatDecimal(const UNumberFormat *fmt, const char *number, int32_t length, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format a decimal number using a UNumberFormat.
UNUM_SHORT
@ UNUM_SHORT
Definition: unum.h:324
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition: uloc.h:338
UNUM_EXPONENT_SIGN_FIELD
@ UNUM_EXPONENT_SIGN_FIELD
Definition: unum.h:370
unum_setTextAttribute
U_CAPI void unum_setTextAttribute(UNumberFormat *fmt, UNumberFormatTextAttribute tag, const UChar *newValue, int32_t newValueLength, UErrorCode *status)
Set a text attribute associated with a UNumberFormat.
UNUM_DECIMAL_COMPACT_LONG
@ UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
Definition: unum.h:245
UNUM_SPELLOUT
@ UNUM_SPELLOUT
Spellout rule-based format.
Definition: unum.h:185
UNUM_CURRENCY_ISO
@ UNUM_CURRENCY_ISO
Currency format with an ISO currency code, e.g., "USD1.00".
Definition: unum.h:212
UNUM_GROUPING_SIZE
@ UNUM_GROUPING_SIZE
Grouping size.
Definition: unum.h:1016
unum_parseDoubleCurrency
U_CAPI double unum_parseDoubleCurrency(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, UChar *currency, UErrorCode *status)
Parse a string into a double and a currency using a UNumberFormat.
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
@ UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
Definition: unum.h:1366
UNUM_MIN_FRACTION_DIGITS
@ UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
Definition: unum.h:1010
unum_getSymbol
U_CAPI int32_t unum_getSymbol(const UNumberFormat *fmt, UNumberFormatSymbol symbol, UChar *buffer, int32_t size, UErrorCode *status)
Get a symbol associated with a UNumberFormat.
unum_format
U_CAPI int32_t unum_format(const UNumberFormat *fmt, int32_t number, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format an integer using a UNumberFormat.
UNUM_PATTERN_DECIMAL
@ UNUM_PATTERN_DECIMAL
Decimal format defined by a pattern string.
Definition: unum.h:154
UNUM_DIGIT_SYMBOL
@ UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
Definition: unum.h:1339
unum_applyPattern
U_CAPI void unum_applyPattern(UNumberFormat *format, UBool localized, const UChar *pattern, int32_t patternLength, UParseError *parseError, UErrorCode *status)
Set the pattern used by a UNumberFormat.
UNUM_CURRENCY_PLURAL
@ UNUM_CURRENCY_PLURAL
Currency format with a pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars".
Definition: unum.h:218
UNUM_DECIMAL_ALWAYS_SHOWN
@ UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
Definition: unum.h:1000
UNUM_DECIMAL_SEPARATOR_FIELD
@ UNUM_DECIMAL_SEPARATOR_FIELD
Definition: unum.h:366
UNUM_THREE_DIGIT_SYMBOL
@ UNUM_THREE_DIGIT_SYMBOL
Three.
Definition: unum.h:1378
unum_parseDouble
U_CAPI double unum_parseDouble(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a string into a double using a UNumberFormat.
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
UNUM_FRACTION_FIELD
@ UNUM_FRACTION_FIELD
Definition: unum.h:364
unum_close
U_CAPI void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UFieldPositionIterator
struct UFieldPositionIterator UFieldPositionIterator
C typedef for struct UFieldPositionIterator.
Definition: ufieldpositer.h:46
uformattable.h
C API: UFormattable is a thin wrapper for primitive types used for formatting and parsing.
UNUM_CURRENCY_FIELD
@ UNUM_CURRENCY_FIELD
Definition: unum.h:376
umisc.h
C API:misc definitions.
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
UNumberFormatAttribute
UNumberFormatAttribute
The possible UNumberFormat numeric attributes.
Definition: unum.h:994
UNUM_EXPONENTIAL_SYMBOL
@ UNUM_EXPONENTIAL_SYMBOL
The exponential symbol.
Definition: unum.h:1351
UNUM_CURRENCY_SURROUNDING_MATCH
@ UNUM_CURRENCY_SURROUNDING_MATCH
Definition: unum.h:338
UNUM_PERMILL_FIELD
@ UNUM_PERMILL_FIELD
Definition: unum.h:380
UNUM_MEASURE_UNIT_FIELD
@ UNUM_MEASURE_UNIT_FIELD
Definition: unum.h:384
UNUM_FORMAT_WIDTH
@ UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
Definition: unum.h:1022
UNUM_PARSE_NO_EXPONENT
@ UNUM_PARSE_NO_EXPONENT
if this attribute is set to 1, specifies that, if the pattern doesn't contain an exponent,...
Definition: unum.h:1097
unum_setAttribute
U_CAPI void unum_setAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, int32_t newValue)
Set a numeric attribute associated with a UNumberFormat.
unum_parseToUFormattable
U_CAPI UFormattable * unum_parseToUFormattable(const UNumberFormat *fmt, UFormattable *result, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a UChar string into a UFormattable.
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
@ UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition: unum.h:1082
uloc.h
C API: Locale.
UNUM_FORMAT_SYMBOL_COUNT
@ UNUM_FORMAT_SYMBOL_COUNT
One more than the highest normal UNumberFormatSymbol value.
Definition: unum.h:1414
unum_getLocaleByType
U_CAPI const char * unum_getLocaleByType(const UNumberFormat *fmt, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this number format object.
UNUM_PARSE_INT_ONLY
@ UNUM_PARSE_INT_ONLY
Parse integers only.
Definition: unum.h:996
UNUM_EXPONENT_FIELD
@ UNUM_EXPONENT_FIELD
Definition: unum.h:372
UNUM_ROUND_UNNECESSARY
@ UNUM_ROUND_UNNECESSARY
ROUND_UNNECESSARY reports an error if formatted result is not exact.
Definition: unum.h:305
unum_formatDoubleCurrency
U_CAPI int32_t unum_formatDoubleCurrency(const UNumberFormat *fmt, double number, UChar *currency, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format a double currency amount using a UNumberFormat.
UNUM_PARSE_CASE_SENSITIVE
@ UNUM_PARSE_CASE_SENSITIVE
Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
Definition: unum.h:1114
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS
@ UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS
If 1, specifies that if setting the "max integer digits" attribute would truncate a value,...
Definition: unum.h:1090
UNUM_POSITIVE_SUFFIX
@ UNUM_POSITIVE_SUFFIX
Positive suffix.
Definition: unum.h:1222
UNumberFormatMinimumGroupingDigits
UNumberFormatMinimumGroupingDigits
Selectors with special numeric values to use locale default minimum grouping digits for the DecimalFo...
Definition: unum.h:406
UNUM_SECONDARY_GROUPING_SIZE
@ UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
Definition: unum.h:1026
UNUM_GROUPING_SEPARATOR_SYMBOL
@ UNUM_GROUPING_SEPARATOR_SYMBOL
The grouping separator.
Definition: unum.h:1331
UNUM_EIGHT_DIGIT_SYMBOL
@ UNUM_EIGHT_DIGIT_SYMBOL
Eight.
Definition: unum.h:1398
UNUM_INTEGER_DIGITS
@ UNUM_INTEGER_DIGITS
Integer digits.
Definition: unum.h:1006
UNUM_NINE_DIGIT_SYMBOL
@ UNUM_NINE_DIGIT_SYMBOL
Nine.
Definition: unum.h:1402
UNUM_POSITIVE_PREFIX
@ UNUM_POSITIVE_PREFIX
Positive prefix.
Definition: unum.h:1220
UNUM_PATTERN_SEPARATOR_SYMBOL
@ UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
Definition: unum.h:1333
UNUM_LENIENT_PARSE
@ UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
Definition: unum.h:1039
UNUM_MINUS_SIGN_SYMBOL
@ UNUM_MINUS_SIGN_SYMBOL
The minus sign.
Definition: unum.h:1341
unum_formatInt64
U_CAPI int32_t unum_formatInt64(const UNumberFormat *fmt, int64_t number, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format an int64 using a UNumberFormat.
UCurrencySpacing
UCurrencySpacing
Constants for specifying currency spacing.
Definition: unum.h:334
unum_countAvailable
U_CAPI int32_t unum_countAvailable(void)
Determine how many locales have decimal formatting patterns available.
unum_clone
U_CAPI UNumberFormat * unum_clone(const UNumberFormat *fmt, UErrorCode *status)
Open a copy of a UNumberFormat.
unum_parseDecimal
U_CAPI int32_t unum_parseDecimal(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, char *outBuf, int32_t outBufLength, UErrorCode *status)
Parse a number from a string into an unformatted numeric string using a UNumberFormat.
unum_formatUFormattable
U_CAPI int32_t unum_formatUFormattable(const UNumberFormat *fmt, const UFormattable *number, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format a UFormattable into a string.
UNUM_FOUR_DIGIT_SYMBOL
@ UNUM_FOUR_DIGIT_SYMBOL
Four.
Definition: unum.h:1382
UNUM_PADDING_POSITION
@ UNUM_PADDING_POSITION
The position at which padding will take place.
Definition: unum.h:1024
UNUM_PADDING_CHARACTER
@ UNUM_PADDING_CHARACTER
The character used to pad to the format width.
Definition: unum.h:1228
UNUM_FOUND_HALFEVEN
@ UNUM_FOUND_HALFEVEN
Half-even rounding, misspelled name.
Definition: unum.h:297
UNUM_PARSE_DECIMAL_MARK_REQUIRED
@ UNUM_PARSE_DECIMAL_MARK_REQUIRED
if this attribute is set to 1, specifies that, if the pattern contains a decimal mark the input is re...
Definition: unum.h:1107
UNUM_EXPONENT_MULTIPLICATION_SYMBOL
@ UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
Definition: unum.h:1407
UNUM_MIN_SIGNIFICANT_DIGITS
@ UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
Definition: unum.h:1032
UNUM_ROUNDING_MODE
@ UNUM_ROUNDING_MODE
Rounding Mode.
Definition: unum.h:1018
ufieldpositer.h
C API: UFieldPositionIterator for use with format APIs.
unum_getContext
U_CAPI UDisplayContext unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode *status)
Get the formatter's UDisplayContext value for the specified UDisplayContextType, such as UDISPCTX_TYP...
UNUM_DECIMAL_SEPARATOR_SYMBOL
@ UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
Definition: unum.h:1329
unum_parseInt64
U_CAPI int64_t unum_parseInt64(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a string into an int64 using a UNumberFormat.
UNumberFormatStyle
UNumberFormatStyle
The possible number format styles.
Definition: unum.h:149
UNUM_INFINITY_SYMBOL
@ UNUM_INFINITY_SYMBOL
Infinity symbol.
Definition: unum.h:1357
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
UNUM_SEVEN_DIGIT_SYMBOL
@ UNUM_SEVEN_DIGIT_SYMBOL
Seven.
Definition: unum.h:1394
UNUM_SIGNIFICANT_DIGITS_USED
@ UNUM_SIGNIFICANT_DIGITS_USED
Use significant digits.
Definition: unum.h:1029
UNUM_MAX_SIGNIFICANT_DIGITS
@ UNUM_MAX_SIGNIFICANT_DIGITS
Maximum significant digits.
Definition: unum.h:1035
unum_setSymbol
U_CAPI void unum_setSymbol(UNumberFormat *fmt, UNumberFormatSymbol symbol, const UChar *value, int32_t length, UErrorCode *status)
Set a symbol associated with a UNumberFormat.
ucurr.h
C API: Encapsulates information about a currency.
UNUM_PERCENT
@ UNUM_PERCENT
Percent format.
Definition: unum.h:173
unum_getAttribute
U_CAPI int32_t unum_getAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Get a numeric attribute associated with a UNumberFormat.
UNUM_GROUPING_SEPARATOR_FIELD
@ UNUM_GROUPING_SEPARATOR_FIELD
Definition: unum.h:374
UNUM_ROUND_HALFEVEN
@ UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition: unum.h:291
UNUM_NEGATIVE_SUFFIX
@ UNUM_NEGATIVE_SUFFIX
Negative suffix.
Definition: unum.h:1226
UNUM_FIELD_COUNT
@ UNUM_FIELD_COUNT
One more than the highest normal UNumberFormatFields value.
Definition: unum.h:393
UNumberFormatSymbol
UNumberFormatSymbol
Constants for specifying a number format symbol.
Definition: unum.h:1327
UNUM_CURRENCY_MATCH
@ UNUM_CURRENCY_MATCH
Definition: unum.h:336
UNUM_PERCENT_SYMBOL
@ UNUM_PERCENT_SYMBOL
The percent sign.
Definition: unum.h:1335
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
unum_getTextAttribute
U_CAPI int32_t unum_getTextAttribute(const UNumberFormat *fmt, UNumberFormatTextAttribute tag, UChar *result, int32_t resultLength, UErrorCode *status)
Get a text attribute associated with a UNumberFormat.
UNUM_MAX_INTEGER_DIGITS
@ UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
Definition: unum.h:1002
UNUM_CURRENCY_USAGE
@ UNUM_CURRENCY_USAGE
if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose, otherwise it is UNUM_CURR...
Definition: unum.h:1076
UNUM_CURRENCY_SYMBOL
@ UNUM_CURRENCY_SYMBOL
The currency symbol.
Definition: unum.h:1345
UNUM_IGNORE
@ UNUM_IGNORE
Alias for UNUM_PATTERN_DECIMAL.
Definition: unum.h:271
UNUM_ZERO_DIGIT_SYMBOL
@ UNUM_ZERO_DIGIT_SYMBOL
Zero.
Definition: unum.h:1337
UNUM_DURATION
@ UNUM_DURATION
Duration rule-based format.
Definition: unum.h:197
UNumberFormatRoundingMode
UNumberFormatRoundingMode
The possible number format rounding modes.
Definition: unum.h:282
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
unum_parse
U_CAPI int32_t unum_parse(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a string into an integer using a UNumberFormat.
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:144
UNUM_CURRENCY_INSERT
@ UNUM_CURRENCY_INSERT
Definition: unum.h:340
UNUM_SCIENTIFIC
@ UNUM_SCIENTIFIC
Scientific format.
Definition: unum.h:178
UNUM_SCALE
@ UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
Definition: unum.h:1058
UNumberFormatTextAttribute
UNumberFormatTextAttribute
The possible UNumberFormat text attributes.
Definition: unum.h:1218
UNUM_MINIMUM_GROUPING_DIGITS_MIN2
@ UNUM_MINIMUM_GROUPING_DIGITS_MIN2
Display grouping using locale defaults, except do not show grouping on values smaller than 10000 (suc...
Definition: unum.h:418
UNUM_SIGN_FIELD
@ UNUM_SIGN_FIELD
Definition: unum.h:382
UNUM_NEGATIVE_PREFIX
@ UNUM_NEGATIVE_PREFIX
Negative prefix.
Definition: unum.h:1224
UNUM_MAX_FRACTION_DIGITS
@ UNUM_MAX_FRACTION_DIGITS
Maximum fraction digits.
Definition: unum.h:1008
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:418
UNUM_MIN_INTEGER_DIGITS
@ UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
Definition: unum.h:1004
UNUM_ONE_DIGIT_SYMBOL
@ UNUM_ONE_DIGIT_SYMBOL
One.
Definition: unum.h:1370
udisplaycontext.h
C API: Display context types (enum values)
UNUM_DEFAULT
@ UNUM_DEFAULT
Default format.
Definition: unum.h:266
unum_formatDouble
U_CAPI int32_t unum_formatDouble(const UNumberFormat *fmt, double number, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format a double using a UNumberFormat.
unum_getAvailable
U_CAPI const char * unum_getAvailable(int32_t localeIndex)
Get a locale for which decimal formatting patterns are available.
UNUM_SIX_DIGIT_SYMBOL
@ UNUM_SIX_DIGIT_SYMBOL
Six.
Definition: unum.h:1390
UNUM_PERCENT_FIELD
@ UNUM_PERCENT_FIELD
Definition: unum.h:378
UNUM_PERMILL_SYMBOL
@ UNUM_PERMILL_SYMBOL
Per mill symbol.
Definition: unum.h:1353
UNUM_CURRENCY
@ UNUM_CURRENCY
Currency format (generic).
Definition: unum.h:168
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UNUM_GROUPING_USED
@ UNUM_GROUPING_USED
Use grouping separator.
Definition: unum.h:998
UNUM_MINIMUM_GROUPING_DIGITS
@ UNUM_MINIMUM_GROUPING_DIGITS
Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
Definition: unum.h:1068
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:311
UNUM_FORMAT_STYLE_COUNT
@ UNUM_FORMAT_STYLE_COUNT
One more than the highest normal UNumberFormatStyle value.
Definition: unum.h:259
UNUM_CURRENCY_ACCOUNTING
@ UNUM_CURRENCY_ACCOUNTING
Currency format for accounting, e.g., "($3.00)" for negative currency amount instead of "-$3....
Definition: unum.h:225
UNUM_NUMBERING_SYSTEM
@ UNUM_NUMBERING_SYSTEM
Numbering system rule-based format.
Definition: unum.h:202
UNUM_MULTIPLIER
@ UNUM_MULTIPLIER
Multiplier.
Definition: unum.h:1014
UNUM_PATTERN_RULEBASED
@ UNUM_PATTERN_RULEBASED
Rule-based format defined by a pattern string.
Definition: unum.h:207
UNUM_PAD_ESCAPE_SYMBOL
@ UNUM_PAD_ESCAPE_SYMBOL
Escape padding character.
Definition: unum.h:1355
UNUM_ROUNDING_INCREMENT
@ UNUM_ROUNDING_INCREMENT
Rounding increment.
Definition: unum.h:1020
UNUM_EXPONENT_SYMBOL_FIELD
@ UNUM_EXPONENT_SYMBOL_FIELD
Definition: unum.h:368
UNUM_ORDINAL
@ UNUM_ORDINAL
Ordinal rule-based format .
Definition: unum.h:192
UNUM_FIVE_DIGIT_SYMBOL
@ UNUM_FIVE_DIGIT_SYMBOL
Five.
Definition: unum.h:1386
UNUM_TWO_DIGIT_SYMBOL
@ UNUM_TWO_DIGIT_SYMBOL
Two.
Definition: unum.h:1374
unum_toPattern
U_CAPI int32_t unum_toPattern(const UNumberFormat *fmt, UBool isPatternLocalized, UChar *result, int32_t resultLength, UErrorCode *status)
Extract the pattern from a UNumberFormat.
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:322
UNUM_DECIMAL
@ UNUM_DECIMAL
Decimal format ("normal" style).
Definition: unum.h:159