ICU 74.1 74.1

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 #include "unicode/unumberoptions.h"
29
30 #if U_SHOW_CPLUSPLUS_API
31 #include "unicode/localpointer.h"
32 #endif // U_SHOW_CPLUSPLUS_API
33
145 typedef void* UNumberFormat;
146
150 typedef enum UNumberFormatStyle {
155 UNUM_PATTERN_DECIMAL=0,
160 UNUM_DECIMAL=1,
169 UNUM_CURRENCY=2,
174 UNUM_PERCENT=3,
179 UNUM_SCIENTIFIC=4,
186 UNUM_SPELLOUT=5,
193 UNUM_ORDINAL=6,
198 UNUM_DURATION=7,
203 UNUM_NUMBERING_SYSTEM=8,
208 UNUM_PATTERN_RULEBASED=9,
213 UNUM_CURRENCY_ISO=10,
219 UNUM_CURRENCY_PLURAL=11,
226 UNUM_CURRENCY_ACCOUNTING=12,
232 UNUM_CASH_CURRENCY=13,
239 UNUM_DECIMAL_COMPACT_SHORT=14,
246 UNUM_DECIMAL_COMPACT_LONG=15,
253 UNUM_CURRENCY_STANDARD=16,
254
255 #ifndef U_HIDE_DEPRECATED_API
260 UNUM_FORMAT_STYLE_COUNT=17,
261 #endif /* U_HIDE_DEPRECATED_API */
262
267 UNUM_DEFAULT = UNUM_DECIMAL,
272 UNUM_IGNORE = UNUM_PATTERN_DECIMAL
273 } UNumberFormatStyle;
274
278 typedef enum UNumberFormatPadPosition {
279 UNUM_PAD_BEFORE_PREFIX,
280 UNUM_PAD_AFTER_PREFIX,
281 UNUM_PAD_BEFORE_SUFFIX,
282 UNUM_PAD_AFTER_SUFFIX
283 } UNumberFormatPadPosition;
284
289 typedef enum UNumberCompactStyle {
291 UNUM_SHORT,
293 UNUM_LONG
295 } UNumberCompactStyle;
296
301 enum UCurrencySpacing {
303 UNUM_CURRENCY_MATCH,
305 UNUM_CURRENCY_SURROUNDING_MATCH,
307 UNUM_CURRENCY_INSERT,
308
309 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
310 * it is needed for layout of DecimalFormatSymbols object. */
311 #ifndef U_FORCE_HIDE_DEPRECATED_API
316 UNUM_CURRENCY_SPACING_COUNT
317 #endif // U_FORCE_HIDE_DEPRECATED_API
318 };
319 typedef enum UCurrencySpacing UCurrencySpacing;
327 typedef enum UNumberFormatFields {
329 UNUM_INTEGER_FIELD,
331 UNUM_FRACTION_FIELD,
333 UNUM_DECIMAL_SEPARATOR_FIELD,
335 UNUM_EXPONENT_SYMBOL_FIELD,
337 UNUM_EXPONENT_SIGN_FIELD,
339 UNUM_EXPONENT_FIELD,
341 UNUM_GROUPING_SEPARATOR_FIELD,
343 UNUM_CURRENCY_FIELD,
345 UNUM_PERCENT_FIELD,
347 UNUM_PERMILL_FIELD,
349 UNUM_SIGN_FIELD,
351 UNUM_MEASURE_UNIT_FIELD,
353 UNUM_COMPACT_FIELD,
358 UNUM_APPROXIMATELY_SIGN_FIELD,
359
360 #ifndef U_HIDE_DEPRECATED_API
365 UNUM_FIELD_COUNT
366 #endif /* U_HIDE_DEPRECATED_API */
367 } UNumberFormatFields;
368
369
377 typedef enum UNumberFormatMinimumGroupingDigits {
382 UNUM_MINIMUM_GROUPING_DIGITS_AUTO = -2,
389 UNUM_MINIMUM_GROUPING_DIGITS_MIN2 = -3,
390 } UNumberFormatMinimumGroupingDigits;
391
429 U_CAPI UNumberFormat* U_EXPORT2
430 unum_open( UNumberFormatStyle style,
431 const UChar* pattern,
432 int32_t patternLength,
433 const char* locale,
434 UParseError* parseErr,
435 UErrorCode* status);
436
437
444 U_CAPI void U_EXPORT2
445 unum_close(UNumberFormat* fmt);
446
447 #if U_SHOW_CPLUSPLUS_API
448
449 U_NAMESPACE_BEGIN
450
460 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
461
462 U_NAMESPACE_END
463
464 #endif
465
474 U_CAPI UNumberFormat* U_EXPORT2
475 unum_clone(const UNumberFormat *fmt,
476 UErrorCode *status);
477
502 U_CAPI int32_t U_EXPORT2
503 unum_format( const UNumberFormat* fmt,
504 int32_t number,
505 UChar* result,
506 int32_t resultLength,
507 UFieldPosition *pos,
508 UErrorCode* status);
509
534 U_CAPI int32_t U_EXPORT2
535 unum_formatInt64(const UNumberFormat *fmt,
536 int64_t number,
537 UChar* result,
538 int32_t resultLength,
539 UFieldPosition *pos,
540 UErrorCode* status);
541
566 U_CAPI int32_t U_EXPORT2
567 unum_formatDouble( const UNumberFormat* fmt,
568 double number,
569 UChar* result,
570 int32_t resultLength,
571 UFieldPosition *pos, /* 0 if ignore */
572 UErrorCode* status);
573
616 U_CAPI int32_t U_EXPORT2
617 unum_formatDoubleForFields(const UNumberFormat* format,
618 double number,
619 UChar* result,
620 int32_t resultLength,
621 UFieldPositionIterator* fpositer,
622 UErrorCode* status);
623
624
653 U_CAPI int32_t U_EXPORT2
654 unum_formatDecimal( const UNumberFormat* fmt,
655 const char * number,
656 int32_t length,
657 UChar* result,
658 int32_t resultLength,
659 UFieldPosition *pos, /* 0 if ignore */
660 UErrorCode* status);
661
692 U_CAPI int32_t U_EXPORT2
693 unum_formatDoubleCurrency(const UNumberFormat* fmt,
694 double number,
695 UChar* currency,
696 UChar* result,
697 int32_t resultLength,
698 UFieldPosition* pos,
699 UErrorCode* status);
700
721 U_CAPI int32_t U_EXPORT2
722 unum_formatUFormattable(const UNumberFormat* fmt,
723 const UFormattable *number,
724 UChar *result,
725 int32_t resultLength,
726 UFieldPosition *pos,
727 UErrorCode *status);
728
748 U_CAPI int32_t U_EXPORT2
749 unum_parse( const UNumberFormat* fmt,
750 const UChar* text,
751 int32_t textLength,
752 int32_t *parsePos /* 0 = start */,
753 UErrorCode *status);
754
774 U_CAPI int64_t U_EXPORT2
775 unum_parseInt64(const UNumberFormat* fmt,
776 const UChar* text,
777 int32_t textLength,
778 int32_t *parsePos /* 0 = start */,
779 UErrorCode *status);
780
800 U_CAPI double U_EXPORT2
801 unum_parseDouble( const UNumberFormat* fmt,
802 const UChar* text,
803 int32_t textLength,
804 int32_t *parsePos /* 0 = start */,
805 UErrorCode *status);
806
807
835 U_CAPI int32_t U_EXPORT2
836 unum_parseDecimal(const UNumberFormat* fmt,
837 const UChar* text,
838 int32_t textLength,
839 int32_t *parsePos /* 0 = start */,
840 char *outBuf,
841 int32_t outBufLength,
842 UErrorCode *status);
843
863 U_CAPI double U_EXPORT2
864 unum_parseDoubleCurrency(const UNumberFormat* fmt,
865 const UChar* text,
866 int32_t textLength,
867 int32_t* parsePos, /* 0 = start */
868 UChar* currency,
869 UErrorCode* status);
870
891 U_CAPI UFormattable* U_EXPORT2
892 unum_parseToUFormattable(const UNumberFormat* fmt,
893 UFormattable *result,
894 const UChar* text,
895 int32_t textLength,
896 int32_t* parsePos, /* 0 = start */
897 UErrorCode* status);
898
915 U_CAPI void U_EXPORT2
916 unum_applyPattern( UNumberFormat *format,
917 UBool localized,
918 const UChar *pattern,
919 int32_t patternLength,
920 UParseError *parseError,
921 UErrorCode *status
922 );
923
934 U_CAPI const char* U_EXPORT2
935 unum_getAvailable(int32_t localeIndex);
936
946 U_CAPI int32_t U_EXPORT2
947 unum_countAvailable(void);
948
949 #if UCONFIG_HAVE_PARSEALLINPUT
950 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
954 typedef enum UNumberFormatAttributeValue {
955 #ifndef U_HIDE_INTERNAL_API
957 UNUM_NO = 0,
959 UNUM_YES = 1,
961 UNUM_MAYBE = 2
962 #else
964 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
965 #endif /* U_HIDE_INTERNAL_API */
966 } UNumberFormatAttributeValue;
967 #endif
968
970 typedef enum UNumberFormatAttribute {
972 UNUM_PARSE_INT_ONLY,
974 UNUM_GROUPING_USED,
976 UNUM_DECIMAL_ALWAYS_SHOWN,
978 UNUM_MAX_INTEGER_DIGITS,
980 UNUM_MIN_INTEGER_DIGITS,
982 UNUM_INTEGER_DIGITS,
984 UNUM_MAX_FRACTION_DIGITS,
986 UNUM_MIN_FRACTION_DIGITS,
988 UNUM_FRACTION_DIGITS,
990 UNUM_MULTIPLIER,
992 UNUM_GROUPING_SIZE,
994 UNUM_ROUNDING_MODE,
996 UNUM_ROUNDING_INCREMENT,
998 UNUM_FORMAT_WIDTH,
1000 UNUM_PADDING_POSITION,
1002 UNUM_SECONDARY_GROUPING_SIZE,
1005 UNUM_SIGNIFICANT_DIGITS_USED,
1008 UNUM_MIN_SIGNIFICANT_DIGITS,
1011 UNUM_MAX_SIGNIFICANT_DIGITS,
1015 UNUM_LENIENT_PARSE,
1016 #if UCONFIG_HAVE_PARSEALLINPUT
1021 UNUM_PARSE_ALL_INPUT = 20,
1022 #endif
1034 UNUM_SCALE = 21,
1035
1044 UNUM_MINIMUM_GROUPING_DIGITS = 22,
1045
1052 UNUM_CURRENCY_USAGE = 23,
1053
1054 #ifndef U_HIDE_INTERNAL_API
1058 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
1059 #endif /* U_HIDE_INTERNAL_API */
1060
1066 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
1073 UNUM_PARSE_NO_EXPONENT = 0x1001,
1074
1083 UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
1084
1090 UNUM_PARSE_CASE_SENSITIVE = 0x1003,
1091
1099 UNUM_SIGN_ALWAYS_SHOWN = 0x1004,
1100
1101 #ifndef U_HIDE_INTERNAL_API
1105 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005,
1106 #endif /* U_HIDE_INTERNAL_API */
1107
1108 } UNumberFormatAttribute;
1109
1124 U_CAPI bool U_EXPORT2
1125 unum_hasAttribute(const UNumberFormat* fmt,
1126 UNumberFormatAttribute attr);
1127
1145 U_CAPI int32_t U_EXPORT2
1146 unum_getAttribute(const UNumberFormat* fmt,
1147 UNumberFormatAttribute attr);
1148
1169 U_CAPI void U_EXPORT2
1170 unum_setAttribute( UNumberFormat* fmt,
1171 UNumberFormatAttribute attr,
1172 int32_t newValue);
1173
1174
1191 U_CAPI double U_EXPORT2
1192 unum_getDoubleAttribute(const UNumberFormat* fmt,
1193 UNumberFormatAttribute attr);
1194
1211 U_CAPI void U_EXPORT2
1212 unum_setDoubleAttribute( UNumberFormat* fmt,
1213 UNumberFormatAttribute attr,
1214 double newValue);
1215
1217 typedef enum UNumberFormatTextAttribute {
1219 UNUM_POSITIVE_PREFIX,
1221 UNUM_POSITIVE_SUFFIX,
1223 UNUM_NEGATIVE_PREFIX,
1225 UNUM_NEGATIVE_SUFFIX,
1227 UNUM_PADDING_CHARACTER,
1229 UNUM_CURRENCY_CODE,
1238 UNUM_DEFAULT_RULESET,
1247 UNUM_PUBLIC_RULESETS
1248 } UNumberFormatTextAttribute;
1249
1268 U_CAPI int32_t U_EXPORT2
1269 unum_getTextAttribute( const UNumberFormat* fmt,
1270 UNumberFormatTextAttribute tag,
1271 UChar* result,
1272 int32_t resultLength,
1273 UErrorCode* status);
1274
1291 U_CAPI void U_EXPORT2
1292 unum_setTextAttribute( UNumberFormat* fmt,
1293 UNumberFormatTextAttribute tag,
1294 const UChar* newValue,
1295 int32_t newValueLength,
1296 UErrorCode *status);
1297
1314 U_CAPI int32_t U_EXPORT2
1315 unum_toPattern( const UNumberFormat* fmt,
1316 UBool isPatternLocalized,
1317 UChar* result,
1318 int32_t resultLength,
1319 UErrorCode* status);
1320
1321
1326 typedef enum UNumberFormatSymbol {
1328 UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
1330 UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
1332 UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
1334 UNUM_PERCENT_SYMBOL = 3,
1336 UNUM_ZERO_DIGIT_SYMBOL = 4,
1338 UNUM_DIGIT_SYMBOL = 5,
1340 UNUM_MINUS_SIGN_SYMBOL = 6,
1342 UNUM_PLUS_SIGN_SYMBOL = 7,
1344 UNUM_CURRENCY_SYMBOL = 8,
1346 UNUM_INTL_CURRENCY_SYMBOL = 9,
1348 UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
1350 UNUM_EXPONENTIAL_SYMBOL = 11,
1352 UNUM_PERMILL_SYMBOL = 12,
1354 UNUM_PAD_ESCAPE_SYMBOL = 13,
1356 UNUM_INFINITY_SYMBOL = 14,
1358 UNUM_NAN_SYMBOL = 15,
1361 UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
1365 UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
1369 UNUM_ONE_DIGIT_SYMBOL = 18,
1373 UNUM_TWO_DIGIT_SYMBOL = 19,
1377 UNUM_THREE_DIGIT_SYMBOL = 20,
1381 UNUM_FOUR_DIGIT_SYMBOL = 21,
1385 UNUM_FIVE_DIGIT_SYMBOL = 22,
1389 UNUM_SIX_DIGIT_SYMBOL = 23,
1393 UNUM_SEVEN_DIGIT_SYMBOL = 24,
1397 UNUM_EIGHT_DIGIT_SYMBOL = 25,
1401 UNUM_NINE_DIGIT_SYMBOL = 26,
1402
1406 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27,
1407
1408 #ifndef U_HIDE_INTERNAL_API
1412 UNUM_APPROXIMATELY_SIGN_SYMBOL = 28,
1413 #endif
1414
1415 #ifndef U_HIDE_DEPRECATED_API
1420 UNUM_FORMAT_SYMBOL_COUNT = 29
1421 #endif /* U_HIDE_DEPRECATED_API */
1422 } UNumberFormatSymbol;
1423
1440 U_CAPI int32_t U_EXPORT2
1441 unum_getSymbol(const UNumberFormat *fmt,
1442 UNumberFormatSymbol symbol,
1443 UChar *buffer,
1444 int32_t size,
1445 UErrorCode *status);
1446
1460 U_CAPI void U_EXPORT2
1461 unum_setSymbol(UNumberFormat *fmt,
1462 UNumberFormatSymbol symbol,
1463 const UChar *value,
1464 int32_t length,
1465 UErrorCode *status);
1466
1467
1477 U_CAPI const char* U_EXPORT2
1478 unum_getLocaleByType(const UNumberFormat *fmt,
1479 ULocDataLocaleType type,
1480 UErrorCode* status);
1481
1490 U_CAPI void U_EXPORT2
1491 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status);
1492
1502 U_CAPI UDisplayContext U_EXPORT2
1503 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1504
1505 #endif /* #if !UCONFIG_NO_FORMATTING */
1506
1507 #endif
LocalUNumberFormatPointer
"Smart pointer" class, closes a UNumberFormat via unum_close().
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
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
parseerr.h
C API: Parse Error Information.
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
ucurr.h
C API: Encapsulates information about a currency.
udisplaycontext.h
C API: Display context types (enum values)
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
ufieldpositer.h
C API: UFieldPositionIterator for use with format APIs.
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.
UFormattable
void * UFormattable
Opaque type representing various types of data which may be used for formatting and parsing operation...
Definition: uformattable.h:72
uloc.h
C API: Locale ID functionality similar to C++ class Locale.
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition: uloc.h:338
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:386
umisc.h
C API: Miscellaneous definitions.
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_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_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_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_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.
UNumberFormatAttribute
UNumberFormatAttribute
The possible UNumberFormat numeric attributes.
Definition: unum.h:970
UNUM_GROUPING_SIZE
@ UNUM_GROUPING_SIZE
Grouping size.
Definition: unum.h:992
UNUM_LENIENT_PARSE
@ UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
Definition: unum.h:1015
UNUM_MIN_SIGNIFICANT_DIGITS
@ UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
Definition: unum.h:1008
UNUM_MAX_INTEGER_DIGITS
@ UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
Definition: unum.h:978
UNUM_MAX_FRACTION_DIGITS
@ UNUM_MAX_FRACTION_DIGITS
Maximum fraction digits.
Definition: unum.h:984
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:1073
UNUM_FORMAT_WIDTH
@ UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
Definition: unum.h:998
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
@ UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:1105
UNUM_PARSE_INT_ONLY
@ UNUM_PARSE_INT_ONLY
Parse integers only.
Definition: unum.h:972
UNUM_MULTIPLIER
@ UNUM_MULTIPLIER
Multiplier.
Definition: unum.h:990
UNUM_ROUNDING_INCREMENT
@ UNUM_ROUNDING_INCREMENT
Rounding increment.
Definition: unum.h:996
UNUM_PARSE_CASE_SENSITIVE
@ UNUM_PARSE_CASE_SENSITIVE
Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
Definition: unum.h:1090
UNUM_SIGNIFICANT_DIGITS_USED
@ UNUM_SIGNIFICANT_DIGITS_USED
Use significant digits.
Definition: unum.h:1005
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:1044
UNUM_SECONDARY_GROUPING_SIZE
@ UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
Definition: unum.h:1002
UNUM_MIN_FRACTION_DIGITS
@ UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
Definition: unum.h:986
UNUM_DECIMAL_ALWAYS_SHOWN
@ UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
Definition: unum.h:976
UNUM_MAX_SIGNIFICANT_DIGITS
@ UNUM_MAX_SIGNIFICANT_DIGITS
Maximum significant digits.
Definition: unum.h:1011
UNUM_INTEGER_DIGITS
@ UNUM_INTEGER_DIGITS
Integer digits.
Definition: unum.h:982
UNUM_FRACTION_DIGITS
@ UNUM_FRACTION_DIGITS
Fraction digits.
Definition: unum.h:988
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:1083
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:1099
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:1066
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_CASH...
Definition: unum.h:1052
UNUM_ROUNDING_MODE
@ UNUM_ROUNDING_MODE
Rounding Mode.
Definition: unum.h:994
UNUM_SCALE
@ UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
Definition: unum.h:1034
UNUM_PADDING_POSITION
@ UNUM_PADDING_POSITION
The position at which padding will take place.
Definition: unum.h:1000
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
@ UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition: unum.h:1058
UNUM_MIN_INTEGER_DIGITS
@ UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
Definition: unum.h:980
UNUM_GROUPING_USED
@ UNUM_GROUPING_USED
Use grouping separator.
Definition: unum.h:974
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.
UCurrencySpacing
UCurrencySpacing
Constants for specifying currency spacing.
Definition: unum.h:301
UNUM_CURRENCY_SPACING_COUNT
@ UNUM_CURRENCY_SPACING_COUNT
One more than the highest normal UCurrencySpacing value.
Definition: unum.h:316
UNUM_CURRENCY_SURROUNDING_MATCH
@ UNUM_CURRENCY_SURROUNDING_MATCH
Definition: unum.h:305
UNUM_CURRENCY_MATCH
@ UNUM_CURRENCY_MATCH
Definition: unum.h:303
UNUM_CURRENCY_INSERT
@ UNUM_CURRENCY_INSERT
Definition: unum.h:307
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...
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.
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.
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.
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:289
UNUM_LONG
@ UNUM_LONG
Definition: unum.h:293
UNUM_SHORT
@ UNUM_SHORT
Definition: unum.h:291
unum_hasAttribute
U_CAPI bool unum_hasAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Returns true if the formatter supports the specified attribute and false if not.
UNumberFormatStyle
UNumberFormatStyle
The possible number format styles.
Definition: unum.h:150
UNUM_CURRENCY
@ UNUM_CURRENCY
Currency format (generic).
Definition: unum.h:169
UNUM_SCIENTIFIC
@ UNUM_SCIENTIFIC
Scientific format.
Definition: unum.h:179
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:219
UNUM_PATTERN_RULEBASED
@ UNUM_PATTERN_RULEBASED
Rule-based format defined by a pattern string.
Definition: unum.h:208
UNUM_SPELLOUT
@ UNUM_SPELLOUT
Spellout rule-based format.
Definition: unum.h:186
UNUM_DECIMAL_COMPACT_SHORT
@ UNUM_DECIMAL_COMPACT_SHORT
Decimal format expressed using compact notation (short form, corresponds to UNumberCompactStyle=UNUM_...
Definition: unum.h:239
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:232
UNUM_DECIMAL_COMPACT_LONG
@ UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
Definition: unum.h:246
UNUM_FORMAT_STYLE_COUNT
@ UNUM_FORMAT_STYLE_COUNT
One more than the highest normal UNumberFormatStyle value.
Definition: unum.h:260
UNUM_PERCENT
@ UNUM_PERCENT
Percent format.
Definition: unum.h:174
UNUM_ORDINAL
@ UNUM_ORDINAL
Ordinal rule-based format .
Definition: unum.h:193
UNUM_CURRENCY_ISO
@ UNUM_CURRENCY_ISO
Currency format with an ISO currency code, e.g., "USD1.00".
Definition: unum.h:213
UNUM_NUMBERING_SYSTEM
@ UNUM_NUMBERING_SYSTEM
Numbering system rule-based format.
Definition: unum.h:203
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:253
UNUM_DEFAULT
@ UNUM_DEFAULT
Default format.
Definition: unum.h:267
UNUM_PATTERN_DECIMAL
@ UNUM_PATTERN_DECIMAL
Decimal format defined by a pattern string.
Definition: unum.h:155
UNUM_DURATION
@ UNUM_DURATION
Duration rule-based format.
Definition: unum.h:198
UNUM_CURRENCY_ACCOUNTING
@ UNUM_CURRENCY_ACCOUNTING
Currency format for accounting, e.g., "($3.00)" for negative currency amount instead of "-$3....
Definition: unum.h:226
UNUM_IGNORE
@ UNUM_IGNORE
Alias for UNUM_PATTERN_DECIMAL.
Definition: unum.h:272
UNUM_DECIMAL
@ UNUM_DECIMAL
Decimal format ("normal" style).
Definition: unum.h:160
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.
unum_getDoubleAttribute
U_CAPI double unum_getDoubleAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Get a numeric attribute associated with a UNumberFormat.
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_countAvailable
U_CAPI int32_t unum_countAvailable(void)
Determine how many locales have decimal formatting patterns available.
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.
UNumberFormatSymbol
UNumberFormatSymbol
Constants for specifying a number format symbol.
Definition: unum.h:1326
UNUM_FOUR_DIGIT_SYMBOL
@ UNUM_FOUR_DIGIT_SYMBOL
Four.
Definition: unum.h:1381
UNUM_PERMILL_SYMBOL
@ UNUM_PERMILL_SYMBOL
Per mill symbol.
Definition: unum.h:1352
UNUM_SIGNIFICANT_DIGIT_SYMBOL
@ UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
Definition: unum.h:1361
UNUM_PAD_ESCAPE_SYMBOL
@ UNUM_PAD_ESCAPE_SYMBOL
Escape padding character.
Definition: unum.h:1354
UNUM_INFINITY_SYMBOL
@ UNUM_INFINITY_SYMBOL
Infinity symbol.
Definition: unum.h:1356
UNUM_TWO_DIGIT_SYMBOL
@ UNUM_TWO_DIGIT_SYMBOL
Two.
Definition: unum.h:1373
UNUM_EXPONENTIAL_SYMBOL
@ UNUM_EXPONENTIAL_SYMBOL
The exponential symbol.
Definition: unum.h:1350
UNUM_CURRENCY_SYMBOL
@ UNUM_CURRENCY_SYMBOL
The currency symbol.
Definition: unum.h:1344
UNUM_INTL_CURRENCY_SYMBOL
@ UNUM_INTL_CURRENCY_SYMBOL
The international currency symbol.
Definition: unum.h:1346
UNUM_FIVE_DIGIT_SYMBOL
@ UNUM_FIVE_DIGIT_SYMBOL
Five.
Definition: unum.h:1385
UNUM_EXPONENT_MULTIPLICATION_SYMBOL
@ UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
Definition: unum.h:1406
UNUM_EIGHT_DIGIT_SYMBOL
@ UNUM_EIGHT_DIGIT_SYMBOL
Eight.
Definition: unum.h:1397
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
@ UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
Definition: unum.h:1365
UNUM_PERCENT_SYMBOL
@ UNUM_PERCENT_SYMBOL
The percent sign.
Definition: unum.h:1334
UNUM_PATTERN_SEPARATOR_SYMBOL
@ UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
Definition: unum.h:1332
UNUM_DECIMAL_SEPARATOR_SYMBOL
@ UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
Definition: unum.h:1328
UNUM_PLUS_SIGN_SYMBOL
@ UNUM_PLUS_SIGN_SYMBOL
The plus sign.
Definition: unum.h:1342
UNUM_GROUPING_SEPARATOR_SYMBOL
@ UNUM_GROUPING_SEPARATOR_SYMBOL
The grouping separator.
Definition: unum.h:1330
UNUM_NAN_SYMBOL
@ UNUM_NAN_SYMBOL
Nan symbol.
Definition: unum.h:1358
UNUM_SIX_DIGIT_SYMBOL
@ UNUM_SIX_DIGIT_SYMBOL
Six.
Definition: unum.h:1389
UNUM_NINE_DIGIT_SYMBOL
@ UNUM_NINE_DIGIT_SYMBOL
Nine.
Definition: unum.h:1401
UNUM_APPROXIMATELY_SIGN_SYMBOL
@ UNUM_APPROXIMATELY_SIGN_SYMBOL
Approximately sign.
Definition: unum.h:1412
UNUM_MINUS_SIGN_SYMBOL
@ UNUM_MINUS_SIGN_SYMBOL
The minus sign.
Definition: unum.h:1340
UNUM_MONETARY_SEPARATOR_SYMBOL
@ UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
Definition: unum.h:1348
UNUM_DIGIT_SYMBOL
@ UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
Definition: unum.h:1338
UNUM_THREE_DIGIT_SYMBOL
@ UNUM_THREE_DIGIT_SYMBOL
Three.
Definition: unum.h:1377
UNUM_ZERO_DIGIT_SYMBOL
@ UNUM_ZERO_DIGIT_SYMBOL
Zero.
Definition: unum.h:1336
UNUM_ONE_DIGIT_SYMBOL
@ UNUM_ONE_DIGIT_SYMBOL
One.
Definition: unum.h:1369
UNUM_FORMAT_SYMBOL_COUNT
@ UNUM_FORMAT_SYMBOL_COUNT
One more than the highest normal UNumberFormatSymbol value.
Definition: unum.h:1420
UNUM_SEVEN_DIGIT_SYMBOL
@ UNUM_SEVEN_DIGIT_SYMBOL
Seven.
Definition: unum.h:1393
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.
UNumberFormatMinimumGroupingDigits
UNumberFormatMinimumGroupingDigits
Selectors with special numeric values to use locale default minimum grouping digits for the DecimalFo...
Definition: unum.h:377
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:389
UNUM_MINIMUM_GROUPING_DIGITS_AUTO
@ UNUM_MINIMUM_GROUPING_DIGITS_AUTO
Display grouping using the default strategy for all locales.
Definition: unum.h:382
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_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_getAttribute
U_CAPI int32_t unum_getAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Get a numeric attribute associated with a UNumberFormat.
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.
UNumberFormatTextAttribute
UNumberFormatTextAttribute
The possible UNumberFormat text attributes.
Definition: unum.h:1217
UNUM_NEGATIVE_PREFIX
@ UNUM_NEGATIVE_PREFIX
Negative prefix.
Definition: unum.h:1223
UNUM_POSITIVE_PREFIX
@ UNUM_POSITIVE_PREFIX
Positive prefix.
Definition: unum.h:1219
UNUM_DEFAULT_RULESET
@ UNUM_DEFAULT_RULESET
The default rule set, such as "%spellout-numbering-year:", "%spellout-cardinal:", "%spellout-ordinal-...
Definition: unum.h:1238
UNUM_PUBLIC_RULESETS
@ UNUM_PUBLIC_RULESETS
The public rule sets.
Definition: unum.h:1247
UNUM_PADDING_CHARACTER
@ UNUM_PADDING_CHARACTER
The character used to pad to the format width.
Definition: unum.h:1227
UNUM_CURRENCY_CODE
@ UNUM_CURRENCY_CODE
The ISO currency code.
Definition: unum.h:1229
UNUM_NEGATIVE_SUFFIX
@ UNUM_NEGATIVE_SUFFIX
Negative suffix.
Definition: unum.h:1225
UNUM_POSITIVE_SUFFIX
@ UNUM_POSITIVE_SUFFIX
Positive suffix.
Definition: unum.h:1221
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_setDoubleAttribute
U_CAPI void unum_setDoubleAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, double newValue)
Set a numeric attribute associated with a UNumberFormat.
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:145
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_setAttribute
U_CAPI void unum_setAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, int32_t newValue)
Set a numeric attribute associated with a UNumberFormat.
unum_getLocaleByType
U_CAPI const char * unum_getLocaleByType(const UNumberFormat *fmt, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this number format object.
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:278
unum_close
U_CAPI void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UNumberFormatFields
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
Definition: unum.h:327
UNUM_MEASURE_UNIT_FIELD
@ UNUM_MEASURE_UNIT_FIELD
Definition: unum.h:351
UNUM_COMPACT_FIELD
@ UNUM_COMPACT_FIELD
Definition: unum.h:353
UNUM_INTEGER_FIELD
@ UNUM_INTEGER_FIELD
Definition: unum.h:329
UNUM_PERCENT_FIELD
@ UNUM_PERCENT_FIELD
Definition: unum.h:345
UNUM_PERMILL_FIELD
@ UNUM_PERMILL_FIELD
Definition: unum.h:347
UNUM_EXPONENT_SYMBOL_FIELD
@ UNUM_EXPONENT_SYMBOL_FIELD
Definition: unum.h:335
UNUM_GROUPING_SEPARATOR_FIELD
@ UNUM_GROUPING_SEPARATOR_FIELD
Definition: unum.h:341
UNUM_DECIMAL_SEPARATOR_FIELD
@ UNUM_DECIMAL_SEPARATOR_FIELD
Definition: unum.h:333
UNUM_APPROXIMATELY_SIGN_FIELD
@ UNUM_APPROXIMATELY_SIGN_FIELD
Approximately sign.
Definition: unum.h:358
UNUM_SIGN_FIELD
@ UNUM_SIGN_FIELD
Definition: unum.h:349
UNUM_CURRENCY_FIELD
@ UNUM_CURRENCY_FIELD
Definition: unum.h:343
UNUM_FRACTION_FIELD
@ UNUM_FRACTION_FIELD
Definition: unum.h:331
UNUM_FIELD_COUNT
@ UNUM_FIELD_COUNT
One more than the highest normal UNumberFormatFields value.
Definition: unum.h:365
UNUM_EXPONENT_SIGN_FIELD
@ UNUM_EXPONENT_SIGN_FIELD
Definition: unum.h:337
UNUM_EXPONENT_FIELD
@ UNUM_EXPONENT_FIELD
Definition: unum.h:339
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.
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_getAvailable
U_CAPI const char * unum_getAvailable(int32_t localeIndex)
Get a locale for which decimal formatting patterns are available.
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_clone
U_CAPI UNumberFormat * unum_clone(const UNumberFormat *fmt, UErrorCode *status)
Open a copy of a UNumberFormat.
unumberoptions.h
C API: Header-only input options for various number formatting APIs.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415