ICU 52.1
52.1
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-2013, 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
"
23
#include "
unicode/uformattable.h
"
24
132
typedef
void
*
UNumberFormat
;
133
137
typedef
enum
UNumberFormatStyle
{
142
UNUM_PATTERN_DECIMAL
=0,
147
UNUM_DECIMAL
=1,
152
UNUM_CURRENCY
,
157
UNUM_PERCENT
,
162
UNUM_SCIENTIFIC
,
167
UNUM_SPELLOUT
,
172
UNUM_ORDINAL
,
177
UNUM_DURATION
,
182
UNUM_NUMBERING_SYSTEM
,
187
UNUM_PATTERN_RULEBASED
,
192
UNUM_CURRENCY_ISO
,
198
UNUM_CURRENCY_PLURAL
,
203
UNUM_FORMAT_STYLE_COUNT
,
208
UNUM_DEFAULT
=
UNUM_DECIMAL
,
213
UNUM_IGNORE
=
UNUM_PATTERN_DECIMAL
214
}
UNumberFormatStyle
;
215
219
typedef
enum
UNumberFormatRoundingMode
{
220
UNUM_ROUND_CEILING,
221
UNUM_ROUND_FLOOR,
222
UNUM_ROUND_DOWN,
223
UNUM_ROUND_UP,
228
UNUM_ROUND_HALFEVEN
,
229
#ifndef U_HIDE_DEPRECATED_API
230
234
UNUM_FOUND_HALFEVEN
=
UNUM_ROUND_HALFEVEN
,
235
#endif
/* U_HIDE_DEPRECATED_API */
236
UNUM_ROUND_HALFDOWN =
UNUM_ROUND_HALFEVEN
+ 1,
237
UNUM_ROUND_HALFUP,
242
UNUM_ROUND_UNNECESSARY
243
}
UNumberFormatRoundingMode
;
244
248
typedef
enum
UNumberFormatPadPosition
{
249
UNUM_PAD_BEFORE_PREFIX,
250
UNUM_PAD_AFTER_PREFIX,
251
UNUM_PAD_BEFORE_SUFFIX,
252
UNUM_PAD_AFTER_SUFFIX
253
}
UNumberFormatPadPosition
;
254
255
#ifndef U_HIDE_DRAFT_API
256
260
typedef
enum
UNumberCompactStyle
{
262
UNUM_SHORT
,
264
UNUM_LONG
266
}
UNumberCompactStyle
;
267
#endif
/* U_HIDE_DRAFT_API */
268
273
enum
UCurrencySpacing
{
275
UNUM_CURRENCY_MATCH
,
277
UNUM_CURRENCY_SURROUNDING_MATCH
,
279
UNUM_CURRENCY_INSERT
,
281
UNUM_CURRENCY_SPACING_COUNT
282
};
283
typedef
enum
UCurrencySpacing
UCurrencySpacing
;
291
typedef
enum
UNumberFormatFields
{
293
UNUM_INTEGER_FIELD
,
295
UNUM_FRACTION_FIELD
,
297
UNUM_DECIMAL_SEPARATOR_FIELD
,
299
UNUM_EXPONENT_SYMBOL_FIELD
,
301
UNUM_EXPONENT_SIGN_FIELD
,
303
UNUM_EXPONENT_FIELD
,
305
UNUM_GROUPING_SEPARATOR_FIELD
,
307
UNUM_CURRENCY_FIELD
,
309
UNUM_PERCENT_FIELD
,
311
UNUM_PERMILL_FIELD
,
313
UNUM_SIGN_FIELD
,
315
UNUM_FIELD_COUNT
316
}
UNumberFormatFields
;
317
318
350
U_STABLE
UNumberFormat
* U_EXPORT2
351
unum_open
(
UNumberFormatStyle
style,
352
const
UChar
* pattern,
353
int32_t patternLength,
354
const
char
* locale,
355
UParseError
* parseErr,
356
UErrorCode
* status);
357
358
365
U_STABLE
void
U_EXPORT2
366
unum_close
(
UNumberFormat
* fmt);
367
368
#if U_SHOW_CPLUSPLUS_API
369
370
U_NAMESPACE_BEGIN
371
381
U_DEFINE_LOCAL_OPEN_POINTER
(
LocalUNumberFormatPointer
,
UNumberFormat
,
unum_close
);
382
383
U_NAMESPACE_END
384
385
#endif
386
395
U_STABLE
UNumberFormat
* U_EXPORT2
396
unum_clone
(
const
UNumberFormat
*fmt,
397
UErrorCode
*status);
398
423
U_STABLE
int32_t U_EXPORT2
424
unum_format
(
const
UNumberFormat
* fmt,
425
int32_t number,
426
UChar
* result,
427
int32_t resultLength,
428
UFieldPosition
*pos,
429
UErrorCode
* status);
430
455
U_STABLE
int32_t U_EXPORT2
456
unum_formatInt64
(
const
UNumberFormat
*fmt,
457
int64_t number,
458
UChar
* result,
459
int32_t resultLength,
460
UFieldPosition
*pos,
461
UErrorCode
* status);
462
487
U_STABLE
int32_t U_EXPORT2
488
unum_formatDouble
(
const
UNumberFormat
* fmt,
489
double
number,
490
UChar
* result,
491
int32_t resultLength,
492
UFieldPosition
*pos,
/* 0 if ignore */
493
UErrorCode
* status);
494
523
U_STABLE
int32_t U_EXPORT2
524
unum_formatDecimal
(
const
UNumberFormat
* fmt,
525
const
char
* number,
526
int32_t length,
527
UChar
* result,
528
int32_t resultLength,
529
UFieldPosition
*pos,
/* 0 if ignore */
530
UErrorCode
* status);
531
556
U_STABLE
int32_t U_EXPORT2
557
unum_formatDoubleCurrency
(
const
UNumberFormat
* fmt,
558
double
number,
559
UChar
* currency,
560
UChar
* result,
561
int32_t resultLength,
562
UFieldPosition
* pos,
563
UErrorCode
* status);
564
565
#ifndef U_HIDE_DRAFT_API
566
586
U_DRAFT
int32_t U_EXPORT2
587
unum_formatUFormattable
(
const
UNumberFormat
* fmt,
588
const
UFormattable
*number,
589
UChar
*result,
590
int32_t resultLength,
591
UFieldPosition
*pos,
592
UErrorCode
*status);
593
#endif
/* U_HIDE_DRAFT_API */
594
612
U_STABLE
int32_t U_EXPORT2
613
unum_parse
(
const
UNumberFormat
* fmt,
614
const
UChar
* text,
615
int32_t textLength,
616
int32_t *parsePos
/* 0 = start */
,
617
UErrorCode
*status);
618
636
U_STABLE
int64_t U_EXPORT2
637
unum_parseInt64
(
const
UNumberFormat
* fmt,
638
const
UChar
* text,
639
int32_t textLength,
640
int32_t *parsePos
/* 0 = start */
,
641
UErrorCode
*status);
642
660
U_STABLE
double
U_EXPORT2
661
unum_parseDouble
(
const
UNumberFormat
* fmt,
662
const
UChar
* text,
663
int32_t textLength,
664
int32_t *parsePos
/* 0 = start */
,
665
UErrorCode
*status);
666
667
693
U_STABLE
int32_t U_EXPORT2
694
unum_parseDecimal
(
const
UNumberFormat
* fmt,
695
const
UChar
* text,
696
int32_t textLength,
697
int32_t *parsePos
/* 0 = start */
,
698
char
*outBuf,
699
int32_t outBufLength,
700
UErrorCode
*status);
701
721
U_STABLE
double
U_EXPORT2
722
unum_parseDoubleCurrency
(
const
UNumberFormat
* fmt,
723
const
UChar
* text,
724
int32_t textLength,
725
int32_t* parsePos,
/* 0 = start */
726
UChar
* currency,
727
UErrorCode
* status);
728
729
#ifndef U_HIDE_DRAFT_API
730
748
U_DRAFT
UFormattable
* U_EXPORT2
749
unum_parseToUFormattable
(
const
UNumberFormat
* fmt,
750
UFormattable
*result,
751
const
UChar
* text,
752
int32_t textLength,
753
int32_t* parsePos,
/* 0 = start */
754
UErrorCode
* status);
755
#endif
/* U_HIDE_DRAFT_API */
756
773
U_STABLE
void
U_EXPORT2
774
unum_applyPattern
(
UNumberFormat
*format,
775
UBool
localized,
776
const
UChar
*pattern,
777
int32_t patternLength,
778
UParseError
*parseError,
779
UErrorCode
*status
780
);
781
792
U_STABLE
const
char
* U_EXPORT2
793
unum_getAvailable
(int32_t localeIndex);
794
804
U_STABLE
int32_t U_EXPORT2
805
unum_countAvailable
(
void
);
806
807
#if UCONFIG_HAVE_PARSEALLINPUT
808
811
typedef
enum
UNumberFormatAttributeValue {
813
UNUM_NO = 0,
815
UNUM_YES = 1,
817
UNUM_MAYBE = 2
818
} UNumberFormatAttributeValue;
819
#endif
820
822
typedef
enum
UNumberFormatAttribute
{
824
UNUM_PARSE_INT_ONLY
,
826
UNUM_GROUPING_USED
,
828
UNUM_DECIMAL_ALWAYS_SHOWN
,
830
UNUM_MAX_INTEGER_DIGITS
,
832
UNUM_MIN_INTEGER_DIGITS
,
834
UNUM_INTEGER_DIGITS
,
836
UNUM_MAX_FRACTION_DIGITS
,
838
UNUM_MIN_FRACTION_DIGITS
,
840
UNUM_FRACTION_DIGITS
,
842
UNUM_MULTIPLIER
,
844
UNUM_GROUPING_SIZE
,
846
UNUM_ROUNDING_MODE
,
848
UNUM_ROUNDING_INCREMENT
,
850
UNUM_FORMAT_WIDTH
,
852
UNUM_PADDING_POSITION
,
854
UNUM_SECONDARY_GROUPING_SIZE
,
857
UNUM_SIGNIFICANT_DIGITS_USED
,
860
UNUM_MIN_SIGNIFICANT_DIGITS
,
863
UNUM_MAX_SIGNIFICANT_DIGITS
,
867
UNUM_LENIENT_PARSE
,
868
#if UCONFIG_HAVE_PARSEALLINPUT
869
873
UNUM_PARSE_ALL_INPUT =
UNUM_LENIENT_PARSE
+ 1,
874
#endif
875
#ifndef U_HIDE_DRAFT_API
876
885
UNUM_SCALE
=
UNUM_LENIENT_PARSE
+ 2,
886
#endif
/* U_HIDE_DRAFT_API */
887
888
#ifndef U_HIDE_INTERNAL_API
889
891
UNUM_NUMERIC_ATTRIBUTE_COUNT
=
UNUM_LENIENT_PARSE
+ 3,
892
896
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
= 0x0FFF,
897
#endif
/* U_HIDE_INTERNAL_API */
898
904
UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS
= 0x1000,
911
UNUM_PARSE_NO_EXPONENT
,
912
913
#ifndef U_HIDE_INTERNAL_API
914
916
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
917
#endif
/* U_HIDE_INTERNAL_API */
918
}
UNumberFormatAttribute
;
919
937
U_STABLE
int32_t U_EXPORT2
938
unum_getAttribute
(
const
UNumberFormat
* fmt,
939
UNumberFormatAttribute
attr);
940
960
U_STABLE
void
U_EXPORT2
961
unum_setAttribute
(
UNumberFormat
* fmt,
962
UNumberFormatAttribute
attr,
963
int32_t newValue);
964
965
980
U_STABLE
double
U_EXPORT2
981
unum_getDoubleAttribute
(
const
UNumberFormat
* fmt,
982
UNumberFormatAttribute
attr);
983
998
U_STABLE
void
U_EXPORT2
999
unum_setDoubleAttribute
(
UNumberFormat
* fmt,
1000
UNumberFormatAttribute
attr,
1001
double
newValue);
1002
1004
typedef
enum
UNumberFormatTextAttribute
{
1006
UNUM_POSITIVE_PREFIX
,
1008
UNUM_POSITIVE_SUFFIX
,
1010
UNUM_NEGATIVE_PREFIX
,
1012
UNUM_NEGATIVE_SUFFIX
,
1014
UNUM_PADDING_CHARACTER
,
1016
UNUM_CURRENCY_CODE
,
1021
UNUM_DEFAULT_RULESET
,
1028
UNUM_PUBLIC_RULESETS
1029
}
UNumberFormatTextAttribute
;
1030
1049
U_STABLE
int32_t U_EXPORT2
1050
unum_getTextAttribute
(
const
UNumberFormat
* fmt,
1051
UNumberFormatTextAttribute
tag,
1052
UChar
* result,
1053
int32_t resultLength,
1054
UErrorCode
* status);
1055
1072
U_STABLE
void
U_EXPORT2
1073
unum_setTextAttribute
(
UNumberFormat
* fmt,
1074
UNumberFormatTextAttribute
tag,
1075
const
UChar
* newValue,
1076
int32_t newValueLength,
1077
UErrorCode
*status);
1078
1095
U_STABLE
int32_t U_EXPORT2
1096
unum_toPattern
(
const
UNumberFormat
* fmt,
1097
UBool
isPatternLocalized,
1098
UChar
* result,
1099
int32_t resultLength,
1100
UErrorCode
* status);
1101
1102
1107
typedef
enum
UNumberFormatSymbol
{
1109
UNUM_DECIMAL_SEPARATOR_SYMBOL
= 0,
1111
UNUM_GROUPING_SEPARATOR_SYMBOL
= 1,
1113
UNUM_PATTERN_SEPARATOR_SYMBOL
= 2,
1115
UNUM_PERCENT_SYMBOL
= 3,
1117
UNUM_ZERO_DIGIT_SYMBOL
= 4,
1119
UNUM_DIGIT_SYMBOL
= 5,
1121
UNUM_MINUS_SIGN_SYMBOL
= 6,
1123
UNUM_PLUS_SIGN_SYMBOL
= 7,
1125
UNUM_CURRENCY_SYMBOL
= 8,
1127
UNUM_INTL_CURRENCY_SYMBOL
= 9,
1129
UNUM_MONETARY_SEPARATOR_SYMBOL
= 10,
1131
UNUM_EXPONENTIAL_SYMBOL
= 11,
1133
UNUM_PERMILL_SYMBOL
= 12,
1135
UNUM_PAD_ESCAPE_SYMBOL
= 13,
1137
UNUM_INFINITY_SYMBOL
= 14,
1139
UNUM_NAN_SYMBOL
= 15,
1142
UNUM_SIGNIFICANT_DIGIT_SYMBOL
= 16,
1146
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
= 17,
1150
UNUM_ONE_DIGIT_SYMBOL
= 18,
1154
UNUM_TWO_DIGIT_SYMBOL
= 19,
1158
UNUM_THREE_DIGIT_SYMBOL
= 20,
1162
UNUM_FOUR_DIGIT_SYMBOL
= 21,
1166
UNUM_FIVE_DIGIT_SYMBOL
= 22,
1170
UNUM_SIX_DIGIT_SYMBOL
= 23,
1174
UNUM_SEVEN_DIGIT_SYMBOL
= 24,
1178
UNUM_EIGHT_DIGIT_SYMBOL
= 25,
1182
UNUM_NINE_DIGIT_SYMBOL
= 26,
1184
UNUM_FORMAT_SYMBOL_COUNT
= 27
1185
}
UNumberFormatSymbol
;
1186
1203
U_STABLE
int32_t U_EXPORT2
1204
unum_getSymbol
(
const
UNumberFormat
*fmt,
1205
UNumberFormatSymbol
symbol,
1206
UChar
*buffer,
1207
int32_t size,
1208
UErrorCode
*status);
1209
1223
U_STABLE
void
U_EXPORT2
1224
unum_setSymbol
(
UNumberFormat
*fmt,
1225
UNumberFormatSymbol
symbol,
1226
const
UChar
*value,
1227
int32_t length,
1228
UErrorCode
*status);
1229
1230
1240
U_STABLE
const
char
* U_EXPORT2
1241
unum_getLocaleByType
(
const
UNumberFormat
*fmt,
1242
ULocDataLocaleType
type,
1243
UErrorCode
* status);
1244
1245
#endif
/* #if !UCONFIG_NO_FORMATTING */
1246
1247
#endif
Generated on Fri Oct 4 2013 14:10:22 for ICU 52.1 by
1.8.1.2