ICU 67.1 67.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/localpointer.h"
22 #include "unicode/uloc.h"
23 #include "unicode/ucurr.h"
24 #include "unicode/umisc.h"
25 #include "unicode/parseerr.h"
26 #include "unicode/uformattable.h"
27 #include "unicode/udisplaycontext.h"
28 #include "unicode/ufieldpositer.h"
29
141 typedef void* UNumberFormat;
142
146 typedef enum UNumberFormatStyle {
151 UNUM_PATTERN_DECIMAL=0,
156 UNUM_DECIMAL=1,
165 UNUM_CURRENCY=2,
170 UNUM_PERCENT=3,
175 UNUM_SCIENTIFIC=4,
182 UNUM_SPELLOUT=5,
189 UNUM_ORDINAL=6,
194 UNUM_DURATION=7,
199 UNUM_NUMBERING_SYSTEM=8,
204 UNUM_PATTERN_RULEBASED=9,
209 UNUM_CURRENCY_ISO=10,
215 UNUM_CURRENCY_PLURAL=11,
222 UNUM_CURRENCY_ACCOUNTING=12,
228 UNUM_CASH_CURRENCY=13,
235 UNUM_DECIMAL_COMPACT_SHORT=14,
242 UNUM_DECIMAL_COMPACT_LONG=15,
249 UNUM_CURRENCY_STANDARD=16,
250
251 #ifndef U_HIDE_DEPRECATED_API
252
256 UNUM_FORMAT_STYLE_COUNT=17,
257 #endif /* U_HIDE_DEPRECATED_API */
258
263 UNUM_DEFAULT = UNUM_DECIMAL,
268 UNUM_IGNORE = UNUM_PATTERN_DECIMAL
269 } UNumberFormatStyle;
270
279 typedef enum UNumberFormatRoundingMode {
280 UNUM_ROUND_CEILING,
281 UNUM_ROUND_FLOOR,
282 UNUM_ROUND_DOWN,
283 UNUM_ROUND_UP,
288 UNUM_ROUND_HALFEVEN,
289 #ifndef U_HIDE_DEPRECATED_API
290
294 UNUM_FOUND_HALFEVEN = UNUM_ROUND_HALFEVEN,
295 #endif /* U_HIDE_DEPRECATED_API */
296 UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
297 UNUM_ROUND_HALFUP,
302 UNUM_ROUND_UNNECESSARY
303 } UNumberFormatRoundingMode;
304
308 typedef enum UNumberFormatPadPosition {
309 UNUM_PAD_BEFORE_PREFIX,
310 UNUM_PAD_AFTER_PREFIX,
311 UNUM_PAD_BEFORE_SUFFIX,
312 UNUM_PAD_AFTER_SUFFIX
313 } UNumberFormatPadPosition;
314
319 typedef enum UNumberCompactStyle {
321 UNUM_SHORT,
323 UNUM_LONG
325 } UNumberCompactStyle;
326
331 enum UCurrencySpacing {
333 UNUM_CURRENCY_MATCH,
335 UNUM_CURRENCY_SURROUNDING_MATCH,
337 UNUM_CURRENCY_INSERT,
338
339 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
340 * it is needed for layout of DecimalFormatSymbols object. */
341 #ifndef U_FORCE_HIDE_DEPRECATED_API
342
346 UNUM_CURRENCY_SPACING_COUNT
347 #endif // U_FORCE_HIDE_DEPRECATED_API
348 };
349 typedef enum UCurrencySpacing UCurrencySpacing;
357 typedef enum UNumberFormatFields {
359 UNUM_INTEGER_FIELD,
361 UNUM_FRACTION_FIELD,
363 UNUM_DECIMAL_SEPARATOR_FIELD,
365 UNUM_EXPONENT_SYMBOL_FIELD,
367 UNUM_EXPONENT_SIGN_FIELD,
369 UNUM_EXPONENT_FIELD,
371 UNUM_GROUPING_SEPARATOR_FIELD,
373 UNUM_CURRENCY_FIELD,
375 UNUM_PERCENT_FIELD,
377 UNUM_PERMILL_FIELD,
379 UNUM_SIGN_FIELD,
381 UNUM_MEASURE_UNIT_FIELD,
383 UNUM_COMPACT_FIELD,
384
385 #ifndef U_HIDE_DEPRECATED_API
386
390 UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 3
391 #endif /* U_HIDE_DEPRECATED_API */
392 } UNumberFormatFields;
393
394
432 U_STABLE UNumberFormat* U_EXPORT2
433 unum_open( UNumberFormatStyle style,
434 const UChar* pattern,
435 int32_t patternLength,
436 const char* locale,
437 UParseError* parseErr,
438 UErrorCode* status);
439
440
447 U_STABLE void U_EXPORT2
448 unum_close(UNumberFormat* fmt);
449
450 #if U_SHOW_CPLUSPLUS_API
451
452 U_NAMESPACE_BEGIN
453
463 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
464
465 U_NAMESPACE_END
466
467 #endif
468
477 U_STABLE UNumberFormat* U_EXPORT2
478 unum_clone(const UNumberFormat *fmt,
479 UErrorCode *status);
480
505 U_STABLE int32_t U_EXPORT2
506 unum_format( const UNumberFormat* fmt,
507 int32_t number,
508 UChar* result,
509 int32_t resultLength,
510 UFieldPosition *pos,
511 UErrorCode* status);
512
537 U_STABLE int32_t U_EXPORT2
538 unum_formatInt64(const UNumberFormat *fmt,
539 int64_t number,
540 UChar* result,
541 int32_t resultLength,
542 UFieldPosition *pos,
543 UErrorCode* status);
544
569 U_STABLE int32_t U_EXPORT2
570 unum_formatDouble( const UNumberFormat* fmt,
571 double number,
572 UChar* result,
573 int32_t resultLength,
574 UFieldPosition *pos, /* 0 if ignore */
575 UErrorCode* status);
576
619 U_STABLE int32_t U_EXPORT2
620 unum_formatDoubleForFields(const UNumberFormat* format,
621 double number,
622 UChar* result,
623 int32_t resultLength,
624 UFieldPositionIterator* fpositer,
625 UErrorCode* status);
626
627
656 U_STABLE int32_t U_EXPORT2
657 unum_formatDecimal( const UNumberFormat* fmt,
658 const char * number,
659 int32_t length,
660 UChar* result,
661 int32_t resultLength,
662 UFieldPosition *pos, /* 0 if ignore */
663 UErrorCode* status);
664
689 U_STABLE int32_t U_EXPORT2
690 unum_formatDoubleCurrency(const UNumberFormat* fmt,
691 double number,
692 UChar* currency,
693 UChar* result,
694 int32_t resultLength,
695 UFieldPosition* pos,
696 UErrorCode* status);
697
718 U_STABLE int32_t U_EXPORT2
719 unum_formatUFormattable(const UNumberFormat* fmt,
720 const UFormattable *number,
721 UChar *result,
722 int32_t resultLength,
723 UFieldPosition *pos,
724 UErrorCode *status);
725
745 U_STABLE int32_t U_EXPORT2
746 unum_parse( const UNumberFormat* fmt,
747 const UChar* text,
748 int32_t textLength,
749 int32_t *parsePos /* 0 = start */,
750 UErrorCode *status);
751
771 U_STABLE int64_t U_EXPORT2
772 unum_parseInt64(const UNumberFormat* fmt,
773 const UChar* text,
774 int32_t textLength,
775 int32_t *parsePos /* 0 = start */,
776 UErrorCode *status);
777
797 U_STABLE double U_EXPORT2
798 unum_parseDouble( const UNumberFormat* fmt,
799 const UChar* text,
800 int32_t textLength,
801 int32_t *parsePos /* 0 = start */,
802 UErrorCode *status);
803
804
832 U_STABLE int32_t U_EXPORT2
833 unum_parseDecimal(const UNumberFormat* fmt,
834 const UChar* text,
835 int32_t textLength,
836 int32_t *parsePos /* 0 = start */,
837 char *outBuf,
838 int32_t outBufLength,
839 UErrorCode *status);
840
860 U_STABLE double U_EXPORT2
861 unum_parseDoubleCurrency(const UNumberFormat* fmt,
862 const UChar* text,
863 int32_t textLength,
864 int32_t* parsePos, /* 0 = start */
865 UChar* currency,
866 UErrorCode* status);
867
888 U_STABLE UFormattable* U_EXPORT2
889 unum_parseToUFormattable(const UNumberFormat* fmt,
890 UFormattable *result,
891 const UChar* text,
892 int32_t textLength,
893 int32_t* parsePos, /* 0 = start */
894 UErrorCode* status);
895
912 U_STABLE void U_EXPORT2
913 unum_applyPattern( UNumberFormat *format,
914 UBool localized,
915 const UChar *pattern,
916 int32_t patternLength,
917 UParseError *parseError,
918 UErrorCode *status
919 );
920
931 U_STABLE const char* U_EXPORT2
932 unum_getAvailable(int32_t localeIndex);
933
943 U_STABLE int32_t U_EXPORT2
944 unum_countAvailable(void);
945
946 #if UCONFIG_HAVE_PARSEALLINPUT
947 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
951 typedef enum UNumberFormatAttributeValue {
952 #ifndef U_HIDE_INTERNAL_API
953
954 UNUM_NO = 0,
956 UNUM_YES = 1,
958 UNUM_MAYBE = 2
959 #else
960
961 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
962 #endif /* U_HIDE_INTERNAL_API */
963 } UNumberFormatAttributeValue;
964 #endif
965
967 typedef enum UNumberFormatAttribute {
969 UNUM_PARSE_INT_ONLY,
971 UNUM_GROUPING_USED,
973 UNUM_DECIMAL_ALWAYS_SHOWN,
975 UNUM_MAX_INTEGER_DIGITS,
977 UNUM_MIN_INTEGER_DIGITS,
979 UNUM_INTEGER_DIGITS,
981 UNUM_MAX_FRACTION_DIGITS,
983 UNUM_MIN_FRACTION_DIGITS,
985 UNUM_FRACTION_DIGITS,
987 UNUM_MULTIPLIER,
989 UNUM_GROUPING_SIZE,
991 UNUM_ROUNDING_MODE,
993 UNUM_ROUNDING_INCREMENT,
995 UNUM_FORMAT_WIDTH,
997 UNUM_PADDING_POSITION,
999 UNUM_SECONDARY_GROUPING_SIZE,
1002 UNUM_SIGNIFICANT_DIGITS_USED,
1005 UNUM_MIN_SIGNIFICANT_DIGITS,
1008 UNUM_MAX_SIGNIFICANT_DIGITS,
1012 UNUM_LENIENT_PARSE,
1013 #if UCONFIG_HAVE_PARSEALLINPUT
1014
1018 UNUM_PARSE_ALL_INPUT = 20,
1019 #endif
1020
1031 UNUM_SCALE = 21,
1032
1041 UNUM_MINIMUM_GROUPING_DIGITS = 22,
1042
1049 UNUM_CURRENCY_USAGE = 23,
1050
1051 #ifndef U_HIDE_INTERNAL_API
1052
1055 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
1056 #endif /* U_HIDE_INTERNAL_API */
1057
1063 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
1070 UNUM_PARSE_NO_EXPONENT = 0x1001,
1071
1080 UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
1081
1087 UNUM_PARSE_CASE_SENSITIVE = 0x1003,
1088
1096 UNUM_SIGN_ALWAYS_SHOWN = 0x1004,
1097
1098 #ifndef U_HIDE_INTERNAL_API
1099
1102 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005,
1103 #endif /* U_HIDE_INTERNAL_API */
1104
1105 } UNumberFormatAttribute;
1106
1124 U_STABLE int32_t U_EXPORT2
1125 unum_getAttribute(const UNumberFormat* fmt,
1126 UNumberFormatAttribute attr);
1127
1147 U_STABLE void U_EXPORT2
1148 unum_setAttribute( UNumberFormat* fmt,
1149 UNumberFormatAttribute attr,
1150 int32_t newValue);
1151
1152
1167 U_STABLE double U_EXPORT2
1168 unum_getDoubleAttribute(const UNumberFormat* fmt,
1169 UNumberFormatAttribute attr);
1170
1185 U_STABLE void U_EXPORT2
1186 unum_setDoubleAttribute( UNumberFormat* fmt,
1187 UNumberFormatAttribute attr,
1188 double newValue);
1189
1191 typedef enum UNumberFormatTextAttribute {
1193 UNUM_POSITIVE_PREFIX,
1195 UNUM_POSITIVE_SUFFIX,
1197 UNUM_NEGATIVE_PREFIX,
1199 UNUM_NEGATIVE_SUFFIX,
1201 UNUM_PADDING_CHARACTER,
1203 UNUM_CURRENCY_CODE,
1212 UNUM_DEFAULT_RULESET,
1221 UNUM_PUBLIC_RULESETS
1222 } UNumberFormatTextAttribute;
1223
1242 U_STABLE int32_t U_EXPORT2
1243 unum_getTextAttribute( const UNumberFormat* fmt,
1244 UNumberFormatTextAttribute tag,
1245 UChar* result,
1246 int32_t resultLength,
1247 UErrorCode* status);
1248
1265 U_STABLE void U_EXPORT2
1266 unum_setTextAttribute( UNumberFormat* fmt,
1267 UNumberFormatTextAttribute tag,
1268 const UChar* newValue,
1269 int32_t newValueLength,
1270 UErrorCode *status);
1271
1288 U_STABLE int32_t U_EXPORT2
1289 unum_toPattern( const UNumberFormat* fmt,
1290 UBool isPatternLocalized,
1291 UChar* result,
1292 int32_t resultLength,
1293 UErrorCode* status);
1294
1295
1300 typedef enum UNumberFormatSymbol {
1302 UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
1304 UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
1306 UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
1308 UNUM_PERCENT_SYMBOL = 3,
1310 UNUM_ZERO_DIGIT_SYMBOL = 4,
1312 UNUM_DIGIT_SYMBOL = 5,
1314 UNUM_MINUS_SIGN_SYMBOL = 6,
1316 UNUM_PLUS_SIGN_SYMBOL = 7,
1318 UNUM_CURRENCY_SYMBOL = 8,
1320 UNUM_INTL_CURRENCY_SYMBOL = 9,
1322 UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
1324 UNUM_EXPONENTIAL_SYMBOL = 11,
1326 UNUM_PERMILL_SYMBOL = 12,
1328 UNUM_PAD_ESCAPE_SYMBOL = 13,
1330 UNUM_INFINITY_SYMBOL = 14,
1332 UNUM_NAN_SYMBOL = 15,
1335 UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
1339 UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
1343 UNUM_ONE_DIGIT_SYMBOL = 18,
1347 UNUM_TWO_DIGIT_SYMBOL = 19,
1351 UNUM_THREE_DIGIT_SYMBOL = 20,
1355 UNUM_FOUR_DIGIT_SYMBOL = 21,
1359 UNUM_FIVE_DIGIT_SYMBOL = 22,
1363 UNUM_SIX_DIGIT_SYMBOL = 23,
1367 UNUM_SEVEN_DIGIT_SYMBOL = 24,
1371 UNUM_EIGHT_DIGIT_SYMBOL = 25,
1375 UNUM_NINE_DIGIT_SYMBOL = 26,
1376
1380 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27,
1381
1382 #ifndef U_HIDE_DEPRECATED_API
1383
1387 UNUM_FORMAT_SYMBOL_COUNT = 28
1388 #endif /* U_HIDE_DEPRECATED_API */
1389 } UNumberFormatSymbol;
1390
1407 U_STABLE int32_t U_EXPORT2
1408 unum_getSymbol(const UNumberFormat *fmt,
1409 UNumberFormatSymbol symbol,
1410 UChar *buffer,
1411 int32_t size,
1412 UErrorCode *status);
1413
1427 U_STABLE void U_EXPORT2
1428 unum_setSymbol(UNumberFormat *fmt,
1429 UNumberFormatSymbol symbol,
1430 const UChar *value,
1431 int32_t length,
1432 UErrorCode *status);
1433
1434
1444 U_STABLE const char* U_EXPORT2
1445 unum_getLocaleByType(const UNumberFormat *fmt,
1446 ULocDataLocaleType type,
1447 UErrorCode* status);
1448
1457 U_STABLE void U_EXPORT2
1458 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status);
1459
1469 U_STABLE UDisplayContext U_EXPORT2
1470 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1471
1472 #endif /* #if !UCONFIG_NO_FORMATTING */
1473
1474 #endif
UNUM_SHORT
Definition: unum.h:321
UNUM_DEFAULT
Default format.
Definition: unum.h:263
unum_setDoubleAttribute
void unum_setDoubleAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, double newValue)
Set a numeric attribute associated with a UNumberFormat.
UNUM_SIX_DIGIT_SYMBOL
Six.
Definition: unum.h:1363
uformattable.h
C API: UFormattable is a thin wrapper for primitive types used for formatting and parsing...
unum_setSymbol
void unum_setSymbol(UNumberFormat *fmt, UNumberFormatSymbol symbol, const UChar *value, int32_t length, UErrorCode *status)
Set a symbol associated with a UNumberFormat.
UNumberFormatRoundingMode
UNumberFormatRoundingMode
The possible number format rounding modes.
Definition: unum.h:279
unum_getDoubleAttribute
double unum_getDoubleAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Get a numeric attribute associated with a UNumberFormat.
UNUM_EXPONENTIAL_SYMBOL
The exponential symbol.
Definition: unum.h:1324
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
Definition: unum.h:1339
UNUM_FORMAT_STYLE_COUNT
One more than the highest normal UNumberFormatStyle value.
Definition: unum.h:256
UNUM_PERMILL_FIELD
Definition: unum.h:377
UNUM_NEGATIVE_PREFIX
Negative prefix.
Definition: unum.h:1197
unum_setContext
void unum_setContext(UNumberFormat *fmt, UDisplayContext value, UErrorCode *status)
Set a particular UDisplayContext value in the formatter, such as UDISPCTX_CAPITALIZATION_FOR_STANDALO...
UNUM_NUMBERING_SYSTEM
Numbering system rule-based format.
Definition: unum.h:199
unum_getAvailable
const char * unum_getAvailable(int32_t localeIndex)
Get a locale for which decimal formatting patterns are available.
UNUM_CURRENCY
Currency format (generic).
Definition: unum.h:165
UNUM_DECIMAL
Decimal format ("normal" style).
Definition: unum.h:156
unum_applyPattern
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_EIGHT_DIGIT_SYMBOL
Eight.
Definition: unum.h:1371
UNUM_MEASURE_UNIT_FIELD
Definition: unum.h:381
UNUM_PARSE_NO_EXPONENT
if this attribute is set to 1, specifies that, if the pattern doesn&#39;t contain an exponent, the exponent will not be parsed.
Definition: unum.h:1070
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
Definition: unum.h:1335
UNUM_NINE_DIGIT_SYMBOL
Nine.
Definition: unum.h:1375
UNUM_CURRENCY_STANDARD
Currency format with a currency symbol, e.g., "$1.00", using non-accounting style for negative values...
Definition: unum.h:249
unum_parseDecimal
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_PATTERN_RULEBASED
Rule-based format defined by a pattern string.
Definition: unum.h:204
UNUM_SIGN_ALWAYS_SHOWN
Formatting: if set to 1, whether to show the plus sign on non-negative numbers.
Definition: unum.h:1096
UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
Definition: unum.h:1012
UNUM_EXPONENT_FIELD
Definition: unum.h:369
UNUM_EXPONENT_SYMBOL_FIELD
Definition: unum.h:365
UNUM_FIVE_DIGIT_SYMBOL
Five.
Definition: unum.h:1359
UNUM_DECIMAL_COMPACT_SHORT
Decimal format expressed using compact notation (short form, corresponds to UNumberCompactStyle=UNUM_...
Definition: unum.h:235
UNUM_INTEGER_FIELD
Definition: unum.h:359
UCurrencySpacing
UCurrencySpacing
Constants for specifying currency spacing.
Definition: unum.h:331
unum_parseDoubleCurrency
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.
umisc.h
C API:misc definitions.
UNUM_ROUND_UNNECESSARY
ROUND_UNNECESSARY reports an error if formatted result is not exact.
Definition: unum.h:302
UFieldPositionIterator
struct UFieldPositionIterator UFieldPositionIterator
C typedef for struct UFieldPositionIterator.
Definition: ufieldpositer.h:44
unum_formatInt64
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_format
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_GROUPING_SEPARATOR_SYMBOL
The grouping separator.
Definition: unum.h:1304
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:1102
UNUM_INTEGER_DIGITS
Integer digits.
Definition: unum.h:979
UNUM_COMPACT_FIELD
Definition: unum.h:383
UNUM_FRACTION_DIGITS
Fraction digits.
Definition: unum.h:985
UNumberFormatSymbol
UNumberFormatSymbol
Constants for specifying a number format symbol.
Definition: unum.h:1300
UNUM_FOUND_HALFEVEN
Half-even rounding, misspelled name.
Definition: unum.h:294
UNUM_POSITIVE_PREFIX
Positive prefix.
Definition: unum.h:1193
UNUM_CURRENCY_CODE
The ISO currency code.
Definition: unum.h:1203
UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
Definition: unum.h:1380
udisplaycontext.h
C API: Display context types (enum values)
UNUM_MINUS_SIGN_SYMBOL
The minus sign.
Definition: unum.h:1314
UNUM_NAN_SYMBOL
Nan symbol.
Definition: unum.h:1332
UNUM_LONG
Definition: unum.h:323
UNUM_CURRENCY_ISO
Currency format with an ISO currency code, e.g., "USD1.00".
Definition: unum.h:209
unum_formatUFormattable
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_CASH_CURRENCY
Currency format with a currency symbol given CASH usage, e.g., "NT$3" instead of "NT$3.23".
Definition: unum.h:228
unum_parseInt64
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.
UNUM_PATTERN_DECIMAL
Decimal format defined by a pattern string.
Definition: unum.h:151
UNUM_SIGNIFICANT_DIGITS_USED
Use significant digits.
Definition: unum.h:1002
UNUM_PERCENT
Percent format.
Definition: unum.h:170
UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition: unum.h:288
UNUM_DECIMAL_SEPARATOR_FIELD
Definition: unum.h:363
UNUM_PADDING_POSITION
The position at which padding will take place.
Definition: unum.h:997
UNUM_EXPONENT_SIGN_FIELD
Definition: unum.h:367
UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
Definition: unum.h:242
UNUM_SPELLOUT
Spellout rule-based format.
Definition: unum.h:182
unum_getTextAttribute
int32_t unum_getTextAttribute(const UNumberFormat *fmt, UNumberFormatTextAttribute tag, UChar *result, int32_t resultLength, UErrorCode *status)
Get a text attribute associated with a UNumberFormat.
UNumberFormatStyle
UNumberFormatStyle
The possible number format styles.
Definition: unum.h:146
unum_countAvailable
int32_t unum_countAvailable(void)
Determine how many locales have decimal formatting patterns available.
UNUM_PERCENT_SYMBOL
The percent sign.
Definition: unum.h:1308
UNUM_INFINITY_SYMBOL
Infinity symbol.
Definition: unum.h:1330
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
UNUM_CURRENCY_SURROUNDING_MATCH
Definition: unum.h:335
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:141
UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
Definition: unum.h:983
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
UNUM_SEVEN_DIGIT_SYMBOL
Seven.
Definition: unum.h:1367
UNUM_ZERO_DIGIT_SYMBOL
Zero.
Definition: unum.h:1310
UNumberFormatFields
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
Definition: unum.h:357
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
ucurr.h
C API: Encapsulates information about a currency.
UNUM_MAX_SIGNIFICANT_DIGITS
Maximum significant digits.
Definition: unum.h:1008
UNUM_CURRENCY_PLURAL
Currency format with a pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars"...
Definition: unum.h:215
UNUM_FORMAT_SYMBOL_COUNT
One more than the highest normal UNumberFormatSymbol value.
Definition: unum.h:1387
UNUM_PARSE_INT_ONLY
Parse integers only.
Definition: unum.h:969
UNUM_FRACTION_FIELD
Definition: unum.h:361
UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
Definition: unum.h:1031
UNumberFormatTextAttribute
UNumberFormatTextAttribute
The possible UNumberFormat text attributes.
Definition: unum.h:1191
UNUM_CURRENCY_MATCH
Definition: unum.h:333
UNUM_CURRENCY_FIELD
Definition: unum.h:373
unum_clone
UNumberFormat * unum_clone(const UNumberFormat *fmt, UErrorCode *status)
Open a copy of a UNumberFormat.
UNUM_PARSE_CASE_SENSITIVE
Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
Definition: unum.h:1087
UNUM_MAX_FRACTION_DIGITS
Maximum fraction digits.
Definition: unum.h:981
UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
Definition: unum.h:999
UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
Definition: unum.h:995
UNUM_IGNORE
Alias for UNUM_PATTERN_DECIMAL.
Definition: unum.h:268
LocalUNumberFormatPointer
"Smart pointer" class, closes a UNumberFormat via unum_close().
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition: unum.h:1055
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:308
UNUM_PERMILL_SYMBOL
Per mill symbol.
Definition: unum.h:1326
UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
Definition: unum.h:1306
UNUM_CURRENCY_INSERT
Definition: unum.h:337
unum_getContext
UDisplayContext unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode *status)
Get the formatter&#39;s UDisplayContext value for the specified UDisplayContextType, such as UDISPCTX_TYP...
UNUM_SCIENTIFIC
Scientific format.
Definition: unum.h:175
UNUM_GROUPING_USED
Use grouping separator.
Definition: unum.h:971
UNUM_MINIMUM_GROUPING_DIGITS
Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
Definition: unum.h:1041
unum_formatDouble
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_SIGN_FIELD
Definition: unum.h:379
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:1063
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:376
UNUM_POSITIVE_SUFFIX
Positive suffix.
Definition: unum.h:1195
UNUM_ONE_DIGIT_SYMBOL
One.
Definition: unum.h:1343
UNUM_MULTIPLIER
Multiplier.
Definition: unum.h:987
UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
Definition: unum.h:977
unum_getLocaleByType
const char * unum_getLocaleByType(const UNumberFormat *fmt, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this number format object.
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:319
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
UNUM_ORDINAL
Ordinal rule-based format .
Definition: unum.h:189
UNUM_PAD_ESCAPE_SYMBOL
Escape padding character.
Definition: unum.h:1328
parseerr.h
C API: Parse Error Information.
unum_setAttribute
void unum_setAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, int32_t newValue)
Set a numeric attribute associated with a UNumberFormat.
UNUM_PADDING_CHARACTER
The character used to pad to the format width.
Definition: unum.h:1201
UNUM_PERCENT_FIELD
Definition: unum.h:375
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:1080
unum_open
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_TWO_DIGIT_SYMBOL
Two.
Definition: unum.h:1347
UNUM_ROUNDING_MODE
Rounding Mode.
Definition: unum.h:991
UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
Definition: unum.h:1302
unum_formatDoubleForFields
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&#39;s locale, and initialize a UFiel...
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:338
UNUM_CURRENCY_ACCOUNTING
Currency format for accounting, e.g., "($3.00)" for negative currency amount instead of "-$3...
Definition: unum.h:222
unum_parseDouble
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_getSymbol
int32_t unum_getSymbol(const UNumberFormat *fmt, UNumberFormatSymbol symbol, UChar *buffer, int32_t size, UErrorCode *status)
Get a symbol associated with a UNumberFormat.
UNUM_FOUR_DIGIT_SYMBOL
Four.
Definition: unum.h:1355
UNUM_ROUNDING_INCREMENT
Rounding increment.
Definition: unum.h:993
ufieldpositer.h
C API: UFieldPositionIterator for use with format APIs.
UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
Definition: unum.h:1005
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
unum_formatDoubleCurrency
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.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
unum_parseToUFormattable
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_INTL_CURRENCY_SYMBOL
The international currency symbol.
Definition: unum.h:1320
unum_getAttribute
int32_t unum_getAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Get a numeric attribute associated with a UNumberFormat.
UNUM_DEFAULT_RULESET
The default rule set, such as "%spellout-numbering-year:", "%spellout-cardinal:", "%spellout-ordinal-...
Definition: unum.h:1212
UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
Definition: unum.h:1322
unum_toPattern
int32_t unum_toPattern(const UNumberFormat *fmt, UBool isPatternLocalized, UChar *result, int32_t resultLength, UErrorCode *status)
Extract the pattern from a UNumberFormat.
unum_formatDecimal
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_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:1049
UNUM_CURRENCY_SYMBOL
The currency symbol.
Definition: unum.h:1318
UNUM_PLUS_SIGN_SYMBOL
The plus sign.
Definition: unum.h:1316
UNUM_DURATION
Duration rule-based format.
Definition: unum.h:194
UNUM_GROUPING_SEPARATOR_FIELD
Definition: unum.h:371
UFormattable
void * UFormattable
Opaque type representing various types of data which may be used for formatting and parsing operation...
Definition: uformattable.h:70
UNumberFormatAttribute
UNumberFormatAttribute
The possible UNumberFormat numeric attributes.
Definition: unum.h:967
unum_close
void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UNUM_NEGATIVE_SUFFIX
Negative suffix.
Definition: unum.h:1199
UNUM_FIELD_COUNT
One more than the highest normal UNumberFormatFields value.
Definition: unum.h:390
UNUM_GROUPING_SIZE
Grouping size.
Definition: unum.h:989
UNUM_CURRENCY_SPACING_COUNT
One more than the highest normal UCurrencySpacing value.
Definition: unum.h:346
unum_parse
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.
UNUM_PUBLIC_RULESETS
The public rule sets.
Definition: unum.h:1221
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261
UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
Definition: unum.h:975
UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
Definition: unum.h:1312
uloc.h
C API: Locale.
UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
Definition: unum.h:973
UNUM_THREE_DIGIT_SYMBOL
Three.
Definition: unum.h:1351
unum_setTextAttribute
void unum_setTextAttribute(UNumberFormat *fmt, UNumberFormatTextAttribute tag, const UChar *newValue, int32_t newValueLength, UErrorCode *status)
Set a text attribute associated with a UNumberFormat.