ICU 63.1 63.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. */
345 UNUM_CURRENCY_SPACING_COUNT
346 };
347 typedef enum UCurrencySpacing UCurrencySpacing;
355 typedef enum UNumberFormatFields {
357 UNUM_INTEGER_FIELD,
359 UNUM_FRACTION_FIELD,
361 UNUM_DECIMAL_SEPARATOR_FIELD,
363 UNUM_EXPONENT_SYMBOL_FIELD,
365 UNUM_EXPONENT_SIGN_FIELD,
367 UNUM_EXPONENT_FIELD,
369 UNUM_GROUPING_SEPARATOR_FIELD,
371 UNUM_CURRENCY_FIELD,
373 UNUM_PERCENT_FIELD,
375 UNUM_PERMILL_FIELD,
377 UNUM_SIGN_FIELD,
378 #ifndef U_HIDE_DEPRECATED_API
379
383 UNUM_FIELD_COUNT
384 #endif /* U_HIDE_DEPRECATED_API */
385 } UNumberFormatFields;
386
387
425 U_STABLE UNumberFormat* U_EXPORT2
426 unum_open( UNumberFormatStyle style,
427 const UChar* pattern,
428 int32_t patternLength,
429 const char* locale,
430 UParseError* parseErr,
431 UErrorCode* status);
432
433
440 U_STABLE void U_EXPORT2
441 unum_close(UNumberFormat* fmt);
442
443 #if U_SHOW_CPLUSPLUS_API
444
445 U_NAMESPACE_BEGIN
446
456 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
457
458 U_NAMESPACE_END
459
460 #endif
461
470 U_STABLE UNumberFormat* U_EXPORT2
471 unum_clone(const UNumberFormat *fmt,
472 UErrorCode *status);
473
498 U_STABLE int32_t U_EXPORT2
499 unum_format( const UNumberFormat* fmt,
500 int32_t number,
501 UChar* result,
502 int32_t resultLength,
503 UFieldPosition *pos,
504 UErrorCode* status);
505
530 U_STABLE int32_t U_EXPORT2
531 unum_formatInt64(const UNumberFormat *fmt,
532 int64_t number,
533 UChar* result,
534 int32_t resultLength,
535 UFieldPosition *pos,
536 UErrorCode* status);
537
562 U_STABLE int32_t U_EXPORT2
563 unum_formatDouble( const UNumberFormat* fmt,
564 double number,
565 UChar* result,
566 int32_t resultLength,
567 UFieldPosition *pos, /* 0 if ignore */
568 UErrorCode* status);
569
612 U_STABLE int32_t U_EXPORT2
613 unum_formatDoubleForFields(const UNumberFormat* format,
614 double number,
615 UChar* result,
616 int32_t resultLength,
617 UFieldPositionIterator* fpositer,
618 UErrorCode* status);
619
620
649 U_STABLE int32_t U_EXPORT2
650 unum_formatDecimal( const UNumberFormat* fmt,
651 const char * number,
652 int32_t length,
653 UChar* result,
654 int32_t resultLength,
655 UFieldPosition *pos, /* 0 if ignore */
656 UErrorCode* status);
657
682 U_STABLE int32_t U_EXPORT2
683 unum_formatDoubleCurrency(const UNumberFormat* fmt,
684 double number,
685 UChar* currency,
686 UChar* result,
687 int32_t resultLength,
688 UFieldPosition* pos,
689 UErrorCode* status);
690
711 U_STABLE int32_t U_EXPORT2
712 unum_formatUFormattable(const UNumberFormat* fmt,
713 const UFormattable *number,
714 UChar *result,
715 int32_t resultLength,
716 UFieldPosition *pos,
717 UErrorCode *status);
718
738 U_STABLE int32_t U_EXPORT2
739 unum_parse( const UNumberFormat* fmt,
740 const UChar* text,
741 int32_t textLength,
742 int32_t *parsePos /* 0 = start */,
743 UErrorCode *status);
744
764 U_STABLE int64_t U_EXPORT2
765 unum_parseInt64(const UNumberFormat* fmt,
766 const UChar* text,
767 int32_t textLength,
768 int32_t *parsePos /* 0 = start */,
769 UErrorCode *status);
770
790 U_STABLE double U_EXPORT2
791 unum_parseDouble( const UNumberFormat* fmt,
792 const UChar* text,
793 int32_t textLength,
794 int32_t *parsePos /* 0 = start */,
795 UErrorCode *status);
796
797
825 U_STABLE int32_t U_EXPORT2
826 unum_parseDecimal(const UNumberFormat* fmt,
827 const UChar* text,
828 int32_t textLength,
829 int32_t *parsePos /* 0 = start */,
830 char *outBuf,
831 int32_t outBufLength,
832 UErrorCode *status);
833
853 U_STABLE double U_EXPORT2
854 unum_parseDoubleCurrency(const UNumberFormat* fmt,
855 const UChar* text,
856 int32_t textLength,
857 int32_t* parsePos, /* 0 = start */
858 UChar* currency,
859 UErrorCode* status);
860
881 U_STABLE UFormattable* U_EXPORT2
882 unum_parseToUFormattable(const UNumberFormat* fmt,
883 UFormattable *result,
884 const UChar* text,
885 int32_t textLength,
886 int32_t* parsePos, /* 0 = start */
887 UErrorCode* status);
888
905 U_STABLE void U_EXPORT2
906 unum_applyPattern( UNumberFormat *format,
907 UBool localized,
908 const UChar *pattern,
909 int32_t patternLength,
910 UParseError *parseError,
911 UErrorCode *status
912 );
913
924 U_STABLE const char* U_EXPORT2
925 unum_getAvailable(int32_t localeIndex);
926
936 U_STABLE int32_t U_EXPORT2
937 unum_countAvailable(void);
938
939 #if UCONFIG_HAVE_PARSEALLINPUT
940 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
944 typedef enum UNumberFormatAttributeValue {
945 #ifndef U_HIDE_INTERNAL_API
946
947 UNUM_NO = 0,
949 UNUM_YES = 1,
951 UNUM_MAYBE = 2
952 #else
953
954 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
955 #endif /* U_HIDE_INTERNAL_API */
956 } UNumberFormatAttributeValue;
957 #endif
958
960 typedef enum UNumberFormatAttribute {
962 UNUM_PARSE_INT_ONLY,
964 UNUM_GROUPING_USED,
966 UNUM_DECIMAL_ALWAYS_SHOWN,
968 UNUM_MAX_INTEGER_DIGITS,
970 UNUM_MIN_INTEGER_DIGITS,
972 UNUM_INTEGER_DIGITS,
974 UNUM_MAX_FRACTION_DIGITS,
976 UNUM_MIN_FRACTION_DIGITS,
978 UNUM_FRACTION_DIGITS,
980 UNUM_MULTIPLIER,
982 UNUM_GROUPING_SIZE,
984 UNUM_ROUNDING_MODE,
986 UNUM_ROUNDING_INCREMENT,
988 UNUM_FORMAT_WIDTH,
990 UNUM_PADDING_POSITION,
992 UNUM_SECONDARY_GROUPING_SIZE,
995 UNUM_SIGNIFICANT_DIGITS_USED,
998 UNUM_MIN_SIGNIFICANT_DIGITS,
1001 UNUM_MAX_SIGNIFICANT_DIGITS,
1005 UNUM_LENIENT_PARSE,
1006 #if UCONFIG_HAVE_PARSEALLINPUT
1007
1011 UNUM_PARSE_ALL_INPUT = 20,
1012 #endif
1013
1024 UNUM_SCALE = 21,
1025 #ifndef U_HIDE_INTERNAL_API
1026
1032 UNUM_MINIMUM_GROUPING_DIGITS = 22,
1033 /* TODO: test C API when it becomes @draft */
1034 #endif /* U_HIDE_INTERNAL_API */
1035
1042 UNUM_CURRENCY_USAGE = 23,
1043
1044 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
1048 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
1049
1055 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
1062 UNUM_PARSE_NO_EXPONENT = 0x1001,
1063
1072 UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
1073
1074 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
1077 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003,
1078
1084 UNUM_PARSE_CASE_SENSITIVE = 0x1004,
1085
1091 UNUM_SIGN_ALWAYS_SHOWN = 0x1005,
1092 } UNumberFormatAttribute;
1093
1111 U_STABLE int32_t U_EXPORT2
1112 unum_getAttribute(const UNumberFormat* fmt,
1113 UNumberFormatAttribute attr);
1114
1134 U_STABLE void U_EXPORT2
1135 unum_setAttribute( UNumberFormat* fmt,
1136 UNumberFormatAttribute attr,
1137 int32_t newValue);
1138
1139
1154 U_STABLE double U_EXPORT2
1155 unum_getDoubleAttribute(const UNumberFormat* fmt,
1156 UNumberFormatAttribute attr);
1157
1172 U_STABLE void U_EXPORT2
1173 unum_setDoubleAttribute( UNumberFormat* fmt,
1174 UNumberFormatAttribute attr,
1175 double newValue);
1176
1178 typedef enum UNumberFormatTextAttribute {
1180 UNUM_POSITIVE_PREFIX,
1182 UNUM_POSITIVE_SUFFIX,
1184 UNUM_NEGATIVE_PREFIX,
1186 UNUM_NEGATIVE_SUFFIX,
1188 UNUM_PADDING_CHARACTER,
1190 UNUM_CURRENCY_CODE,
1199 UNUM_DEFAULT_RULESET,
1208 UNUM_PUBLIC_RULESETS
1209 } UNumberFormatTextAttribute;
1210
1229 U_STABLE int32_t U_EXPORT2
1230 unum_getTextAttribute( const UNumberFormat* fmt,
1231 UNumberFormatTextAttribute tag,
1232 UChar* result,
1233 int32_t resultLength,
1234 UErrorCode* status);
1235
1252 U_STABLE void U_EXPORT2
1253 unum_setTextAttribute( UNumberFormat* fmt,
1254 UNumberFormatTextAttribute tag,
1255 const UChar* newValue,
1256 int32_t newValueLength,
1257 UErrorCode *status);
1258
1275 U_STABLE int32_t U_EXPORT2
1276 unum_toPattern( const UNumberFormat* fmt,
1277 UBool isPatternLocalized,
1278 UChar* result,
1279 int32_t resultLength,
1280 UErrorCode* status);
1281
1282
1287 typedef enum UNumberFormatSymbol {
1289 UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
1291 UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
1293 UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
1295 UNUM_PERCENT_SYMBOL = 3,
1297 UNUM_ZERO_DIGIT_SYMBOL = 4,
1299 UNUM_DIGIT_SYMBOL = 5,
1301 UNUM_MINUS_SIGN_SYMBOL = 6,
1303 UNUM_PLUS_SIGN_SYMBOL = 7,
1305 UNUM_CURRENCY_SYMBOL = 8,
1307 UNUM_INTL_CURRENCY_SYMBOL = 9,
1309 UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
1311 UNUM_EXPONENTIAL_SYMBOL = 11,
1313 UNUM_PERMILL_SYMBOL = 12,
1315 UNUM_PAD_ESCAPE_SYMBOL = 13,
1317 UNUM_INFINITY_SYMBOL = 14,
1319 UNUM_NAN_SYMBOL = 15,
1322 UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
1326 UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
1330 UNUM_ONE_DIGIT_SYMBOL = 18,
1334 UNUM_TWO_DIGIT_SYMBOL = 19,
1338 UNUM_THREE_DIGIT_SYMBOL = 20,
1342 UNUM_FOUR_DIGIT_SYMBOL = 21,
1346 UNUM_FIVE_DIGIT_SYMBOL = 22,
1350 UNUM_SIX_DIGIT_SYMBOL = 23,
1354 UNUM_SEVEN_DIGIT_SYMBOL = 24,
1358 UNUM_EIGHT_DIGIT_SYMBOL = 25,
1362 UNUM_NINE_DIGIT_SYMBOL = 26,
1363
1367 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27,
1368
1369 #ifndef U_HIDE_DEPRECATED_API
1370
1374 UNUM_FORMAT_SYMBOL_COUNT = 28
1375 #endif /* U_HIDE_DEPRECATED_API */
1376 } UNumberFormatSymbol;
1377
1394 U_STABLE int32_t U_EXPORT2
1395 unum_getSymbol(const UNumberFormat *fmt,
1396 UNumberFormatSymbol symbol,
1397 UChar *buffer,
1398 int32_t size,
1399 UErrorCode *status);
1400
1414 U_STABLE void U_EXPORT2
1415 unum_setSymbol(UNumberFormat *fmt,
1416 UNumberFormatSymbol symbol,
1417 const UChar *value,
1418 int32_t length,
1419 UErrorCode *status);
1420
1421
1431 U_STABLE const char* U_EXPORT2
1432 unum_getLocaleByType(const UNumberFormat *fmt,
1433 ULocDataLocaleType type,
1434 UErrorCode* status);
1435
1444 U_STABLE void U_EXPORT2
1445 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status);
1446
1456 U_STABLE UDisplayContext U_EXPORT2
1457 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1458
1459 #endif /* #if !UCONFIG_NO_FORMATTING */
1460
1461 #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:1350
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:1311
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
Definition: unum.h:1326
UNUM_FORMAT_STYLE_COUNT
One more than the highest normal UNumberFormatStyle value.
Definition: unum.h:256
UNUM_PERMILL_FIELD
Definition: unum.h:375
UNUM_NEGATIVE_PREFIX
Negative prefix.
Definition: unum.h:1184
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:1358
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:1062
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
Definition: unum.h:1322
UNUM_NINE_DIGIT_SYMBOL
Nine.
Definition: unum.h:1362
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: whether to show the plus sign on non-negative numbers.
Definition: unum.h:1091
UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
Definition: unum.h:1005
UNUM_EXPONENT_FIELD
Definition: unum.h:367
UNUM_EXPONENT_SYMBOL_FIELD
Definition: unum.h:363
UNUM_FIVE_DIGIT_SYMBOL
Five.
Definition: unum.h:1346
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:357
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:1291
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:1077
UNUM_INTEGER_DIGITS
Integer digits.
Definition: unum.h:972
UNUM_FRACTION_DIGITS
Fraction digits.
Definition: unum.h:978
UNumberFormatSymbol
UNumberFormatSymbol
Constants for specifying a number format symbol.
Definition: unum.h:1287
UNUM_FOUND_HALFEVEN
Half-even rounding, misspelled name.
Definition: unum.h:294
UNUM_POSITIVE_PREFIX
Positive prefix.
Definition: unum.h:1180
UNUM_CURRENCY_CODE
The ISO currency code.
Definition: unum.h:1190
UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
Definition: unum.h:1367
udisplaycontext.h
C API: Display context types (enum values)
UNUM_MINUS_SIGN_SYMBOL
The minus sign.
Definition: unum.h:1301
UNUM_NAN_SYMBOL
Nan symbol.
Definition: unum.h:1319
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:995
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:361
UNUM_PADDING_POSITION
The position at which padding will take place.
Definition: unum.h:990
UNUM_EXPONENT_SIGN_FIELD
Definition: unum.h:365
UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
Definition: unum.h:242
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
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:1295
UNUM_INFINITY_SYMBOL
Infinity symbol.
Definition: unum.h:1317
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:335
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:141
UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
Definition: unum.h:976
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
UNUM_SEVEN_DIGIT_SYMBOL
Seven.
Definition: unum.h:1354
UNUM_ZERO_DIGIT_SYMBOL
Zero.
Definition: unum.h:1297
UNumberFormatFields
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
Definition: unum.h:355
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:1001
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:1374
UNUM_PARSE_INT_ONLY
Parse integers only.
Definition: unum.h:962
UNUM_FRACTION_FIELD
Definition: unum.h:359
UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
Definition: unum.h:1024
UNumberFormatTextAttribute
UNumberFormatTextAttribute
The possible UNumberFormat text attributes.
Definition: unum.h:1178
UNUM_CURRENCY_MATCH
Definition: unum.h:333
UNUM_CURRENCY_FIELD
Definition: unum.h:371
unum_clone
UNumberFormat * unum_clone(const UNumberFormat *fmt, UErrorCode *status)
Open a copy of a UNumberFormat.
UNUM_PARSE_CASE_SENSITIVE
Whether parsing is sensitive to case (lowercase/uppercase).
Definition: unum.h:1084
UNUM_MAX_FRACTION_DIGITS
Maximum fraction digits.
Definition: unum.h:974
UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
Definition: unum.h:992
UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
Definition: unum.h:988
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:1048
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:308
UNUM_PERMILL_SYMBOL
Per mill symbol.
Definition: unum.h:1313
UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
Definition: unum.h:1293
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:964
UNUM_MINIMUM_GROUPING_DIGITS
Minimum grouping digits, technology preview.
Definition: unum.h:1032
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:377
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:1055
UChar
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:342
UNUM_POSITIVE_SUFFIX
Positive suffix.
Definition: unum.h:1182
UNUM_ONE_DIGIT_SYMBOL
One.
Definition: unum.h:1330
UNUM_MULTIPLIER
Multiplier.
Definition: unum.h:980
UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
Definition: unum.h:970
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:138
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:1315
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:1188
UNUM_PERCENT_FIELD
Definition: unum.h:373
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:1072
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:1334
UNUM_ROUNDING_MODE
Rounding Mode.
Definition: unum.h:984
UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
Definition: unum.h:1289
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:401
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:1342
UNUM_ROUNDING_INCREMENT
Rounding increment.
Definition: unum.h:986
ufieldpositer.h
C API: UFieldPositionIterator for use with format APIs.
UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
Definition: unum.h:998
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:1307
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:1199
UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
Definition: unum.h:1309
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:1042
UNUM_CURRENCY_SYMBOL
The currency symbol.
Definition: unum.h:1305
UNUM_PLUS_SIGN_SYMBOL
The plus sign.
Definition: unum.h:1303
UNUM_DURATION
Duration rule-based format.
Definition: unum.h:194
UNUM_GROUPING_SEPARATOR_FIELD
Definition: unum.h:369
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:960
unum_close
void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UNUM_NEGATIVE_SUFFIX
Negative suffix.
Definition: unum.h:1186
UNUM_FIELD_COUNT
One more than the highest normal UNumberFormatFields value.
Definition: unum.h:383
UNUM_GROUPING_SIZE
Grouping size.
Definition: unum.h:982
UNUM_CURRENCY_SPACING_COUNT
One more than the highest normal UCurrencySpacing value.
Definition: unum.h:345
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:1208
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:225
UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
Definition: unum.h:968
UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
Definition: unum.h:1299
uloc.h
C API: Locale
UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
Definition: unum.h:966
UNUM_THREE_DIGIT_SYMBOL
Three.
Definition: unum.h:1338
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.