ICU 49.1.1
49.1.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
i18n
unicode
unum.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************
3
* Copyright (C) 1997-2012, 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/umisc.h
"
22
#include "
unicode/parseerr.h
"
130
typedef
void
*
UNumberFormat
;
131
135
typedef
enum
UNumberFormatStyle
{
140
UNUM_PATTERN_DECIMAL
=0,
145
UNUM_DECIMAL
=1,
150
UNUM_CURRENCY
,
155
UNUM_PERCENT
,
160
UNUM_SCIENTIFIC
,
165
UNUM_SPELLOUT
,
170
UNUM_ORDINAL
,
175
UNUM_DURATION
,
180
UNUM_NUMBERING_SYSTEM
,
185
UNUM_PATTERN_RULEBASED
,
190
UNUM_CURRENCY_ISO
,
196
UNUM_CURRENCY_PLURAL
,
201
UNUM_FORMAT_STYLE_COUNT
,
206
UNUM_DEFAULT
=
UNUM_DECIMAL
,
211
UNUM_IGNORE
=
UNUM_PATTERN_DECIMAL
212
}
UNumberFormatStyle
;
213
217
typedef
enum
UNumberFormatRoundingMode
{
218
UNUM_ROUND_CEILING,
219
UNUM_ROUND_FLOOR,
220
UNUM_ROUND_DOWN,
221
UNUM_ROUND_UP,
226
UNUM_ROUND_HALFEVEN
,
227
#ifndef U_HIDE_DEPRECATED_API
228
232
UNUM_FOUND_HALFEVEN
=
UNUM_ROUND_HALFEVEN
,
233
#endif
/* U_HIDE_DEPRECATED_API */
234
UNUM_ROUND_HALFDOWN,
235
UNUM_ROUND_HALFUP,
240
UNUM_ROUND_UNNECESSARY
241
}
UNumberFormatRoundingMode
;
242
246
typedef
enum
UNumberFormatPadPosition
{
247
UNUM_PAD_BEFORE_PREFIX,
248
UNUM_PAD_AFTER_PREFIX,
249
UNUM_PAD_BEFORE_SUFFIX,
250
UNUM_PAD_AFTER_SUFFIX
251
}
UNumberFormatPadPosition
;
252
257
enum
UCurrencySpacing
{
259
UNUM_CURRENCY_MATCH
,
261
UNUM_CURRENCY_SURROUNDING_MATCH
,
263
UNUM_CURRENCY_INSERT
,
265
UNUM_CURRENCY_SPACING_COUNT
266
};
267
typedef
enum
UCurrencySpacing
UCurrencySpacing
;
275
typedef
enum
UNumberFormatFields
{
277
UNUM_INTEGER_FIELD
,
279
UNUM_FRACTION_FIELD
,
281
UNUM_DECIMAL_SEPARATOR_FIELD
,
283
UNUM_EXPONENT_SYMBOL_FIELD
,
285
UNUM_EXPONENT_SIGN_FIELD
,
287
UNUM_EXPONENT_FIELD
,
289
UNUM_GROUPING_SEPARATOR_FIELD
,
291
UNUM_CURRENCY_FIELD
,
293
UNUM_PERCENT_FIELD
,
295
UNUM_PERMILL_FIELD
,
297
UNUM_SIGN_FIELD
,
299
UNUM_FIELD_COUNT
300
}
UNumberFormatFields
;
301
302
334
U_STABLE
UNumberFormat
* U_EXPORT2
335
unum_open
(
UNumberFormatStyle
style,
336
const
UChar
* pattern,
337
int32_t patternLength,
338
const
char
* locale,
339
UParseError
* parseErr,
340
UErrorCode
* status);
341
342
349
U_STABLE
void
U_EXPORT2
350
unum_close
(
UNumberFormat
* fmt);
351
352
#if U_SHOW_CPLUSPLUS_API
353
354
U_NAMESPACE_BEGIN
355
365
U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer,
UNumberFormat
,
unum_close
);
366
367
U_NAMESPACE_END
368
369
#endif
370
379
U_STABLE
UNumberFormat
* U_EXPORT2
380
unum_clone
(
const
UNumberFormat
*fmt,
381
UErrorCode
*status);
382
404
U_STABLE
int32_t U_EXPORT2
405
unum_format
(
const
UNumberFormat
* fmt,
406
int32_t number,
407
UChar
* result,
408
int32_t resultLength,
409
UFieldPosition
*pos,
410
UErrorCode
* status);
411
433
U_STABLE
int32_t U_EXPORT2
434
unum_formatInt64
(
const
UNumberFormat
*fmt,
435
int64_t number,
436
UChar
* result,
437
int32_t resultLength,
438
UFieldPosition
*pos,
439
UErrorCode
* status);
440
462
U_STABLE
int32_t U_EXPORT2
463
unum_formatDouble
(
const
UNumberFormat
* fmt,
464
double
number,
465
UChar
* result,
466
int32_t resultLength,
467
UFieldPosition
*pos,
/* 0 if ignore */
468
UErrorCode
* status);
469
495
U_STABLE
int32_t U_EXPORT2
496
unum_formatDecimal
(
const
UNumberFormat
* fmt,
497
const
char
* number,
498
int32_t length,
499
UChar
* result,
500
int32_t resultLength,
501
UFieldPosition
*pos,
/* 0 if ignore */
502
UErrorCode
* status);
503
525
U_STABLE
int32_t U_EXPORT2
526
unum_formatDoubleCurrency
(
const
UNumberFormat
* fmt,
527
double
number,
528
UChar
* currency,
529
UChar
* result,
530
int32_t resultLength,
531
UFieldPosition
* pos,
/* ignored if 0 */
532
UErrorCode
* status);
533
551
U_STABLE
int32_t U_EXPORT2
552
unum_parse
(
const
UNumberFormat
* fmt,
553
const
UChar
* text,
554
int32_t textLength,
555
int32_t *parsePos
/* 0 = start */
,
556
UErrorCode
*status);
557
575
U_STABLE
int64_t U_EXPORT2
576
unum_parseInt64
(
const
UNumberFormat
* fmt,
577
const
UChar
* text,
578
int32_t textLength,
579
int32_t *parsePos
/* 0 = start */
,
580
UErrorCode
*status);
581
599
U_STABLE
double
U_EXPORT2
600
unum_parseDouble
(
const
UNumberFormat
* fmt,
601
const
UChar
* text,
602
int32_t textLength,
603
int32_t *parsePos
/* 0 = start */
,
604
UErrorCode
*status);
605
606
632
U_STABLE
int32_t U_EXPORT2
633
unum_parseDecimal
(
const
UNumberFormat
* fmt,
634
const
UChar
* text,
635
int32_t textLength,
636
int32_t *parsePos
/* 0 = start */
,
637
char
*outBuf,
638
int32_t outBufLength,
639
UErrorCode
*status);
640
660
U_STABLE
double
U_EXPORT2
661
unum_parseDoubleCurrency
(
const
UNumberFormat
* fmt,
662
const
UChar
* text,
663
int32_t textLength,
664
int32_t* parsePos,
/* 0 = start */
665
UChar
* currency,
666
UErrorCode
* status);
667
684
U_STABLE
void
U_EXPORT2
685
unum_applyPattern
(
UNumberFormat
*format,
686
UBool
localized,
687
const
UChar
*pattern,
688
int32_t patternLength,
689
UParseError
*parseError,
690
UErrorCode
*status
691
);
692
703
U_STABLE
const
char
* U_EXPORT2
704
unum_getAvailable
(int32_t localeIndex);
705
715
U_STABLE
int32_t U_EXPORT2
716
unum_countAvailable
(
void
);
717
719
typedef
enum
UNumberFormatAttribute
{
721
UNUM_PARSE_INT_ONLY
,
723
UNUM_GROUPING_USED
,
725
UNUM_DECIMAL_ALWAYS_SHOWN
,
727
UNUM_MAX_INTEGER_DIGITS
,
729
UNUM_MIN_INTEGER_DIGITS
,
731
UNUM_INTEGER_DIGITS
,
733
UNUM_MAX_FRACTION_DIGITS
,
735
UNUM_MIN_FRACTION_DIGITS
,
737
UNUM_FRACTION_DIGITS
,
739
UNUM_MULTIPLIER
,
741
UNUM_GROUPING_SIZE
,
743
UNUM_ROUNDING_MODE
,
745
UNUM_ROUNDING_INCREMENT
,
747
UNUM_FORMAT_WIDTH
,
749
UNUM_PADDING_POSITION
,
751
UNUM_SECONDARY_GROUPING_SIZE
,
754
UNUM_SIGNIFICANT_DIGITS_USED
,
757
UNUM_MIN_SIGNIFICANT_DIGITS
,
760
UNUM_MAX_SIGNIFICANT_DIGITS
,
764
UNUM_LENIENT_PARSE
765
}
UNumberFormatAttribute
;
766
783
U_STABLE
int32_t U_EXPORT2
784
unum_getAttribute
(
const
UNumberFormat
* fmt,
785
UNumberFormatAttribute
attr);
786
806
U_STABLE
void
U_EXPORT2
807
unum_setAttribute
(
UNumberFormat
* fmt,
808
UNumberFormatAttribute
attr,
809
int32_t newValue);
810
811
826
U_STABLE
double
U_EXPORT2
827
unum_getDoubleAttribute
(
const
UNumberFormat
* fmt,
828
UNumberFormatAttribute
attr);
829
844
U_STABLE
void
U_EXPORT2
845
unum_setDoubleAttribute
(
UNumberFormat
* fmt,
846
UNumberFormatAttribute
attr,
847
double
newValue);
848
850
typedef
enum
UNumberFormatTextAttribute
{
852
UNUM_POSITIVE_PREFIX
,
854
UNUM_POSITIVE_SUFFIX
,
856
UNUM_NEGATIVE_PREFIX
,
858
UNUM_NEGATIVE_SUFFIX
,
860
UNUM_PADDING_CHARACTER
,
862
UNUM_CURRENCY_CODE
,
867
UNUM_DEFAULT_RULESET
,
874
UNUM_PUBLIC_RULESETS
875
}
UNumberFormatTextAttribute
;
876
895
U_STABLE
int32_t U_EXPORT2
896
unum_getTextAttribute
(
const
UNumberFormat
* fmt,
897
UNumberFormatTextAttribute
tag,
898
UChar
* result,
899
int32_t resultLength,
900
UErrorCode
* status);
901
918
U_STABLE
void
U_EXPORT2
919
unum_setTextAttribute
(
UNumberFormat
* fmt,
920
UNumberFormatTextAttribute
tag,
921
const
UChar
* newValue,
922
int32_t newValueLength,
923
UErrorCode
*status);
924
941
U_STABLE
int32_t U_EXPORT2
942
unum_toPattern
(
const
UNumberFormat
* fmt,
943
UBool
isPatternLocalized,
944
UChar
* result,
945
int32_t resultLength,
946
UErrorCode
* status);
947
948
953
typedef
enum
UNumberFormatSymbol
{
955
UNUM_DECIMAL_SEPARATOR_SYMBOL
= 0,
957
UNUM_GROUPING_SEPARATOR_SYMBOL
= 1,
959
UNUM_PATTERN_SEPARATOR_SYMBOL
= 2,
961
UNUM_PERCENT_SYMBOL
= 3,
963
UNUM_ZERO_DIGIT_SYMBOL
= 4,
965
UNUM_DIGIT_SYMBOL
= 5,
967
UNUM_MINUS_SIGN_SYMBOL
= 6,
969
UNUM_PLUS_SIGN_SYMBOL
= 7,
971
UNUM_CURRENCY_SYMBOL
= 8,
973
UNUM_INTL_CURRENCY_SYMBOL
= 9,
975
UNUM_MONETARY_SEPARATOR_SYMBOL
= 10,
977
UNUM_EXPONENTIAL_SYMBOL
= 11,
979
UNUM_PERMILL_SYMBOL
= 12,
981
UNUM_PAD_ESCAPE_SYMBOL
= 13,
983
UNUM_INFINITY_SYMBOL
= 14,
985
UNUM_NAN_SYMBOL
= 15,
988
UNUM_SIGNIFICANT_DIGIT_SYMBOL
= 16,
992
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
= 17,
996
UNUM_ONE_DIGIT_SYMBOL
= 18,
1000
UNUM_TWO_DIGIT_SYMBOL
= 19,
1004
UNUM_THREE_DIGIT_SYMBOL
= 20,
1008
UNUM_FOUR_DIGIT_SYMBOL
= 21,
1012
UNUM_FIVE_DIGIT_SYMBOL
= 22,
1016
UNUM_SIX_DIGIT_SYMBOL
= 23,
1020
UNUM_SEVEN_DIGIT_SYMBOL
= 24,
1024
UNUM_EIGHT_DIGIT_SYMBOL
= 25,
1028
UNUM_NINE_DIGIT_SYMBOL
= 26,
1030
UNUM_FORMAT_SYMBOL_COUNT
= 27
1031
}
UNumberFormatSymbol
;
1032
1049
U_STABLE
int32_t U_EXPORT2
1050
unum_getSymbol
(
const
UNumberFormat
*fmt,
1051
UNumberFormatSymbol
symbol,
1052
UChar
*buffer,
1053
int32_t size,
1054
UErrorCode
*status);
1055
1069
U_STABLE
void
U_EXPORT2
1070
unum_setSymbol
(
UNumberFormat
*fmt,
1071
UNumberFormatSymbol
symbol,
1072
const
UChar
*value,
1073
int32_t length,
1074
UErrorCode
*status);
1075
1076
1086
U_STABLE
const
char
* U_EXPORT2
1087
unum_getLocaleByType
(
const
UNumberFormat
*fmt,
1088
ULocDataLocaleType
type,
1089
UErrorCode
* status);
1090
1091
#endif
/* #if !UCONFIG_NO_FORMATTING */
1092
1093
#endif
Generated by
1.8.3.1