ICU 58.2 58.2

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

- File List
- Globals

unum.h
Go to the documentation of this file.
1 // Copyright (C) 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
136 typedef void* UNumberFormat;
137
141 typedef enum UNumberFormatStyle {
146 UNUM_PATTERN_DECIMAL=0,
151 UNUM_DECIMAL=1,
160 UNUM_CURRENCY=2,
165 UNUM_PERCENT=3,
170 UNUM_SCIENTIFIC=4,
177 UNUM_SPELLOUT=5,
184 UNUM_ORDINAL=6,
189 UNUM_DURATION=7,
194 UNUM_NUMBERING_SYSTEM=8,
199 UNUM_PATTERN_RULEBASED=9,
204 UNUM_CURRENCY_ISO=10,
210 UNUM_CURRENCY_PLURAL=11,
217 UNUM_CURRENCY_ACCOUNTING=12,
223 UNUM_CASH_CURRENCY=13,
230 UNUM_DECIMAL_COMPACT_SHORT=14,
237 UNUM_DECIMAL_COMPACT_LONG=15,
244 UNUM_CURRENCY_STANDARD=16,
245
246 #ifndef U_HIDE_DEPRECATED_API
247
251 UNUM_FORMAT_STYLE_COUNT=17,
252 #endif // U_HIDE_DEPRECATED_API
253
258 UNUM_DEFAULT = UNUM_DECIMAL,
263 UNUM_IGNORE = UNUM_PATTERN_DECIMAL
264 } UNumberFormatStyle;
265
269 typedef enum UNumberFormatRoundingMode {
270 UNUM_ROUND_CEILING,
271 UNUM_ROUND_FLOOR,
272 UNUM_ROUND_DOWN,
273 UNUM_ROUND_UP,
278 UNUM_ROUND_HALFEVEN,
279 #ifndef U_HIDE_DEPRECATED_API
280
284 UNUM_FOUND_HALFEVEN = UNUM_ROUND_HALFEVEN,
285 #endif /* U_HIDE_DEPRECATED_API */
286 UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
287 UNUM_ROUND_HALFUP,
292 UNUM_ROUND_UNNECESSARY
293 } UNumberFormatRoundingMode;
294
298 typedef enum UNumberFormatPadPosition {
299 UNUM_PAD_BEFORE_PREFIX,
300 UNUM_PAD_AFTER_PREFIX,
301 UNUM_PAD_BEFORE_SUFFIX,
302 UNUM_PAD_AFTER_SUFFIX
303 } UNumberFormatPadPosition;
304
309 typedef enum UNumberCompactStyle {
311 UNUM_SHORT,
313 UNUM_LONG
315 } UNumberCompactStyle;
316
321 enum UCurrencySpacing {
323 UNUM_CURRENCY_MATCH,
325 UNUM_CURRENCY_SURROUNDING_MATCH,
327 UNUM_CURRENCY_INSERT,
328
329 // Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
330 // it is needed for layout of DecimalFormatSymbols object.
335 UNUM_CURRENCY_SPACING_COUNT
336 };
337 typedef enum UCurrencySpacing UCurrencySpacing;
345 typedef enum UNumberFormatFields {
347 UNUM_INTEGER_FIELD,
349 UNUM_FRACTION_FIELD,
351 UNUM_DECIMAL_SEPARATOR_FIELD,
353 UNUM_EXPONENT_SYMBOL_FIELD,
355 UNUM_EXPONENT_SIGN_FIELD,
357 UNUM_EXPONENT_FIELD,
359 UNUM_GROUPING_SEPARATOR_FIELD,
361 UNUM_CURRENCY_FIELD,
363 UNUM_PERCENT_FIELD,
365 UNUM_PERMILL_FIELD,
367 UNUM_SIGN_FIELD,
368 #ifndef U_HIDE_DEPRECATED_API
369
373 UNUM_FIELD_COUNT
374 #endif // U_HIDE_DEPRECATED_API
375 } UNumberFormatFields;
376
377
411 U_STABLE UNumberFormat* U_EXPORT2
412 unum_open( UNumberFormatStyle style,
413 const UChar* pattern,
414 int32_t patternLength,
415 const char* locale,
416 UParseError* parseErr,
417 UErrorCode* status);
418
419
426 U_STABLE void U_EXPORT2
427 unum_close(UNumberFormat* fmt);
428
429 #if U_SHOW_CPLUSPLUS_API
430
431 U_NAMESPACE_BEGIN
432
442 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
443
444 U_NAMESPACE_END
445
446 #endif
447
456 U_STABLE UNumberFormat* U_EXPORT2
457 unum_clone(const UNumberFormat *fmt,
458 UErrorCode *status);
459
484 U_STABLE int32_t U_EXPORT2
485 unum_format( const UNumberFormat* fmt,
486 int32_t number,
487 UChar* result,
488 int32_t resultLength,
489 UFieldPosition *pos,
490 UErrorCode* status);
491
516 U_STABLE int32_t U_EXPORT2
517 unum_formatInt64(const UNumberFormat *fmt,
518 int64_t number,
519 UChar* result,
520 int32_t resultLength,
521 UFieldPosition *pos,
522 UErrorCode* status);
523
548 U_STABLE int32_t U_EXPORT2
549 unum_formatDouble( const UNumberFormat* fmt,
550 double number,
551 UChar* result,
552 int32_t resultLength,
553 UFieldPosition *pos, /* 0 if ignore */
554 UErrorCode* status);
555
584 U_STABLE int32_t U_EXPORT2
585 unum_formatDecimal( const UNumberFormat* fmt,
586 const char * number,
587 int32_t length,
588 UChar* result,
589 int32_t resultLength,
590 UFieldPosition *pos, /* 0 if ignore */
591 UErrorCode* status);
592
617 U_STABLE int32_t U_EXPORT2
618 unum_formatDoubleCurrency(const UNumberFormat* fmt,
619 double number,
620 UChar* currency,
621 UChar* result,
622 int32_t resultLength,
623 UFieldPosition* pos,
624 UErrorCode* status);
625
646 U_STABLE int32_t U_EXPORT2
647 unum_formatUFormattable(const UNumberFormat* fmt,
648 const UFormattable *number,
649 UChar *result,
650 int32_t resultLength,
651 UFieldPosition *pos,
652 UErrorCode *status);
653
673 U_STABLE int32_t U_EXPORT2
674 unum_parse( const UNumberFormat* fmt,
675 const UChar* text,
676 int32_t textLength,
677 int32_t *parsePos /* 0 = start */,
678 UErrorCode *status);
679
699 U_STABLE int64_t U_EXPORT2
700 unum_parseInt64(const UNumberFormat* fmt,
701 const UChar* text,
702 int32_t textLength,
703 int32_t *parsePos /* 0 = start */,
704 UErrorCode *status);
705
725 U_STABLE double U_EXPORT2
726 unum_parseDouble( const UNumberFormat* fmt,
727 const UChar* text,
728 int32_t textLength,
729 int32_t *parsePos /* 0 = start */,
730 UErrorCode *status);
731
732
760 U_STABLE int32_t U_EXPORT2
761 unum_parseDecimal(const UNumberFormat* fmt,
762 const UChar* text,
763 int32_t textLength,
764 int32_t *parsePos /* 0 = start */,
765 char *outBuf,
766 int32_t outBufLength,
767 UErrorCode *status);
768
788 U_STABLE double U_EXPORT2
789 unum_parseDoubleCurrency(const UNumberFormat* fmt,
790 const UChar* text,
791 int32_t textLength,
792 int32_t* parsePos, /* 0 = start */
793 UChar* currency,
794 UErrorCode* status);
795
816 U_STABLE UFormattable* U_EXPORT2
817 unum_parseToUFormattable(const UNumberFormat* fmt,
818 UFormattable *result,
819 const UChar* text,
820 int32_t textLength,
821 int32_t* parsePos, /* 0 = start */
822 UErrorCode* status);
823
840 U_STABLE void U_EXPORT2
841 unum_applyPattern( UNumberFormat *format,
842 UBool localized,
843 const UChar *pattern,
844 int32_t patternLength,
845 UParseError *parseError,
846 UErrorCode *status
847 );
848
859 U_STABLE const char* U_EXPORT2
860 unum_getAvailable(int32_t localeIndex);
861
871 U_STABLE int32_t U_EXPORT2
872 unum_countAvailable(void);
873
874 #if UCONFIG_HAVE_PARSEALLINPUT
875 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
879 typedef enum UNumberFormatAttributeValue {
880 #ifndef U_HIDE_INTERNAL_API
881
882 UNUM_NO = 0,
884 UNUM_YES = 1,
886 UNUM_MAYBE = 2
887 #else
888
889 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
890 #endif /* U_HIDE_INTERNAL_API */
891 } UNumberFormatAttributeValue;
892 #endif
893
895 typedef enum UNumberFormatAttribute {
897 UNUM_PARSE_INT_ONLY,
899 UNUM_GROUPING_USED,
901 UNUM_DECIMAL_ALWAYS_SHOWN,
903 UNUM_MAX_INTEGER_DIGITS,
905 UNUM_MIN_INTEGER_DIGITS,
907 UNUM_INTEGER_DIGITS,
909 UNUM_MAX_FRACTION_DIGITS,
911 UNUM_MIN_FRACTION_DIGITS,
913 UNUM_FRACTION_DIGITS,
915 UNUM_MULTIPLIER,
917 UNUM_GROUPING_SIZE,
919 UNUM_ROUNDING_MODE,
921 UNUM_ROUNDING_INCREMENT,
923 UNUM_FORMAT_WIDTH,
925 UNUM_PADDING_POSITION,
927 UNUM_SECONDARY_GROUPING_SIZE,
930 UNUM_SIGNIFICANT_DIGITS_USED,
933 UNUM_MIN_SIGNIFICANT_DIGITS,
936 UNUM_MAX_SIGNIFICANT_DIGITS,
940 UNUM_LENIENT_PARSE,
941 #if UCONFIG_HAVE_PARSEALLINPUT
942
946 UNUM_PARSE_ALL_INPUT = 20,
947 #endif
948
957 UNUM_SCALE = 21,
958 #ifndef U_HIDE_INTERNAL_API
959
965 UNUM_MINIMUM_GROUPING_DIGITS = 22,
966 /* TODO: test C API when it becomes @draft */
967 #endif /* U_HIDE_INTERNAL_API */
968
975 UNUM_CURRENCY_USAGE = 23,
976
977 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
981 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
982
988 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
995 UNUM_PARSE_NO_EXPONENT,
996
1005 UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
1006
1007 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
1010 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003
1011 } UNumberFormatAttribute;
1012
1030 U_STABLE int32_t U_EXPORT2
1031 unum_getAttribute(const UNumberFormat* fmt,
1032 UNumberFormatAttribute attr);
1033
1053 U_STABLE void U_EXPORT2
1054 unum_setAttribute( UNumberFormat* fmt,
1055 UNumberFormatAttribute attr,
1056 int32_t newValue);
1057
1058
1073 U_STABLE double U_EXPORT2
1074 unum_getDoubleAttribute(const UNumberFormat* fmt,
1075 UNumberFormatAttribute attr);
1076
1091 U_STABLE void U_EXPORT2
1092 unum_setDoubleAttribute( UNumberFormat* fmt,
1093 UNumberFormatAttribute attr,
1094 double newValue);
1095
1097 typedef enum UNumberFormatTextAttribute {
1099 UNUM_POSITIVE_PREFIX,
1101 UNUM_POSITIVE_SUFFIX,
1103 UNUM_NEGATIVE_PREFIX,
1105 UNUM_NEGATIVE_SUFFIX,
1107 UNUM_PADDING_CHARACTER,
1109 UNUM_CURRENCY_CODE,
1118 UNUM_DEFAULT_RULESET,
1127 UNUM_PUBLIC_RULESETS
1128 } UNumberFormatTextAttribute;
1129
1148 U_STABLE int32_t U_EXPORT2
1149 unum_getTextAttribute( const UNumberFormat* fmt,
1150 UNumberFormatTextAttribute tag,
1151 UChar* result,
1152 int32_t resultLength,
1153 UErrorCode* status);
1154
1171 U_STABLE void U_EXPORT2
1172 unum_setTextAttribute( UNumberFormat* fmt,
1173 UNumberFormatTextAttribute tag,
1174 const UChar* newValue,
1175 int32_t newValueLength,
1176 UErrorCode *status);
1177
1194 U_STABLE int32_t U_EXPORT2
1195 unum_toPattern( const UNumberFormat* fmt,
1196 UBool isPatternLocalized,
1197 UChar* result,
1198 int32_t resultLength,
1199 UErrorCode* status);
1200
1201
1206 typedef enum UNumberFormatSymbol {
1208 UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
1210 UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
1212 UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
1214 UNUM_PERCENT_SYMBOL = 3,
1216 UNUM_ZERO_DIGIT_SYMBOL = 4,
1218 UNUM_DIGIT_SYMBOL = 5,
1220 UNUM_MINUS_SIGN_SYMBOL = 6,
1222 UNUM_PLUS_SIGN_SYMBOL = 7,
1224 UNUM_CURRENCY_SYMBOL = 8,
1226 UNUM_INTL_CURRENCY_SYMBOL = 9,
1228 UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
1230 UNUM_EXPONENTIAL_SYMBOL = 11,
1232 UNUM_PERMILL_SYMBOL = 12,
1234 UNUM_PAD_ESCAPE_SYMBOL = 13,
1236 UNUM_INFINITY_SYMBOL = 14,
1238 UNUM_NAN_SYMBOL = 15,
1241 UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
1245 UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
1249 UNUM_ONE_DIGIT_SYMBOL = 18,
1253 UNUM_TWO_DIGIT_SYMBOL = 19,
1257 UNUM_THREE_DIGIT_SYMBOL = 20,
1261 UNUM_FOUR_DIGIT_SYMBOL = 21,
1265 UNUM_FIVE_DIGIT_SYMBOL = 22,
1269 UNUM_SIX_DIGIT_SYMBOL = 23,
1273 UNUM_SEVEN_DIGIT_SYMBOL = 24,
1277 UNUM_EIGHT_DIGIT_SYMBOL = 25,
1281 UNUM_NINE_DIGIT_SYMBOL = 26,
1282
1286 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27,
1287
1288 #ifndef U_HIDE_DEPRECATED_API
1289
1293 UNUM_FORMAT_SYMBOL_COUNT = 28
1294 #endif // U_HIDE_DEPRECATED_API
1295 } UNumberFormatSymbol;
1296
1313 U_STABLE int32_t U_EXPORT2
1314 unum_getSymbol(const UNumberFormat *fmt,
1315 UNumberFormatSymbol symbol,
1316 UChar *buffer,
1317 int32_t size,
1318 UErrorCode *status);
1319
1333 U_STABLE void U_EXPORT2
1334 unum_setSymbol(UNumberFormat *fmt,
1335 UNumberFormatSymbol symbol,
1336 const UChar *value,
1337 int32_t length,
1338 UErrorCode *status);
1339
1340
1350 U_STABLE const char* U_EXPORT2
1351 unum_getLocaleByType(const UNumberFormat *fmt,
1352 ULocDataLocaleType type,
1353 UErrorCode* status);
1354
1363 U_STABLE void U_EXPORT2
1364 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status);
1365
1375 U_STABLE UDisplayContext U_EXPORT2
1376 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1377
1378 #endif /* #if !UCONFIG_NO_FORMATTING */
1379
1380 #endif
UNUM_SHORT
Definition: unum.h:311
UNUM_DEFAULT
Default format.
Definition: unum.h:258
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:1269
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:269
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:1230
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
Definition: unum.h:1245
UNUM_FORMAT_STYLE_COUNT
One more than the highest normal UNumberFormatStyle value.
Definition: unum.h:251
UNUM_PERMILL_FIELD
Definition: unum.h:365
UNUM_NEGATIVE_PREFIX
Negative prefix.
Definition: unum.h:1103
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:194
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:160
UNUM_DECIMAL
Decimal format ("normal" style).
Definition: unum.h:151
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:1277
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:995
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:66
UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
Definition: unum.h:1241
UNUM_NINE_DIGIT_SYMBOL
Nine.
Definition: unum.h:1281
UNUM_CURRENCY_STANDARD
Currency format with a currency symbol, e.g., "$1.00", using non-accounting style for negative values...
Definition: unum.h:244
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:199
UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
Definition: unum.h:940
UNUM_EXPONENT_FIELD
Definition: unum.h:357
UNUM_EXPONENT_SYMBOL_FIELD
Definition: unum.h:353
UNUM_FIVE_DIGIT_SYMBOL
Five.
Definition: unum.h:1265
UNUM_DECIMAL_COMPACT_SHORT
Decimal format expressed using compact notation (short form, corresponds to UNumberCompactStyle=UNUM_...
Definition: unum.h:230
UNUM_INTEGER_FIELD
Definition: unum.h:347
UCurrencySpacing
UCurrencySpacing
Constants for specifying currency spacing.
Definition: unum.h:321
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:292
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:1210
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:1010
UNUM_INTEGER_DIGITS
Integer digits.
Definition: unum.h:907
UNUM_FRACTION_DIGITS
Fraction digits.
Definition: unum.h:913
UNumberFormatSymbol
UNumberFormatSymbol
Constants for specifying a number format symbol.
Definition: unum.h:1206
UNUM_FOUND_HALFEVEN
Half-even rounding, misspelled name.
Definition: unum.h:284
UNUM_POSITIVE_PREFIX
Positive prefix.
Definition: unum.h:1099
UNUM_CURRENCY_CODE
The ISO currency code.
Definition: unum.h:1109
UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
Definition: unum.h:1286
udisplaycontext.h
C API: Display context types (enum values)
UNUM_MINUS_SIGN_SYMBOL
The minus sign.
Definition: unum.h:1220
UNUM_NAN_SYMBOL
Nan symbol.
Definition: unum.h:1238
UNUM_LONG
Definition: unum.h:313
UNUM_CURRENCY_ISO
Currency format with an ISO currency code, e.g., "USD1.00".
Definition: unum.h:204
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:223
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:146
UNUM_SIGNIFICANT_DIGITS_USED
Use significant digits.
Definition: unum.h:930
UNUM_PERCENT
Percent format.
Definition: unum.h:165
UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition: unum.h:278
UNUM_DECIMAL_SEPARATOR_FIELD
Definition: unum.h:351
UNUM_PADDING_POSITION
The position at which padding will take place.
Definition: unum.h:925
UNUM_EXPONENT_SIGN_FIELD
Definition: unum.h:355
UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
Definition: unum.h:237
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:177
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:141
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:1214
UNUM_INFINITY_SYMBOL
Infinity symbol.
Definition: unum.h:1236
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:530
UNUM_CURRENCY_SURROUNDING_MATCH
Definition: unum.h:325
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:136
UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
Definition: unum.h:911
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
UNUM_SEVEN_DIGIT_SYMBOL
Seven.
Definition: unum.h:1273
UNUM_ZERO_DIGIT_SYMBOL
Zero.
Definition: unum.h:1216
UNumberFormatFields
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
Definition: unum.h:345
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:936
UNUM_CURRENCY_PLURAL
Currency format with a pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars"...
Definition: unum.h:210
UNUM_FORMAT_SYMBOL_COUNT
One more than the highest normal UNumberFormatSymbol value.
Definition: unum.h:1293
UNUM_PARSE_INT_ONLY
Parse integers only.
Definition: unum.h:897
UNUM_FRACTION_FIELD
Definition: unum.h:349
UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
Definition: unum.h:957
UNumberFormatTextAttribute
UNumberFormatTextAttribute
The possible UNumberFormat text attributes.
Definition: unum.h:1097
UNUM_CURRENCY_MATCH
Definition: unum.h:323
UNUM_CURRENCY_FIELD
Definition: unum.h:361
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:909
UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
Definition: unum.h:927
UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
Definition: unum.h:923
UNUM_IGNORE
Alias for UNUM_PATTERN_DECIMAL.
Definition: unum.h:263
LocalUNumberFormatPointer
"Smart pointer" class, closes a UNumberFormat via unum_close().
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition: unum.h:981
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:298
UNUM_PERMILL_SYMBOL
Per mill symbol.
Definition: unum.h:1232
UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
Definition: unum.h:1212
UNUM_CURRENCY_INSERT
Definition: unum.h:327
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:170
UNUM_GROUPING_USED
Use grouping separator.
Definition: unum.h:899
UNUM_MINIMUM_GROUPING_DIGITS
Minimum grouping digits, technology preview.
Definition: unum.h:965
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:367
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:988
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:337
UNUM_POSITIVE_SUFFIX
Positive suffix.
Definition: unum.h:1101
UNUM_ONE_DIGIT_SYMBOL
One.
Definition: unum.h:1249
UNUM_MULTIPLIER
Multiplier.
Definition: unum.h:915
UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
Definition: unum.h:905
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:309
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:184
UNUM_PAD_ESCAPE_SYMBOL
Escape padding character.
Definition: unum.h:1234
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:1107
UNUM_PERCENT_FIELD
Definition: unum.h:363
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:1005
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:1253
UNUM_ROUNDING_MODE
Rounding Mode.
Definition: unum.h:919
UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
Definition: unum.h:1208
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:217
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:1261
UNUM_ROUNDING_INCREMENT
Rounding increment.
Definition: unum.h:921
UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
Definition: unum.h:933
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:1226
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:1118
UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
Definition: unum.h:1228
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:975
UNUM_CURRENCY_SYMBOL
The currency symbol.
Definition: unum.h:1224
UNUM_PLUS_SIGN_SYMBOL
The plus sign.
Definition: unum.h:1222
UNUM_DURATION
Duration rule-based format.
Definition: unum.h:189
UNUM_GROUPING_SEPARATOR_FIELD
Definition: unum.h:359
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:895
unum_close
void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UNUM_NEGATIVE_SUFFIX
Negative suffix.
Definition: unum.h:1105
UNUM_FIELD_COUNT
One more than the highest normal UNumberFormatFields value.
Definition: unum.h:373
UNUM_GROUPING_SIZE
Grouping size.
Definition: unum.h:917
UNUM_CURRENCY_SPACING_COUNT
One more than the highest normal UCurrencySpacing value.
Definition: unum.h:335
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:1127
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:134
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259
UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
Definition: unum.h:903
UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
Definition: unum.h:1218
uloc.h
C API: Locale.
UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
Definition: unum.h:901
UNUM_THREE_DIGIT_SYMBOL
Three.
Definition: unum.h:1257
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.