ICU 56.1: unum.h Source File

ICU 56.1 56.1

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

- File List
- Globals

unum.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 1997-2015, International Business Machines Corporation and others.
4 * All Rights Reserved.
5 * Modification History:
6 *
7 * Date Name Description
8 * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes
9 *******************************************************************************
10 */
11
12 #ifndef _UNUM
13 #define _UNUM
14
15 #include "unicode/utypes.h"
16
17 #if !UCONFIG_NO_FORMATTING
18
19 #include "unicode/localpointer.h"
20 #include "unicode/uloc.h"
21 #include "unicode/ucurr.h"
22 #include "unicode/umisc.h"
23 #include "unicode/parseerr.h"
24 #include "unicode/uformattable.h"
25 #include "unicode/udisplaycontext.h"
26
134 typedef void* UNumberFormat;
135
139 typedef enum UNumberFormatStyle {
144 UNUM_PATTERN_DECIMAL=0,
149 UNUM_DECIMAL=1,
158 UNUM_CURRENCY=2,
163 UNUM_PERCENT=3,
168 UNUM_SCIENTIFIC=4,
175 UNUM_SPELLOUT=5,
182 UNUM_ORDINAL=6,
187 UNUM_DURATION=7,
192 UNUM_NUMBERING_SYSTEM=8,
197 UNUM_PATTERN_RULEBASED=9,
202 UNUM_CURRENCY_ISO=10,
208 UNUM_CURRENCY_PLURAL=11,
215 UNUM_CURRENCY_ACCOUNTING=12,
221 UNUM_CASH_CURRENCY=13,
222 #ifndef U_HIDE_DRAFT_API
223
229 UNUM_DECIMAL_COMPACT_SHORT=14,
236 UNUM_DECIMAL_COMPACT_LONG=15,
243 UNUM_CURRENCY_STANDARD=16,
244 #endif /* U_HIDE_DRAFT_API */
245
250 UNUM_FORMAT_STYLE_COUNT=17,
251
256 UNUM_DEFAULT = UNUM_DECIMAL,
261 UNUM_IGNORE = UNUM_PATTERN_DECIMAL
262 } UNumberFormatStyle;
263
267 typedef enum UNumberFormatRoundingMode {
268 UNUM_ROUND_CEILING,
269 UNUM_ROUND_FLOOR,
270 UNUM_ROUND_DOWN,
271 UNUM_ROUND_UP,
276 UNUM_ROUND_HALFEVEN,
277 #ifndef U_HIDE_DEPRECATED_API
278
282 UNUM_FOUND_HALFEVEN = UNUM_ROUND_HALFEVEN,
283 #endif /* U_HIDE_DEPRECATED_API */
284 UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
285 UNUM_ROUND_HALFUP,
290 UNUM_ROUND_UNNECESSARY
291 } UNumberFormatRoundingMode;
292
296 typedef enum UNumberFormatPadPosition {
297 UNUM_PAD_BEFORE_PREFIX,
298 UNUM_PAD_AFTER_PREFIX,
299 UNUM_PAD_BEFORE_SUFFIX,
300 UNUM_PAD_AFTER_SUFFIX
301 } UNumberFormatPadPosition;
302
307 typedef enum UNumberCompactStyle {
309 UNUM_SHORT,
311 UNUM_LONG
313 } UNumberCompactStyle;
314
319 enum UCurrencySpacing {
321 UNUM_CURRENCY_MATCH,
323 UNUM_CURRENCY_SURROUNDING_MATCH,
325 UNUM_CURRENCY_INSERT,
327 UNUM_CURRENCY_SPACING_COUNT
328 };
329 typedef enum UCurrencySpacing UCurrencySpacing;
337 typedef enum UNumberFormatFields {
339 UNUM_INTEGER_FIELD,
341 UNUM_FRACTION_FIELD,
343 UNUM_DECIMAL_SEPARATOR_FIELD,
345 UNUM_EXPONENT_SYMBOL_FIELD,
347 UNUM_EXPONENT_SIGN_FIELD,
349 UNUM_EXPONENT_FIELD,
351 UNUM_GROUPING_SEPARATOR_FIELD,
353 UNUM_CURRENCY_FIELD,
355 UNUM_PERCENT_FIELD,
357 UNUM_PERMILL_FIELD,
359 UNUM_SIGN_FIELD,
361 UNUM_FIELD_COUNT
362 } UNumberFormatFields;
363
364
398 U_STABLE UNumberFormat* U_EXPORT2
399 unum_open( UNumberFormatStyle style,
400 const UChar* pattern,
401 int32_t patternLength,
402 const char* locale,
403 UParseError* parseErr,
404 UErrorCode* status);
405
406
413 U_STABLE void U_EXPORT2
414 unum_close(UNumberFormat* fmt);
415
416 #if U_SHOW_CPLUSPLUS_API
417
418 U_NAMESPACE_BEGIN
419
429 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
430
431 U_NAMESPACE_END
432
433 #endif
434
443 U_STABLE UNumberFormat* U_EXPORT2
444 unum_clone(const UNumberFormat *fmt,
445 UErrorCode *status);
446
471 U_STABLE int32_t U_EXPORT2
472 unum_format( const UNumberFormat* fmt,
473 int32_t number,
474 UChar* result,
475 int32_t resultLength,
476 UFieldPosition *pos,
477 UErrorCode* status);
478
503 U_STABLE int32_t U_EXPORT2
504 unum_formatInt64(const UNumberFormat *fmt,
505 int64_t number,
506 UChar* result,
507 int32_t resultLength,
508 UFieldPosition *pos,
509 UErrorCode* status);
510
535 U_STABLE int32_t U_EXPORT2
536 unum_formatDouble( const UNumberFormat* fmt,
537 double number,
538 UChar* result,
539 int32_t resultLength,
540 UFieldPosition *pos, /* 0 if ignore */
541 UErrorCode* status);
542
571 U_STABLE int32_t U_EXPORT2
572 unum_formatDecimal( const UNumberFormat* fmt,
573 const char * number,
574 int32_t length,
575 UChar* result,
576 int32_t resultLength,
577 UFieldPosition *pos, /* 0 if ignore */
578 UErrorCode* status);
579
604 U_STABLE int32_t U_EXPORT2
605 unum_formatDoubleCurrency(const UNumberFormat* fmt,
606 double number,
607 UChar* currency,
608 UChar* result,
609 int32_t resultLength,
610 UFieldPosition* pos,
611 UErrorCode* status);
612
633 U_STABLE int32_t U_EXPORT2
634 unum_formatUFormattable(const UNumberFormat* fmt,
635 const UFormattable *number,
636 UChar *result,
637 int32_t resultLength,
638 UFieldPosition *pos,
639 UErrorCode *status);
640
660 U_STABLE int32_t U_EXPORT2
661 unum_parse( const UNumberFormat* fmt,
662 const UChar* text,
663 int32_t textLength,
664 int32_t *parsePos /* 0 = start */,
665 UErrorCode *status);
666
686 U_STABLE int64_t U_EXPORT2
687 unum_parseInt64(const UNumberFormat* fmt,
688 const UChar* text,
689 int32_t textLength,
690 int32_t *parsePos /* 0 = start */,
691 UErrorCode *status);
692
712 U_STABLE double U_EXPORT2
713 unum_parseDouble( const UNumberFormat* fmt,
714 const UChar* text,
715 int32_t textLength,
716 int32_t *parsePos /* 0 = start */,
717 UErrorCode *status);
718
719
747 U_STABLE int32_t U_EXPORT2
748 unum_parseDecimal(const UNumberFormat* fmt,
749 const UChar* text,
750 int32_t textLength,
751 int32_t *parsePos /* 0 = start */,
752 char *outBuf,
753 int32_t outBufLength,
754 UErrorCode *status);
755
775 U_STABLE double U_EXPORT2
776 unum_parseDoubleCurrency(const UNumberFormat* fmt,
777 const UChar* text,
778 int32_t textLength,
779 int32_t* parsePos, /* 0 = start */
780 UChar* currency,
781 UErrorCode* status);
782
803 U_STABLE UFormattable* U_EXPORT2
804 unum_parseToUFormattable(const UNumberFormat* fmt,
805 UFormattable *result,
806 const UChar* text,
807 int32_t textLength,
808 int32_t* parsePos, /* 0 = start */
809 UErrorCode* status);
810
827 U_STABLE void U_EXPORT2
828 unum_applyPattern( UNumberFormat *format,
829 UBool localized,
830 const UChar *pattern,
831 int32_t patternLength,
832 UParseError *parseError,
833 UErrorCode *status
834 );
835
846 U_STABLE const char* U_EXPORT2
847 unum_getAvailable(int32_t localeIndex);
848
858 U_STABLE int32_t U_EXPORT2
859 unum_countAvailable(void);
860
861 #if UCONFIG_HAVE_PARSEALLINPUT
862 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
866 typedef enum UNumberFormatAttributeValue {
867 #ifndef U_HIDE_INTERNAL_API
868
869 UNUM_NO = 0,
871 UNUM_YES = 1,
873 UNUM_MAYBE = 2
874 #else
875
876 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
877 #endif /* U_HIDE_INTERNAL_API */
878 } UNumberFormatAttributeValue;
879 #endif
880
882 typedef enum UNumberFormatAttribute {
884 UNUM_PARSE_INT_ONLY,
886 UNUM_GROUPING_USED,
888 UNUM_DECIMAL_ALWAYS_SHOWN,
890 UNUM_MAX_INTEGER_DIGITS,
892 UNUM_MIN_INTEGER_DIGITS,
894 UNUM_INTEGER_DIGITS,
896 UNUM_MAX_FRACTION_DIGITS,
898 UNUM_MIN_FRACTION_DIGITS,
900 UNUM_FRACTION_DIGITS,
902 UNUM_MULTIPLIER,
904 UNUM_GROUPING_SIZE,
906 UNUM_ROUNDING_MODE,
908 UNUM_ROUNDING_INCREMENT,
910 UNUM_FORMAT_WIDTH,
912 UNUM_PADDING_POSITION,
914 UNUM_SECONDARY_GROUPING_SIZE,
917 UNUM_SIGNIFICANT_DIGITS_USED,
920 UNUM_MIN_SIGNIFICANT_DIGITS,
923 UNUM_MAX_SIGNIFICANT_DIGITS,
927 UNUM_LENIENT_PARSE,
928 #if UCONFIG_HAVE_PARSEALLINPUT
929
933 UNUM_PARSE_ALL_INPUT = 20,
934 #endif
935
944 UNUM_SCALE = 21,
945 #ifndef U_HIDE_INTERNAL_API
946
952 UNUM_MINIMUM_GROUPING_DIGITS = 22,
953 /* TODO: test C API when it becomes @draft */
954 #endif /* U_HIDE_INTERNAL_API */
955
962 UNUM_CURRENCY_USAGE = 23,
963
964 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
968 UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
969
975 UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
982 UNUM_PARSE_NO_EXPONENT,
983
992 UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
993
994 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
997 UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003
998 } UNumberFormatAttribute;
999
1017 U_STABLE int32_t U_EXPORT2
1018 unum_getAttribute(const UNumberFormat* fmt,
1019 UNumberFormatAttribute attr);
1020
1040 U_STABLE void U_EXPORT2
1041 unum_setAttribute( UNumberFormat* fmt,
1042 UNumberFormatAttribute attr,
1043 int32_t newValue);
1044
1045
1060 U_STABLE double U_EXPORT2
1061 unum_getDoubleAttribute(const UNumberFormat* fmt,
1062 UNumberFormatAttribute attr);
1063
1078 U_STABLE void U_EXPORT2
1079 unum_setDoubleAttribute( UNumberFormat* fmt,
1080 UNumberFormatAttribute attr,
1081 double newValue);
1082
1084 typedef enum UNumberFormatTextAttribute {
1086 UNUM_POSITIVE_PREFIX,
1088 UNUM_POSITIVE_SUFFIX,
1090 UNUM_NEGATIVE_PREFIX,
1092 UNUM_NEGATIVE_SUFFIX,
1094 UNUM_PADDING_CHARACTER,
1096 UNUM_CURRENCY_CODE,
1105 UNUM_DEFAULT_RULESET,
1114 UNUM_PUBLIC_RULESETS
1115 } UNumberFormatTextAttribute;
1116
1135 U_STABLE int32_t U_EXPORT2
1136 unum_getTextAttribute( const UNumberFormat* fmt,
1137 UNumberFormatTextAttribute tag,
1138 UChar* result,
1139 int32_t resultLength,
1140 UErrorCode* status);
1141
1158 U_STABLE void U_EXPORT2
1159 unum_setTextAttribute( UNumberFormat* fmt,
1160 UNumberFormatTextAttribute tag,
1161 const UChar* newValue,
1162 int32_t newValueLength,
1163 UErrorCode *status);
1164
1181 U_STABLE int32_t U_EXPORT2
1182 unum_toPattern( const UNumberFormat* fmt,
1183 UBool isPatternLocalized,
1184 UChar* result,
1185 int32_t resultLength,
1186 UErrorCode* status);
1187
1188
1193 typedef enum UNumberFormatSymbol {
1195 UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
1197 UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
1199 UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
1201 UNUM_PERCENT_SYMBOL = 3,
1203 UNUM_ZERO_DIGIT_SYMBOL = 4,
1205 UNUM_DIGIT_SYMBOL = 5,
1207 UNUM_MINUS_SIGN_SYMBOL = 6,
1209 UNUM_PLUS_SIGN_SYMBOL = 7,
1211 UNUM_CURRENCY_SYMBOL = 8,
1213 UNUM_INTL_CURRENCY_SYMBOL = 9,
1215 UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
1217 UNUM_EXPONENTIAL_SYMBOL = 11,
1219 UNUM_PERMILL_SYMBOL = 12,
1221 UNUM_PAD_ESCAPE_SYMBOL = 13,
1223 UNUM_INFINITY_SYMBOL = 14,
1225 UNUM_NAN_SYMBOL = 15,
1228 UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
1232 UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
1236 UNUM_ONE_DIGIT_SYMBOL = 18,
1240 UNUM_TWO_DIGIT_SYMBOL = 19,
1244 UNUM_THREE_DIGIT_SYMBOL = 20,
1248 UNUM_FOUR_DIGIT_SYMBOL = 21,
1252 UNUM_FIVE_DIGIT_SYMBOL = 22,
1256 UNUM_SIX_DIGIT_SYMBOL = 23,
1260 UNUM_SEVEN_DIGIT_SYMBOL = 24,
1264 UNUM_EIGHT_DIGIT_SYMBOL = 25,
1268 UNUM_NINE_DIGIT_SYMBOL = 26,
1269
1273 UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27,
1274
1276 UNUM_FORMAT_SYMBOL_COUNT = 28
1277 } UNumberFormatSymbol;
1278
1295 U_STABLE int32_t U_EXPORT2
1296 unum_getSymbol(const UNumberFormat *fmt,
1297 UNumberFormatSymbol symbol,
1298 UChar *buffer,
1299 int32_t size,
1300 UErrorCode *status);
1301
1315 U_STABLE void U_EXPORT2
1316 unum_setSymbol(UNumberFormat *fmt,
1317 UNumberFormatSymbol symbol,
1318 const UChar *value,
1319 int32_t length,
1320 UErrorCode *status);
1321
1322
1332 U_STABLE const char* U_EXPORT2
1333 unum_getLocaleByType(const UNumberFormat *fmt,
1334 ULocDataLocaleType type,
1335 UErrorCode* status);
1336
1345 U_STABLE void U_EXPORT2
1346 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status);
1347
1357 U_STABLE UDisplayContext U_EXPORT2
1358 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1359
1360 #endif /* #if !UCONFIG_NO_FORMATTING */
1361
1362 #endif
UNUM_SHORT
Definition: unum.h:309
UNUM_DEFAULT
Default format.
Definition: unum.h:256
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:1256
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:267
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:1217
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
Definition: unum.h:1232
UNUM_FORMAT_STYLE_COUNT
One more than the highest number format style constant.
Definition: unum.h:250
UNUM_PERMILL_FIELD
Definition: unum.h:357
UNUM_NEGATIVE_PREFIX
Negative prefix.
Definition: unum.h:1090
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:192
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:158
UNUM_DECIMAL
Decimal format ("normal" style).
Definition: unum.h:149
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:1264
UNUM_PARSE_NO_EXPONENT
if this attribute is set to 1, specifies that, if the pattern doesn't contain an exponent, the exponent will not be parsed.
Definition: unum.h:982
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:56
UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
Definition: unum.h:1228
UNUM_NINE_DIGIT_SYMBOL
Nine.
Definition: unum.h:1268
UNUM_CURRENCY_STANDARD
Currency format with a currency symbol, e.g., "$1.00", using non-accounting style for negative values...
Definition: unum.h:243
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:197
UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
Definition: unum.h:927
UNUM_EXPONENT_FIELD
Definition: unum.h:349
UNUM_EXPONENT_SYMBOL_FIELD
Definition: unum.h:345
UNUM_FIVE_DIGIT_SYMBOL
Five.
Definition: unum.h:1252
UNUM_DECIMAL_COMPACT_SHORT
Decimal format expressed using compact notation (short form, corresponds to UNumberCompactStyle=UNUM_...
Definition: unum.h:229
UNUM_INTEGER_FIELD
Definition: unum.h:339
UCurrencySpacing
UCurrencySpacing
Constants for specifying currency spacing.
Definition: unum.h:319
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:290
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:1197
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:997
UNUM_INTEGER_DIGITS
Integer digits.
Definition: unum.h:894
UNUM_FRACTION_DIGITS
Fraction digits.
Definition: unum.h:900
UNumberFormatSymbol
UNumberFormatSymbol
Constants for specifying a number format symbol.
Definition: unum.h:1193
UNUM_FOUND_HALFEVEN
Half-even rounding, misspelled name.
Definition: unum.h:282
UNUM_POSITIVE_PREFIX
Positive prefix.
Definition: unum.h:1086
UNUM_CURRENCY_CODE
The ISO currency code.
Definition: unum.h:1096
UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
Definition: unum.h:1273
udisplaycontext.h
C API: Display context types (enum values)
UNUM_MINUS_SIGN_SYMBOL
The minus sign.
Definition: unum.h:1207
UNUM_NAN_SYMBOL
Nan symbol.
Definition: unum.h:1225
UNUM_LONG
Definition: unum.h:311
UNUM_CURRENCY_ISO
Currency format with an ISO currency code, e.g., "USD1.00".
Definition: unum.h:202
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:221
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:144
UNUM_SIGNIFICANT_DIGITS_USED
Use significant digits.
Definition: unum.h:917
UNUM_PERCENT
Percent format.
Definition: unum.h:163
UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition: unum.h:276
UNUM_DECIMAL_SEPARATOR_FIELD
Definition: unum.h:343
UNUM_PADDING_POSITION
The position at which padding will take place.
Definition: unum.h:912
UNUM_EXPONENT_SIGN_FIELD
Definition: unum.h:347
UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
Definition: unum.h:236
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
UNUM_SPELLOUT
Spellout rule-based format.
Definition: unum.h:175
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:139
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:1201
UNUM_INFINITY_SYMBOL
Infinity symbol.
Definition: unum.h:1223
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:535
UNUM_CURRENCY_SURROUNDING_MATCH
Definition: unum.h:323
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:134
UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
Definition: unum.h:898
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:32
UNUM_SEVEN_DIGIT_SYMBOL
Seven.
Definition: unum.h:1260
UNUM_ZERO_DIGIT_SYMBOL
Zero.
Definition: unum.h:1203
UNumberFormatFields
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
Definition: unum.h:337
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:923
UNUM_CURRENCY_PLURAL
Currency format with a pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars"...
Definition: unum.h:208
UNUM_FORMAT_SYMBOL_COUNT
count symbol constants
Definition: unum.h:1276
UNUM_PARSE_INT_ONLY
Parse integers only.
Definition: unum.h:884
UNUM_FRACTION_FIELD
Definition: unum.h:341
UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
Definition: unum.h:944
UNumberFormatTextAttribute
UNumberFormatTextAttribute
The possible UNumberFormat text attributes.
Definition: unum.h:1084
UNUM_CURRENCY_MATCH
Definition: unum.h:321
UNUM_CURRENCY_FIELD
Definition: unum.h:353
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:896
UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
Definition: unum.h:914
UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
Definition: unum.h:910
UNUM_IGNORE
Alias for UNUM_PATTERN_DECIMAL.
Definition: unum.h:261
LocalUNumberFormatPointer
"Smart pointer" class, closes a UNumberFormat via unum_close().
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition: unum.h:968
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:296
UNUM_PERMILL_SYMBOL
Per mill symbol.
Definition: unum.h:1219
UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
Definition: unum.h:1199
UNUM_CURRENCY_INSERT
Definition: unum.h:325
unum_getContext
UDisplayContext unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode *status)
Get the formatter's UDisplayContext value for the specified UDisplayContextType, such as UDISPCTX_TYP...
UNUM_SCIENTIFIC
Scientific format.
Definition: unum.h:168
UNUM_GROUPING_USED
Use grouping separator.
Definition: unum.h:886
UNUM_MINIMUM_GROUPING_DIGITS
Minimum grouping digits, technology preview.
Definition: unum.h:952
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:359
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:975
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:312
UNUM_POSITIVE_SUFFIX
Positive suffix.
Definition: unum.h:1088
UNUM_ONE_DIGIT_SYMBOL
One.
Definition: unum.h:1236
UNUM_MULTIPLIER
Multiplier.
Definition: unum.h:902
UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
Definition: unum.h:892
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:130
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:307
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:25
UNUM_ORDINAL
Ordinal rule-based format .
Definition: unum.h:182
UNUM_PAD_ESCAPE_SYMBOL
Escape padding character.
Definition: unum.h:1221
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:1094
UNUM_PERCENT_FIELD
Definition: unum.h:355
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:992
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:1240
UNUM_ROUNDING_MODE
Rounding Mode.
Definition: unum.h:906
UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
Definition: unum.h:1195
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:336
UNUM_CURRENCY_ACCOUNTING
Currency format for accounting, e.g., "($3.00)" for negative currency amount instead of "-$3...
Definition: unum.h:215
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:1248
UNUM_ROUNDING_INCREMENT
Rounding increment.
Definition: unum.h:908
UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
Definition: unum.h:920
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:56
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:1213
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:1105
UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
Definition: unum.h:1215
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:962
UNUM_CURRENCY_SYMBOL
The currency symbol.
Definition: unum.h:1211
UNUM_PLUS_SIGN_SYMBOL
The plus sign.
Definition: unum.h:1209
UNUM_DURATION
Duration rule-based format.
Definition: unum.h:187
UNUM_GROUPING_SEPARATOR_FIELD
Definition: unum.h:351
UFormattable
void * UFormattable
Opaque type representing various types of data which may be used for formatting and parsing operation...
Definition: uformattable.h:62
UNumberFormatAttribute
UNumberFormatAttribute
The possible UNumberFormat numeric attributes.
Definition: unum.h:882
unum_close
void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UNUM_NEGATIVE_SUFFIX
Negative suffix.
Definition: unum.h:1092
UNUM_FIELD_COUNT
Definition: unum.h:361
UNUM_GROUPING_SIZE
Grouping size.
Definition: unum.h:904
UNUM_CURRENCY_SPACING_COUNT
Definition: unum.h:327
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:1114
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
Definition: unum.h:890
UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
Definition: unum.h:1205
uloc.h
C API: Locale.
UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
Definition: unum.h:888
UNUM_THREE_DIGIT_SYMBOL
Three.
Definition: unum.h:1244
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.