ICU 50.1.2
50.1.2
Main Page
Related Pages
Modules
Namespaces
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
718
#if UCONFIG_HAVE_PARSEALLINPUT
719
722
typedef
enum
UNumberFormatAttributeValue {
724
UNUM_NO = 0,
726
UNUM_YES = 1,
728
UNUM_MAYBE = 2
729
} UNumberFormatAttributeValue;
730
#endif
731
733
typedef
enum
UNumberFormatAttribute
{
735
UNUM_PARSE_INT_ONLY
,
737
UNUM_GROUPING_USED
,
739
UNUM_DECIMAL_ALWAYS_SHOWN
,
741
UNUM_MAX_INTEGER_DIGITS
,
743
UNUM_MIN_INTEGER_DIGITS
,
745
UNUM_INTEGER_DIGITS
,
747
UNUM_MAX_FRACTION_DIGITS
,
749
UNUM_MIN_FRACTION_DIGITS
,
751
UNUM_FRACTION_DIGITS
,
753
UNUM_MULTIPLIER
,
755
UNUM_GROUPING_SIZE
,
757
UNUM_ROUNDING_MODE
,
759
UNUM_ROUNDING_INCREMENT
,
761
UNUM_FORMAT_WIDTH
,
763
UNUM_PADDING_POSITION
,
765
UNUM_SECONDARY_GROUPING_SIZE
,
768
UNUM_SIGNIFICANT_DIGITS_USED
,
771
UNUM_MIN_SIGNIFICANT_DIGITS
,
774
UNUM_MAX_SIGNIFICANT_DIGITS
,
778
UNUM_LENIENT_PARSE
,
779
#if UCONFIG_HAVE_PARSEALLINPUT
780
784
UNUM_PARSE_ALL_INPUT,
785
#endif
786
789
UNUM_NUMERIC_ATTRIBUTE_COUNT
,
790
794
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
= 0x0FFF,
795
801
UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS
,
808
UNUM_PARSE_NO_EXPONENT
,
809
812
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
813
}
UNumberFormatAttribute
;
814
831
U_STABLE
int32_t U_EXPORT2
832
unum_getAttribute
(
const
UNumberFormat
* fmt,
833
UNumberFormatAttribute
attr);
834
854
U_STABLE
void
U_EXPORT2
855
unum_setAttribute
(
UNumberFormat
* fmt,
856
UNumberFormatAttribute
attr,
857
int32_t newValue);
858
859
874
U_STABLE
double
U_EXPORT2
875
unum_getDoubleAttribute
(
const
UNumberFormat
* fmt,
876
UNumberFormatAttribute
attr);
877
892
U_STABLE
void
U_EXPORT2
893
unum_setDoubleAttribute
(
UNumberFormat
* fmt,
894
UNumberFormatAttribute
attr,
895
double
newValue);
896
898
typedef
enum
UNumberFormatTextAttribute
{
900
UNUM_POSITIVE_PREFIX
,
902
UNUM_POSITIVE_SUFFIX
,
904
UNUM_NEGATIVE_PREFIX
,
906
UNUM_NEGATIVE_SUFFIX
,
908
UNUM_PADDING_CHARACTER
,
910
UNUM_CURRENCY_CODE
,
915
UNUM_DEFAULT_RULESET
,
922
UNUM_PUBLIC_RULESETS
923
}
UNumberFormatTextAttribute
;
924
943
U_STABLE
int32_t U_EXPORT2
944
unum_getTextAttribute
(
const
UNumberFormat
* fmt,
945
UNumberFormatTextAttribute
tag,
946
UChar
* result,
947
int32_t resultLength,
948
UErrorCode
* status);
949
966
U_STABLE
void
U_EXPORT2
967
unum_setTextAttribute
(
UNumberFormat
* fmt,
968
UNumberFormatTextAttribute
tag,
969
const
UChar
* newValue,
970
int32_t newValueLength,
971
UErrorCode
*status);
972
989
U_STABLE
int32_t U_EXPORT2
990
unum_toPattern
(
const
UNumberFormat
* fmt,
991
UBool
isPatternLocalized,
992
UChar
* result,
993
int32_t resultLength,
994
UErrorCode
* status);
995
996
1001
typedef
enum
UNumberFormatSymbol
{
1003
UNUM_DECIMAL_SEPARATOR_SYMBOL
= 0,
1005
UNUM_GROUPING_SEPARATOR_SYMBOL
= 1,
1007
UNUM_PATTERN_SEPARATOR_SYMBOL
= 2,
1009
UNUM_PERCENT_SYMBOL
= 3,
1011
UNUM_ZERO_DIGIT_SYMBOL
= 4,
1013
UNUM_DIGIT_SYMBOL
= 5,
1015
UNUM_MINUS_SIGN_SYMBOL
= 6,
1017
UNUM_PLUS_SIGN_SYMBOL
= 7,
1019
UNUM_CURRENCY_SYMBOL
= 8,
1021
UNUM_INTL_CURRENCY_SYMBOL
= 9,
1023
UNUM_MONETARY_SEPARATOR_SYMBOL
= 10,
1025
UNUM_EXPONENTIAL_SYMBOL
= 11,
1027
UNUM_PERMILL_SYMBOL
= 12,
1029
UNUM_PAD_ESCAPE_SYMBOL
= 13,
1031
UNUM_INFINITY_SYMBOL
= 14,
1033
UNUM_NAN_SYMBOL
= 15,
1036
UNUM_SIGNIFICANT_DIGIT_SYMBOL
= 16,
1040
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
= 17,
1044
UNUM_ONE_DIGIT_SYMBOL
= 18,
1048
UNUM_TWO_DIGIT_SYMBOL
= 19,
1052
UNUM_THREE_DIGIT_SYMBOL
= 20,
1056
UNUM_FOUR_DIGIT_SYMBOL
= 21,
1060
UNUM_FIVE_DIGIT_SYMBOL
= 22,
1064
UNUM_SIX_DIGIT_SYMBOL
= 23,
1068
UNUM_SEVEN_DIGIT_SYMBOL
= 24,
1072
UNUM_EIGHT_DIGIT_SYMBOL
= 25,
1076
UNUM_NINE_DIGIT_SYMBOL
= 26,
1078
UNUM_FORMAT_SYMBOL_COUNT
= 27
1079
}
UNumberFormatSymbol
;
1080
1097
U_STABLE
int32_t U_EXPORT2
1098
unum_getSymbol
(
const
UNumberFormat
*fmt,
1099
UNumberFormatSymbol
symbol,
1100
UChar
*buffer,
1101
int32_t size,
1102
UErrorCode
*status);
1103
1117
U_STABLE
void
U_EXPORT2
1118
unum_setSymbol
(
UNumberFormat
*fmt,
1119
UNumberFormatSymbol
symbol,
1120
const
UChar
*value,
1121
int32_t length,
1122
UErrorCode
*status);
1123
1124
1134
U_STABLE
const
char
* U_EXPORT2
1135
unum_getLocaleByType
(
const
UNumberFormat
*fmt,
1136
ULocDataLocaleType
type,
1137
UErrorCode
* status);
1138
1139
#endif
/* #if !UCONFIG_NO_FORMATTING */
1140
1141
#endif
Generated on Thu Jan 10 2013 16:42:10 for ICU 50.1.2 by
1.8.1.2