ICU 54.1
54.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
i18n
unicode
unum.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************
3
* Copyright (C) 1997-2014, 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,
154
UNUM_CURRENCY
=2,
159
UNUM_PERCENT
=3,
164
UNUM_SCIENTIFIC
=4,
171
UNUM_SPELLOUT
=5,
178
UNUM_ORDINAL
=6,
183
UNUM_DURATION
=7,
188
UNUM_NUMBERING_SYSTEM
=8,
193
UNUM_PATTERN_RULEBASED
=9,
198
UNUM_CURRENCY_ISO
=10,
204
UNUM_CURRENCY_PLURAL
=11,
205
#ifndef U_HIDE_DRAFT_API
206
211
UNUM_CURRENCY_ACCOUNTING
=12,
217
UNUM_CASH_CURRENCY
=13,
218
#endif
/* U_HIDE_DRAFT_API */
219
224
UNUM_FORMAT_STYLE_COUNT
=14,
225
230
UNUM_DEFAULT
=
UNUM_DECIMAL
,
235
UNUM_IGNORE
=
UNUM_PATTERN_DECIMAL
236
}
UNumberFormatStyle
;
237
241
typedef
enum
UNumberFormatRoundingMode
{
242
UNUM_ROUND_CEILING,
243
UNUM_ROUND_FLOOR,
244
UNUM_ROUND_DOWN,
245
UNUM_ROUND_UP,
250
UNUM_ROUND_HALFEVEN
,
251
#ifndef U_HIDE_DEPRECATED_API
252
256
UNUM_FOUND_HALFEVEN
=
UNUM_ROUND_HALFEVEN
,
257
#endif
/* U_HIDE_DEPRECATED_API */
258
UNUM_ROUND_HALFDOWN =
UNUM_ROUND_HALFEVEN
+ 1,
259
UNUM_ROUND_HALFUP,
264
UNUM_ROUND_UNNECESSARY
265
}
UNumberFormatRoundingMode
;
266
270
typedef
enum
UNumberFormatPadPosition
{
271
UNUM_PAD_BEFORE_PREFIX,
272
UNUM_PAD_AFTER_PREFIX,
273
UNUM_PAD_BEFORE_SUFFIX,
274
UNUM_PAD_AFTER_SUFFIX
275
}
UNumberFormatPadPosition
;
276
281
typedef
enum
UNumberCompactStyle
{
283
UNUM_SHORT
,
285
UNUM_LONG
287
}
UNumberCompactStyle
;
288
293
enum
UCurrencySpacing
{
295
UNUM_CURRENCY_MATCH
,
297
UNUM_CURRENCY_SURROUNDING_MATCH
,
299
UNUM_CURRENCY_INSERT
,
301
UNUM_CURRENCY_SPACING_COUNT
302
};
303
typedef
enum
UCurrencySpacing
UCurrencySpacing
;
311
typedef
enum
UNumberFormatFields
{
313
UNUM_INTEGER_FIELD
,
315
UNUM_FRACTION_FIELD
,
317
UNUM_DECIMAL_SEPARATOR_FIELD
,
319
UNUM_EXPONENT_SYMBOL_FIELD
,
321
UNUM_EXPONENT_SIGN_FIELD
,
323
UNUM_EXPONENT_FIELD
,
325
UNUM_GROUPING_SEPARATOR_FIELD
,
327
UNUM_CURRENCY_FIELD
,
329
UNUM_PERCENT_FIELD
,
331
UNUM_PERMILL_FIELD
,
333
UNUM_SIGN_FIELD
,
335
UNUM_FIELD_COUNT
336
}
UNumberFormatFields
;
337
338
372
U_STABLE
UNumberFormat
* U_EXPORT2
373
unum_open
(
UNumberFormatStyle
style,
374
const
UChar
* pattern,
375
int32_t patternLength,
376
const
char
* locale,
377
UParseError
* parseErr,
378
UErrorCode
* status);
379
380
387
U_STABLE
void
U_EXPORT2
388
unum_close
(
UNumberFormat
* fmt);
389
390
#if U_SHOW_CPLUSPLUS_API
391
392
U_NAMESPACE_BEGIN
393
403
U_DEFINE_LOCAL_OPEN_POINTER
(
LocalUNumberFormatPointer
,
UNumberFormat
,
unum_close
);
404
405
U_NAMESPACE_END
406
407
#endif
408
417
U_STABLE
UNumberFormat
* U_EXPORT2
418
unum_clone
(
const
UNumberFormat
*fmt,
419
UErrorCode
*status);
420
445
U_STABLE
int32_t U_EXPORT2
446
unum_format
(
const
UNumberFormat
* fmt,
447
int32_t number,
448
UChar
* result,
449
int32_t resultLength,
450
UFieldPosition
*pos,
451
UErrorCode
* status);
452
477
U_STABLE
int32_t U_EXPORT2
478
unum_formatInt64
(
const
UNumberFormat
*fmt,
479
int64_t number,
480
UChar
* result,
481
int32_t resultLength,
482
UFieldPosition
*pos,
483
UErrorCode
* status);
484
509
U_STABLE
int32_t U_EXPORT2
510
unum_formatDouble
(
const
UNumberFormat
* fmt,
511
double
number,
512
UChar
* result,
513
int32_t resultLength,
514
UFieldPosition
*pos,
/* 0 if ignore */
515
UErrorCode
* status);
516
545
U_STABLE
int32_t U_EXPORT2
546
unum_formatDecimal
(
const
UNumberFormat
* fmt,
547
const
char
* number,
548
int32_t length,
549
UChar
* result,
550
int32_t resultLength,
551
UFieldPosition
*pos,
/* 0 if ignore */
552
UErrorCode
* status);
553
578
U_STABLE
int32_t U_EXPORT2
579
unum_formatDoubleCurrency
(
const
UNumberFormat
* fmt,
580
double
number,
581
UChar
* currency,
582
UChar
* result,
583
int32_t resultLength,
584
UFieldPosition
* pos,
585
UErrorCode
* status);
586
607
U_STABLE
int32_t U_EXPORT2
608
unum_formatUFormattable
(
const
UNumberFormat
* fmt,
609
const
UFormattable
*number,
610
UChar
*result,
611
int32_t resultLength,
612
UFieldPosition
*pos,
613
UErrorCode
*status);
614
632
U_STABLE
int32_t U_EXPORT2
633
unum_parse
(
const
UNumberFormat
* fmt,
634
const
UChar
* text,
635
int32_t textLength,
636
int32_t *parsePos
/* 0 = start */
,
637
UErrorCode
*status);
638
656
U_STABLE
int64_t U_EXPORT2
657
unum_parseInt64
(
const
UNumberFormat
* fmt,
658
const
UChar
* text,
659
int32_t textLength,
660
int32_t *parsePos
/* 0 = start */
,
661
UErrorCode
*status);
662
680
U_STABLE
double
U_EXPORT2
681
unum_parseDouble
(
const
UNumberFormat
* fmt,
682
const
UChar
* text,
683
int32_t textLength,
684
int32_t *parsePos
/* 0 = start */
,
685
UErrorCode
*status);
686
687
713
U_STABLE
int32_t U_EXPORT2
714
unum_parseDecimal
(
const
UNumberFormat
* fmt,
715
const
UChar
* text,
716
int32_t textLength,
717
int32_t *parsePos
/* 0 = start */
,
718
char
*outBuf,
719
int32_t outBufLength,
720
UErrorCode
*status);
721
741
U_STABLE
double
U_EXPORT2
742
unum_parseDoubleCurrency
(
const
UNumberFormat
* fmt,
743
const
UChar
* text,
744
int32_t textLength,
745
int32_t* parsePos,
/* 0 = start */
746
UChar
* currency,
747
UErrorCode
* status);
748
767
U_STABLE
UFormattable
* U_EXPORT2
768
unum_parseToUFormattable
(
const
UNumberFormat
* fmt,
769
UFormattable
*result,
770
const
UChar
* text,
771
int32_t textLength,
772
int32_t* parsePos,
/* 0 = start */
773
UErrorCode
* status);
774
791
U_STABLE
void
U_EXPORT2
792
unum_applyPattern
(
UNumberFormat
*format,
793
UBool
localized,
794
const
UChar
*pattern,
795
int32_t patternLength,
796
UParseError
*parseError,
797
UErrorCode
*status
798
);
799
810
U_STABLE
const
char
* U_EXPORT2
811
unum_getAvailable
(int32_t localeIndex);
812
822
U_STABLE
int32_t U_EXPORT2
823
unum_countAvailable
(
void
);
824
825
#if UCONFIG_HAVE_PARSEALLINPUT
826
/* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
830
typedef
enum
UNumberFormatAttributeValue {
831
#ifndef U_HIDE_INTERNAL_API
832
833
UNUM_NO = 0,
835
UNUM_YES = 1,
837
UNUM_MAYBE = 2
838
#endif
/* U_HIDE_INTERNAL_API */
839
} UNumberFormatAttributeValue;
840
#endif
841
843
typedef
enum
UNumberFormatAttribute
{
845
UNUM_PARSE_INT_ONLY
,
847
UNUM_GROUPING_USED
,
849
UNUM_DECIMAL_ALWAYS_SHOWN
,
851
UNUM_MAX_INTEGER_DIGITS
,
853
UNUM_MIN_INTEGER_DIGITS
,
855
UNUM_INTEGER_DIGITS
,
857
UNUM_MAX_FRACTION_DIGITS
,
859
UNUM_MIN_FRACTION_DIGITS
,
861
UNUM_FRACTION_DIGITS
,
863
UNUM_MULTIPLIER
,
865
UNUM_GROUPING_SIZE
,
867
UNUM_ROUNDING_MODE
,
869
UNUM_ROUNDING_INCREMENT
,
871
UNUM_FORMAT_WIDTH
,
873
UNUM_PADDING_POSITION
,
875
UNUM_SECONDARY_GROUPING_SIZE
,
878
UNUM_SIGNIFICANT_DIGITS_USED
,
881
UNUM_MIN_SIGNIFICANT_DIGITS
,
884
UNUM_MAX_SIGNIFICANT_DIGITS
,
888
UNUM_LENIENT_PARSE
,
889
#if UCONFIG_HAVE_PARSEALLINPUT
890
894
UNUM_PARSE_ALL_INPUT =
UNUM_LENIENT_PARSE
+ 1,
895
#endif
896
905
UNUM_SCALE
=
UNUM_LENIENT_PARSE
+ 2,
906
907
#ifndef U_HIDE_INTERNAL_API
908
910
UNUM_NUMERIC_ATTRIBUTE_COUNT
=
UNUM_LENIENT_PARSE
+ 3,
911
#endif
/* U_HIDE_INTERNAL_API */
912
913
#ifndef U_HIDE_DRAFT_API
914
920
UNUM_CURRENCY_USAGE
=
UNUM_LENIENT_PARSE
+ 4,
921
#endif
/* U_HIDE_DRAFT_API */
922
923
/* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
927
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
= 0x0FFF,
928
934
UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS
= 0x1000,
941
UNUM_PARSE_NO_EXPONENT
,
942
943
#ifndef U_HIDE_DRAFT_API
944
952
UNUM_PARSE_DECIMAL_MARK_REQUIRED
=
UNUM_PARSE_NO_EXPONENT
+1,
953
#endif
/* U_HIDE_DRAFT_API */
954
955
/* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
958
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
=
UNUM_PARSE_NO_EXPONENT
+2
959
}
UNumberFormatAttribute
;
960
978
U_STABLE
int32_t U_EXPORT2
979
unum_getAttribute
(
const
UNumberFormat
* fmt,
980
UNumberFormatAttribute
attr);
981
1001
U_STABLE
void
U_EXPORT2
1002
unum_setAttribute
(
UNumberFormat
* fmt,
1003
UNumberFormatAttribute
attr,
1004
int32_t newValue);
1005
1006
1021
U_STABLE
double
U_EXPORT2
1022
unum_getDoubleAttribute
(
const
UNumberFormat
* fmt,
1023
UNumberFormatAttribute
attr);
1024
1039
U_STABLE
void
U_EXPORT2
1040
unum_setDoubleAttribute
(
UNumberFormat
* fmt,
1041
UNumberFormatAttribute
attr,
1042
double
newValue);
1043
1045
typedef
enum
UNumberFormatTextAttribute
{
1047
UNUM_POSITIVE_PREFIX
,
1049
UNUM_POSITIVE_SUFFIX
,
1051
UNUM_NEGATIVE_PREFIX
,
1053
UNUM_NEGATIVE_SUFFIX
,
1055
UNUM_PADDING_CHARACTER
,
1057
UNUM_CURRENCY_CODE
,
1066
UNUM_DEFAULT_RULESET
,
1075
UNUM_PUBLIC_RULESETS
1076
}
UNumberFormatTextAttribute
;
1077
1096
U_STABLE
int32_t U_EXPORT2
1097
unum_getTextAttribute
(
const
UNumberFormat
* fmt,
1098
UNumberFormatTextAttribute
tag,
1099
UChar
* result,
1100
int32_t resultLength,
1101
UErrorCode
* status);
1102
1119
U_STABLE
void
U_EXPORT2
1120
unum_setTextAttribute
(
UNumberFormat
* fmt,
1121
UNumberFormatTextAttribute
tag,
1122
const
UChar
* newValue,
1123
int32_t newValueLength,
1124
UErrorCode
*status);
1125
1142
U_STABLE
int32_t U_EXPORT2
1143
unum_toPattern
(
const
UNumberFormat
* fmt,
1144
UBool
isPatternLocalized,
1145
UChar
* result,
1146
int32_t resultLength,
1147
UErrorCode
* status);
1148
1149
1154
typedef
enum
UNumberFormatSymbol
{
1156
UNUM_DECIMAL_SEPARATOR_SYMBOL
= 0,
1158
UNUM_GROUPING_SEPARATOR_SYMBOL
= 1,
1160
UNUM_PATTERN_SEPARATOR_SYMBOL
= 2,
1162
UNUM_PERCENT_SYMBOL
= 3,
1164
UNUM_ZERO_DIGIT_SYMBOL
= 4,
1166
UNUM_DIGIT_SYMBOL
= 5,
1168
UNUM_MINUS_SIGN_SYMBOL
= 6,
1170
UNUM_PLUS_SIGN_SYMBOL
= 7,
1172
UNUM_CURRENCY_SYMBOL
= 8,
1174
UNUM_INTL_CURRENCY_SYMBOL
= 9,
1176
UNUM_MONETARY_SEPARATOR_SYMBOL
= 10,
1178
UNUM_EXPONENTIAL_SYMBOL
= 11,
1180
UNUM_PERMILL_SYMBOL
= 12,
1182
UNUM_PAD_ESCAPE_SYMBOL
= 13,
1184
UNUM_INFINITY_SYMBOL
= 14,
1186
UNUM_NAN_SYMBOL
= 15,
1189
UNUM_SIGNIFICANT_DIGIT_SYMBOL
= 16,
1193
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
= 17,
1197
UNUM_ONE_DIGIT_SYMBOL
= 18,
1201
UNUM_TWO_DIGIT_SYMBOL
= 19,
1205
UNUM_THREE_DIGIT_SYMBOL
= 20,
1209
UNUM_FOUR_DIGIT_SYMBOL
= 21,
1213
UNUM_FIVE_DIGIT_SYMBOL
= 22,
1217
UNUM_SIX_DIGIT_SYMBOL
= 23,
1221
UNUM_SEVEN_DIGIT_SYMBOL
= 24,
1225
UNUM_EIGHT_DIGIT_SYMBOL
= 25,
1229
UNUM_NINE_DIGIT_SYMBOL
= 26,
1230
1231
#ifndef U_HIDE_DRAFT_API
1232
1235
UNUM_EXPONENT_MULTIPLICATION_SYMBOL
= 27,
1236
#endif
/* U_HIDE_DRAFT_API */
1237
1239
UNUM_FORMAT_SYMBOL_COUNT
= 28
1240
}
UNumberFormatSymbol
;
1241
1258
U_STABLE
int32_t U_EXPORT2
1259
unum_getSymbol
(
const
UNumberFormat
*fmt,
1260
UNumberFormatSymbol
symbol,
1261
UChar
*buffer,
1262
int32_t size,
1263
UErrorCode
*status);
1264
1278
U_STABLE
void
U_EXPORT2
1279
unum_setSymbol
(
UNumberFormat
*fmt,
1280
UNumberFormatSymbol
symbol,
1281
const
UChar
*value,
1282
int32_t length,
1283
UErrorCode
*status);
1284
1285
1295
U_STABLE
const
char
* U_EXPORT2
1296
unum_getLocaleByType
(
const
UNumberFormat
*fmt,
1297
ULocDataLocaleType
type,
1298
UErrorCode
* status);
1299
1300
#ifndef U_HIDE_DRAFT_API
1301
1309
U_DRAFT
void
U_EXPORT2
1310
unum_setContext
(
UNumberFormat
* fmt,
UDisplayContext
value,
UErrorCode
* status);
1311
1321
U_DRAFT
UDisplayContext
U_EXPORT2
1322
unum_getContext
(
const
UNumberFormat
*fmt,
UDisplayContextType
type,
UErrorCode
* status);
1323
1324
#endif
/* U_HIDE_DRAFT_API */
1325
1326
#endif
/* #if !UCONFIG_NO_FORMATTING */
1327
1328
#endif
Generated on Mon Sep 29 2014 13:32:06 for ICU 54.1 by
1.8.1.2