ICU 60.2 60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

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
137 typedef void* UNumberFormat;
138
142 typedef enum UNumberFormatStyle {
147 UNUM_PATTERN_DECIMAL=0,
152 UNUM_DECIMAL=1,
161 UNUM_CURRENCY=2,
166 UNUM_PERCENT=3,
171 UNUM_SCIENTIFIC=4,
178 UNUM_SPELLOUT=5,
185 UNUM_ORDINAL=6,
190 UNUM_DURATION=7,
195 UNUM_NUMBERING_SYSTEM=8,
200 UNUM_PATTERN_RULEBASED=9,
205 UNUM_CURRENCY_ISO=10,
211 UNUM_CURRENCY_PLURAL=11,
218 UNUM_CURRENCY_ACCOUNTING=12,
224 UNUM_CASH_CURRENCY=13,
231 UNUM_DECIMAL_COMPACT_SHORT=14,
238 UNUM_DECIMAL_COMPACT_LONG=15,
245 UNUM_CURRENCY_STANDARD=16,
246
247 #ifndef U_HIDE_DEPRECATED_API
248
252 UNUM_FORMAT_STYLE_COUNT=17,
253 #endif /* U_HIDE_DEPRECATED_API */
254
259 UNUM_DEFAULT = UNUM_DECIMAL,
264 UNUM_IGNORE = UNUM_PATTERN_DECIMAL
265 } UNumberFormatStyle;
266
275 typedef enum UNumberFormatRoundingMode {
276 UNUM_ROUND_CEILING,
277 UNUM_ROUND_FLOOR,
278 UNUM_ROUND_DOWN,
279 UNUM_ROUND_UP,
284 UNUM_ROUND_HALFEVEN,
285 #ifndef U_HIDE_DEPRECATED_API
286
290 UNUM_FOUND_HALFEVEN = UNUM_ROUND_HALFEVEN,
291 #endif /* U_HIDE_DEPRECATED_API */
292 UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
293 UNUM_ROUND_HALFUP,
298 UNUM_ROUND_UNNECESSARY
299 } UNumberFormatRoundingMode;
300
304 typedef enum UNumberFormatPadPosition {
305 UNUM_PAD_BEFORE_PREFIX,
306 UNUM_PAD_AFTER_PREFIX,
307 UNUM_PAD_BEFORE_SUFFIX,
308 UNUM_PAD_AFTER_SUFFIX
309 } UNumberFormatPadPosition;
310
315 typedef enum UNumberCompactStyle {
317 UNUM_SHORT,
319 UNUM_LONG
321 } UNumberCompactStyle;
322
327 enum UCurrencySpacing {
329 UNUM_CURRENCY_MATCH,
331 UNUM_CURRENCY_SURROUNDING_MATCH,
333 UNUM_CURRENCY_INSERT,
334
335 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
336 * it is needed for layout of DecimalFormatSymbols object. */
341 UNUM_CURRENCY_SPACING_COUNT
342 };
343 typedef enum UCurrencySpacing UCurrencySpacing;
351 typedef enum UNumberFormatFields {
353 UNUM_INTEGER_FIELD,
355 UNUM_FRACTION_FIELD,
357 UNUM_DECIMAL_SEPARATOR_FIELD,
359 UNUM_EXPONENT_SYMBOL_FIELD,
361 UNUM_EXPONENT_SIGN_FIELD,
363 UNUM_EXPONENT_FIELD,
365 UNUM_GROUPING_SEPARATOR_FIELD,
367 UNUM_CURRENCY_FIELD,
369 UNUM_PERCENT_FIELD,
371 UNUM_PERMILL_FIELD,
373 UNUM_SIGN_FIELD,
374 #ifndef U_HIDE_DEPRECATED_API
375
379 UNUM_FIELD_COUNT
380 #endif /* U_HIDE_DEPRECATED_API */
381 } UNumberFormatFields;
382
383
417 U_STABLE UNumberFormat* U_EXPORT2
418 unum_open( UNumberFormatStyle style,
419 const UChar* pattern,
420 int32_t patternLength,
421 const char* locale,
422 UParseError* parseErr,
423 UErrorCode* status);
424
425
432 U_STABLE void U_EXPORT2
433 unum_close(UNumberFormat* fmt);
434
435 #if U_SHOW_CPLUSPLUS_API
436
437 U_NAMESPACE_BEGIN
438
448 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
449
450 U_NAMESPACE_END
451
452 #endif
453
462 U_STABLE UNumberFormat* U_EXPORT2
463 unum_clone(const UNumberFormat *fmt,
464 UErrorCode *status);
465
490 U_STABLE int32_t U_EXPORT2
491 unum_format( const UNumberFormat* fmt,
492 int32_t number,
493 UChar* result,
494 int32_t resultLength,
495 UFieldPosition *pos,
496 UErrorCode* status);
497
522 U_STABLE int32_t U_EXPORT2
523 unum_formatInt64(const UNumberFormat *fmt,
524 int64_t number,
525 UChar* result,
526 int32_t resultLength,
527 UFieldPosition *pos,
528 UErrorCode* status);
529
554 U_STABLE int32_t U_EXPORT2
555 unum_formatDouble( const UNumberFormat* fmt,
556 double number,
557 UChar* result,
558 int32_t resultLength,
559 UFieldPosition *pos, /* 0 if ignore */
560 UErrorCode* status);
561
562 #ifndef U_HIDE_DRAFT_API
563
605 U_DRAFT int32_t U_EXPORT2
606 unum_formatDoubleForFields(const UNumberFormat* format,
607 double number,
608 UChar* result,
609 int32_t resultLength,
610 UFieldPositionIterator* fpositer,
611 UErrorCode* status);
612
613 #endif /* U_HIDE_DRAFT_API */
614
643 U_STABLE int32_t U_EXPORT2
644 unum_formatDecimal( const UNumberFormat* fmt,
645 const char * number,
646 int32_t length,
647 UChar* result,
648 int32_t resultLength,
649 UFieldPosition *pos, /* 0 if ignore */
650 UErrorCode* status);
651
676 U_STABLE int32_t U_EXPORT2
677 unum_formatDoubleCurrency(const UNumberFormat* fmt,
678 double number,
679 UChar* currency,
680 UChar* result,
681 int32_t resultLength,
682 UFieldPosition* pos,
683 UErrorCode* status);
684
705 U_STABLE int32_t U_EXPORT2
706 unum_formatUFormattable(const UNumberFormat* fmt,
707 const UFormattable *number,
708 UChar *result,
709 int32_t resultLength,
710 UFieldPosition *pos,
711 UErrorCode *status);
712
732 U_STABLE int32_t U_EXPORT2
733 unum_parse( const UNumberFormat* fmt,
734 const UChar* text,
735 int32_t textLength,
736 int32_t *parsePos /* 0 = start */,
737 UErrorCode *status);
738
758 U_STABLE int64_t U_EXPORT2
759 unum_parseInt64(const UNumberFormat* fmt,
760 const UChar* text,
761 int32_t textLength,
762 int32_t *parsePos /* 0 = start */,
763 UErrorCode *status);
764
784 U_STABLE double U_EXPORT2
785 unum_parseDouble( const UNumberFormat* fmt,
786 const UChar* text,
787 int32_t textLength,
788 int32_t *parsePos /* 0 = start */,
789 UErrorCode *status);
790
791
819 U_STABLE int32_t U_EXPORT2
820 unum_parseDecimal(const UNumberFormat* fmt,
821 const UChar* text,
822 int32_t textLength,
823 int32_t *parsePos /* 0 = start */,
824 char *outBuf,
825 int32_t outBufLength,
826 UErrorCode *status);
827
847 U_STABLE double U_EXPORT2
848 unum_parseDoubleCurrency(const UNumberFormat* fmt,
849 const UChar* text,
850 int32_t textLength,
851 int32_t* parsePos, /* 0 = start */
852 UChar* currency,
853 UErrorCode* status);
854
875 U_STABLE UFormattable* U_EXPORT2
876 unum_parseToUFormattable(const UNumberFormat* fmt,
877 UFormattable *result,
878 const UChar* text,
879 int32_t textLength,
880 int32_t* parsePos, /* 0 = start */
881 UErrorCode* status);
882
899 U_STABLE void U_EXPORT2
900 unum_applyPattern( UNumberFormat *format,
901 UBool localized,
902 const UChar *pattern,
903 int32_t patternLength,
904 UParseError *parseError,
905 UErrorCode *status
906 );
907
918 U_STABLE const char* U_EXPORT2
919 unum_getAvailable(int32_t localeIndex);
920
930 U_STABLE int32_t U_EXPORT2
931 unum_countAvailable(void);
932
933 #if UCONFIG_HAVE_PARSEALLINPUT
934 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
938 typedef enum UNumberFormatAttributeValue {
939 #ifndef U_HIDE_INTERNAL_API
940
941 UNUM_NO = 0,
943 UNUM_YES = 1,
945 UNUM_MAYBE = 2
946 #else
947
948 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
949 #endif /* U_HIDE_INTERNAL_API */
950 } UNumberFormatAttributeValue;
951 #endif
952
954 typedef enum UNumberFormatAttribute {
956 UNUM_PARSE_INT_ONLY,
958 UNUM_GROUPING_USED,
960 UNUM_DECIMAL_ALWAYS_SHOWN,
962 UNUM_MAX_INTEGER_DIGITS,
964 UNUM_MIN_INTEGER_DIGITS,
966 UNUM_INTEGER_DIGITS,
968 UNUM_MAX_FRACTION_DIGITS,
970 UNUM_MIN_FRACTION_DIGITS,
972 UNUM_FRACTION_DIGITS,
974 UNUM_MULTIPLIER,
976 UNUM_GROUPING_SIZE,
978 UNUM_ROUNDING_MODE,
980 UNUM_ROUNDING_INCREMENT,
982 UNUM_FORMAT_WIDTH,
984 UNUM_PADDING_POSITION,
986 UNUM_SECONDARY_GROUPING_SIZE,
989 UNUM_SIGNIFICANT_DIGITS_USED,
992 UNUM_MIN_SIGNIFICANT_DIGITS,
995 UNUM_MAX_SIGNIFICANT_DIGITS,
999 UNUM_LENIENT_PARSE,
1000 #if UCONFIG_HAVE_PARSEALLINPUT
1001
1005 UNUM_PARSE_ALL_INPUT = 20,
1006 #endif
1007
1016 UNUM_SCALE = 21,
1017 #ifndef U_HIDE_INTERNAL_API
1018
1024 UNUM_MINIMUM_GROUPING_DIGITS = 22,
1025 /* TODO: test C API when it becomes @draft */
1026 #endif /* U_HIDE_INTERNAL_API */
1027
1034 UNUM_CURRENCY_USAGE = 23,
1035
1036 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
1040 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
1041
1047 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
1054 UNUM_PARSE_NO_EXPONENT,
1055
1064 UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
1065
1066 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
1069 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003
1070 } UNumberFormatAttribute;
1071
1089 U_STABLE int32_t U_EXPORT2
1090 unum_getAttribute(const UNumberFormat* fmt,
1091 UNumberFormatAttribute attr);
1092
1112 U_STABLE void U_EXPORT2
1113 unum_setAttribute( UNumberFormat* fmt,
1114 UNumberFormatAttribute attr,
1115 int32_t newValue);
1116
1117
1132 U_STABLE double U_EXPORT2
1133 unum_getDoubleAttribute(const UNumberFormat* fmt,
1134 UNumberFormatAttribute attr);
1135
1150 U_STABLE void U_EXPORT2
1151 unum_setDoubleAttribute( UNumberFormat* fmt,
1152 UNumberFormatAttribute attr,
1153 double newValue);
1154
1156 typedef enum UNumberFormatTextAttribute {
1158 UNUM_POSITIVE_PREFIX,
1160 UNUM_POSITIVE_SUFFIX,
1162 UNUM_NEGATIVE_PREFIX,
1164 UNUM_NEGATIVE_SUFFIX,
1166 UNUM_PADDING_CHARACTER,
1168 UNUM_CURRENCY_CODE,
1177 UNUM_DEFAULT_RULESET,
1186 UNUM_PUBLIC_RULESETS
1187 } UNumberFormatTextAttribute;
1188
1207 U_STABLE int32_t U_EXPORT2
1208 unum_getTextAttribute( const UNumberFormat* fmt,
1209 UNumberFormatTextAttribute tag,
1210 UChar* result,
1211 int32_t resultLength,
1212 UErrorCode* status);
1213
1230 U_STABLE void U_EXPORT2
1231 unum_setTextAttribute( UNumberFormat* fmt,
1232 UNumberFormatTextAttribute tag,
1233 const UChar* newValue,
1234 int32_t newValueLength,
1235 UErrorCode *status);
1236
1253 U_STABLE int32_t U_EXPORT2
1254 unum_toPattern( const UNumberFormat* fmt,
1255 UBool isPatternLocalized,
1256 UChar* result,
1257 int32_t resultLength,
1258 UErrorCode* status);
1259
1260
1265 typedef enum UNumberFormatSymbol {
1267 UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
1269 UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
1271 UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
1273 UNUM_PERCENT_SYMBOL = 3,
1275 UNUM_ZERO_DIGIT_SYMBOL = 4,
1277 UNUM_DIGIT_SYMBOL = 5,
1279 UNUM_MINUS_SIGN_SYMBOL = 6,
1281 UNUM_PLUS_SIGN_SYMBOL = 7,
1283 UNUM_CURRENCY_SYMBOL = 8,
1285 UNUM_INTL_CURRENCY_SYMBOL = 9,
1287 UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
1289 UNUM_EXPONENTIAL_SYMBOL = 11,
1291 UNUM_PERMILL_SYMBOL = 12,
1293 UNUM_PAD_ESCAPE_SYMBOL = 13,
1295 UNUM_INFINITY_SYMBOL = 14,
1297 UNUM_NAN_SYMBOL = 15,
1300 UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
1304 UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
1308 UNUM_ONE_DIGIT_SYMBOL = 18,
1312 UNUM_TWO_DIGIT_SYMBOL = 19,
1316 UNUM_THREE_DIGIT_SYMBOL = 20,
1320 UNUM_FOUR_DIGIT_SYMBOL = 21,
1324 UNUM_FIVE_DIGIT_SYMBOL = 22,
1328 UNUM_SIX_DIGIT_SYMBOL = 23,
1332 UNUM_SEVEN_DIGIT_SYMBOL = 24,
1336 UNUM_EIGHT_DIGIT_SYMBOL = 25,
1340 UNUM_NINE_DIGIT_SYMBOL = 26,
1341
1345 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27,
1346
1347 #ifndef U_HIDE_DEPRECATED_API
1348
1352 UNUM_FORMAT_SYMBOL_COUNT = 28
1353 #endif /* U_HIDE_DEPRECATED_API */
1354 } UNumberFormatSymbol;
1355
1372 U_STABLE int32_t U_EXPORT2
1373 unum_getSymbol(const UNumberFormat *fmt,
1374 UNumberFormatSymbol symbol,
1375 UChar *buffer,
1376 int32_t size,
1377 UErrorCode *status);
1378
1392 U_STABLE void U_EXPORT2
1393 unum_setSymbol(UNumberFormat *fmt,
1394 UNumberFormatSymbol symbol,
1395 const UChar *value,
1396 int32_t length,
1397 UErrorCode *status);
1398
1399
1409 U_STABLE const char* U_EXPORT2
1410 unum_getLocaleByType(const UNumberFormat *fmt,
1411 ULocDataLocaleType type,
1412 UErrorCode* status);
1413
1422 U_STABLE void U_EXPORT2
1423 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status);
1424
1434 U_STABLE UDisplayContext U_EXPORT2
1435 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1436
1437 #endif /* #if !UCONFIG_NO_FORMATTING */
1438
1439 #endif
UNUM_SHORT
Definition: unum.h:317
UNUM_DEFAULT
Default format.
Definition: unum.h:259
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:1328
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:275
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:1289
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
Definition: unum.h:1304
UNUM_FORMAT_STYLE_COUNT
One more than the highest normal UNumberFormatStyle value.
Definition: unum.h:252
UNUM_PERMILL_FIELD
Definition: unum.h:371
UNUM_NEGATIVE_PREFIX
Negative prefix.
Definition: unum.h:1162
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:195
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:161
UNUM_DECIMAL
Decimal format ("normal" style).
Definition: unum.h:152
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:1336
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:1054
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
Definition: unum.h:1300
UNUM_NINE_DIGIT_SYMBOL
Nine.
Definition: unum.h:1340
UNUM_CURRENCY_STANDARD
Currency format with a currency symbol, e.g., "$1.00", using non-accounting style for negative values...
Definition: unum.h:245
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:200
UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
Definition: unum.h:999
UNUM_EXPONENT_FIELD
Definition: unum.h:363
UNUM_EXPONENT_SYMBOL_FIELD
Definition: unum.h:359
UNUM_FIVE_DIGIT_SYMBOL
Five.
Definition: unum.h:1324
UNUM_DECIMAL_COMPACT_SHORT
Decimal format expressed using compact notation (short form, corresponds to UNumberCompactStyle=UNUM_...
Definition: unum.h:231
UNUM_INTEGER_FIELD
Definition: unum.h:353
UCurrencySpacing
UCurrencySpacing
Constants for specifying currency spacing.
Definition: unum.h:327
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:298
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:1269
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:1069
UNUM_INTEGER_DIGITS
Integer digits.
Definition: unum.h:966
UNUM_FRACTION_DIGITS
Fraction digits.
Definition: unum.h:972
UNumberFormatSymbol
UNumberFormatSymbol
Constants for specifying a number format symbol.
Definition: unum.h:1265
UNUM_FOUND_HALFEVEN
Half-even rounding, misspelled name.
Definition: unum.h:290
UNUM_POSITIVE_PREFIX
Positive prefix.
Definition: unum.h:1158
UNUM_CURRENCY_CODE
The ISO currency code.
Definition: unum.h:1168
UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
Definition: unum.h:1345
udisplaycontext.h
C API: Display context types (enum values)
UNUM_MINUS_SIGN_SYMBOL
The minus sign.
Definition: unum.h:1279
UNUM_NAN_SYMBOL
Nan symbol.
Definition: unum.h:1297
UNUM_LONG
Definition: unum.h:319
UNUM_CURRENCY_ISO
Currency format with an ISO currency code, e.g., "USD1.00".
Definition: unum.h:205
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:224
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:147
UNUM_SIGNIFICANT_DIGITS_USED
Use significant digits.
Definition: unum.h:989
UNUM_PERCENT
Percent format.
Definition: unum.h:166
UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition: unum.h:284
UNUM_DECIMAL_SEPARATOR_FIELD
Definition: unum.h:357
UNUM_PADDING_POSITION
The position at which padding will take place.
Definition: unum.h:984
UNUM_EXPONENT_SIGN_FIELD
Definition: unum.h:361
UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
Definition: unum.h:238
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
UNUM_SPELLOUT
Spellout rule-based format.
Definition: unum.h:178
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:142
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:1273
UNUM_INFINITY_SYMBOL
Infinity symbol.
Definition: unum.h:1295
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:487
UNUM_CURRENCY_SURROUNDING_MATCH
Definition: unum.h:331
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:137
UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
Definition: unum.h:970
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
UNUM_SEVEN_DIGIT_SYMBOL
Seven.
Definition: unum.h:1332
UNUM_ZERO_DIGIT_SYMBOL
Zero.
Definition: unum.h:1275
UNumberFormatFields
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
Definition: unum.h:351
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:995
UNUM_CURRENCY_PLURAL
Currency format with a pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars"...
Definition: unum.h:211
UNUM_FORMAT_SYMBOL_COUNT
One more than the highest normal UNumberFormatSymbol value.
Definition: unum.h:1352
UNUM_PARSE_INT_ONLY
Parse integers only.
Definition: unum.h:956
UNUM_FRACTION_FIELD
Definition: unum.h:355
UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
Definition: unum.h:1016
UNumberFormatTextAttribute
UNumberFormatTextAttribute
The possible UNumberFormat text attributes.
Definition: unum.h:1156
UNUM_CURRENCY_MATCH
Definition: unum.h:329
UNUM_CURRENCY_FIELD
Definition: unum.h:367
unum_clone
UNumberFormat * unum_clone(const UNumberFormat *fmt, UErrorCode *status)
Open a copy of a UNumberFormat.
UNUM_MAX_FRACTION_DIGITS
Maximum fraction digits.
Definition: unum.h:968
UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
Definition: unum.h:986
UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
Definition: unum.h:982
UNUM_IGNORE
Alias for UNUM_PATTERN_DECIMAL.
Definition: unum.h:264
LocalUNumberFormatPointer
"Smart pointer" class, closes a UNumberFormat via unum_close().
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition: unum.h:1040
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:304
UNUM_PERMILL_SYMBOL
Per mill symbol.
Definition: unum.h:1291
UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
Definition: unum.h:1271
UNUM_CURRENCY_INSERT
Definition: unum.h:333
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:171
UNUM_GROUPING_USED
Use grouping separator.
Definition: unum.h:958
UNUM_MINIMUM_GROUPING_DIGITS
Minimum grouping digits, technology preview.
Definition: unum.h:1024
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:373
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:1047
UChar
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:349
UNUM_POSITIVE_SUFFIX
Positive suffix.
Definition: unum.h:1160
UNUM_ONE_DIGIT_SYMBOL
One.
Definition: unum.h:1308
UNUM_MULTIPLIER
Multiplier.
Definition: unum.h:974
UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
Definition: unum.h:964
unum_getLocaleByType
const char * unum_getLocaleByType(const UNumberFormat *fmt, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this number format object.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:315
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:185
UNUM_PAD_ESCAPE_SYMBOL
Escape padding character.
Definition: unum.h:1293
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:1166
UNUM_PERCENT_FIELD
Definition: unum.h:369
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:1064
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:1312
UNUM_ROUNDING_MODE
Rounding Mode.
Definition: unum.h:978
UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
Definition: unum.h:1267
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
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
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:218
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:1320
UNUM_ROUNDING_INCREMENT
Rounding increment.
Definition: unum.h:980
ufieldpositer.h
C API: UFieldPositionIterator for use with format APIs.
UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
Definition: unum.h:992
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:1285
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:1177
UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
Definition: unum.h:1287
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:1034
UNUM_CURRENCY_SYMBOL
The currency symbol.
Definition: unum.h:1283
UNUM_PLUS_SIGN_SYMBOL
The plus sign.
Definition: unum.h:1281
UNUM_DURATION
Duration rule-based format.
Definition: unum.h:190
U_DRAFT
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:113
UNUM_GROUPING_SEPARATOR_FIELD
Definition: unum.h:365
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:954
unum_close
void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UNUM_NEGATIVE_SUFFIX
Negative suffix.
Definition: unum.h:1164
UNUM_FIELD_COUNT
One more than the highest normal UNumberFormatFields value.
Definition: unum.h:379
UNUM_GROUPING_SIZE
Grouping size.
Definition: unum.h:976
UNUM_CURRENCY_SPACING_COUNT
One more than the highest normal UCurrencySpacing value.
Definition: unum.h:341
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:1186
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:236
UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
Definition: unum.h:962
UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
Definition: unum.h:1277
uloc.h
C API: Locale.
UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
Definition: unum.h:960
UNUM_THREE_DIGIT_SYMBOL
Three.
Definition: unum.h:1316
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.