ICU 51.2
51.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-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
"
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
253
#ifndef U_HIDE_DRAFT_API
254
258
typedef
enum
UNumberCompactStyle
{
260
UNUM_SHORT
,
262
UNUM_LONG
264
}
UNumberCompactStyle
;
265
#endif
/* U_HIDE_DRAFT_API */
266
271
enum
UCurrencySpacing
{
273
UNUM_CURRENCY_MATCH
,
275
UNUM_CURRENCY_SURROUNDING_MATCH
,
277
UNUM_CURRENCY_INSERT
,
279
UNUM_CURRENCY_SPACING_COUNT
280
};
281
typedef
enum
UCurrencySpacing
UCurrencySpacing
;
289
typedef
enum
UNumberFormatFields
{
291
UNUM_INTEGER_FIELD
,
293
UNUM_FRACTION_FIELD
,
295
UNUM_DECIMAL_SEPARATOR_FIELD
,
297
UNUM_EXPONENT_SYMBOL_FIELD
,
299
UNUM_EXPONENT_SIGN_FIELD
,
301
UNUM_EXPONENT_FIELD
,
303
UNUM_GROUPING_SEPARATOR_FIELD
,
305
UNUM_CURRENCY_FIELD
,
307
UNUM_PERCENT_FIELD
,
309
UNUM_PERMILL_FIELD
,
311
UNUM_SIGN_FIELD
,
313
UNUM_FIELD_COUNT
314
}
UNumberFormatFields
;
315
316
348
U_STABLE
UNumberFormat
* U_EXPORT2
349
unum_open
(
UNumberFormatStyle
style,
350
const
UChar
* pattern,
351
int32_t patternLength,
352
const
char
* locale,
353
UParseError
* parseErr,
354
UErrorCode
* status);
355
356
363
U_STABLE
void
U_EXPORT2
364
unum_close
(
UNumberFormat
* fmt);
365
366
#if U_SHOW_CPLUSPLUS_API
367
368
U_NAMESPACE_BEGIN
369
379
U_DEFINE_LOCAL_OPEN_POINTER
(
LocalUNumberFormatPointer
,
UNumberFormat
,
unum_close
);
380
381
U_NAMESPACE_END
382
383
#endif
384
393
U_STABLE
UNumberFormat
* U_EXPORT2
394
unum_clone
(
const
UNumberFormat
*fmt,
395
UErrorCode
*status);
396
418
U_STABLE
int32_t U_EXPORT2
419
unum_format
(
const
UNumberFormat
* fmt,
420
int32_t number,
421
UChar
* result,
422
int32_t resultLength,
423
UFieldPosition
*pos,
424
UErrorCode
* status);
425
447
U_STABLE
int32_t U_EXPORT2
448
unum_formatInt64
(
const
UNumberFormat
*fmt,
449
int64_t number,
450
UChar
* result,
451
int32_t resultLength,
452
UFieldPosition
*pos,
453
UErrorCode
* status);
454
476
U_STABLE
int32_t U_EXPORT2
477
unum_formatDouble
(
const
UNumberFormat
* fmt,
478
double
number,
479
UChar
* result,
480
int32_t resultLength,
481
UFieldPosition
*pos,
/* 0 if ignore */
482
UErrorCode
* status);
483
509
U_STABLE
int32_t U_EXPORT2
510
unum_formatDecimal
(
const
UNumberFormat
* fmt,
511
const
char
* number,
512
int32_t length,
513
UChar
* result,
514
int32_t resultLength,
515
UFieldPosition
*pos,
/* 0 if ignore */
516
UErrorCode
* status);
517
539
U_STABLE
int32_t U_EXPORT2
540
unum_formatDoubleCurrency
(
const
UNumberFormat
* fmt,
541
double
number,
542
UChar
* currency,
543
UChar
* result,
544
int32_t resultLength,
545
UFieldPosition
* pos,
/* ignored if 0 */
546
UErrorCode
* status);
547
565
U_STABLE
int32_t U_EXPORT2
566
unum_parse
(
const
UNumberFormat
* fmt,
567
const
UChar
* text,
568
int32_t textLength,
569
int32_t *parsePos
/* 0 = start */
,
570
UErrorCode
*status);
571
589
U_STABLE
int64_t U_EXPORT2
590
unum_parseInt64
(
const
UNumberFormat
* fmt,
591
const
UChar
* text,
592
int32_t textLength,
593
int32_t *parsePos
/* 0 = start */
,
594
UErrorCode
*status);
595
613
U_STABLE
double
U_EXPORT2
614
unum_parseDouble
(
const
UNumberFormat
* fmt,
615
const
UChar
* text,
616
int32_t textLength,
617
int32_t *parsePos
/* 0 = start */
,
618
UErrorCode
*status);
619
620
646
U_STABLE
int32_t U_EXPORT2
647
unum_parseDecimal
(
const
UNumberFormat
* fmt,
648
const
UChar
* text,
649
int32_t textLength,
650
int32_t *parsePos
/* 0 = start */
,
651
char
*outBuf,
652
int32_t outBufLength,
653
UErrorCode
*status);
654
674
U_STABLE
double
U_EXPORT2
675
unum_parseDoubleCurrency
(
const
UNumberFormat
* fmt,
676
const
UChar
* text,
677
int32_t textLength,
678
int32_t* parsePos,
/* 0 = start */
679
UChar
* currency,
680
UErrorCode
* status);
681
698
U_STABLE
void
U_EXPORT2
699
unum_applyPattern
(
UNumberFormat
*format,
700
UBool
localized,
701
const
UChar
*pattern,
702
int32_t patternLength,
703
UParseError
*parseError,
704
UErrorCode
*status
705
);
706
717
U_STABLE
const
char
* U_EXPORT2
718
unum_getAvailable
(int32_t localeIndex);
719
729
U_STABLE
int32_t U_EXPORT2
730
unum_countAvailable
(
void
);
731
732
#if UCONFIG_HAVE_PARSEALLINPUT
733
736
typedef
enum
UNumberFormatAttributeValue {
738
UNUM_NO = 0,
740
UNUM_YES = 1,
742
UNUM_MAYBE = 2
743
} UNumberFormatAttributeValue;
744
#endif
745
747
typedef
enum
UNumberFormatAttribute
{
749
UNUM_PARSE_INT_ONLY
,
751
UNUM_GROUPING_USED
,
753
UNUM_DECIMAL_ALWAYS_SHOWN
,
755
UNUM_MAX_INTEGER_DIGITS
,
757
UNUM_MIN_INTEGER_DIGITS
,
759
UNUM_INTEGER_DIGITS
,
761
UNUM_MAX_FRACTION_DIGITS
,
763
UNUM_MIN_FRACTION_DIGITS
,
765
UNUM_FRACTION_DIGITS
,
767
UNUM_MULTIPLIER
,
769
UNUM_GROUPING_SIZE
,
771
UNUM_ROUNDING_MODE
,
773
UNUM_ROUNDING_INCREMENT
,
775
UNUM_FORMAT_WIDTH
,
777
UNUM_PADDING_POSITION
,
779
UNUM_SECONDARY_GROUPING_SIZE
,
782
UNUM_SIGNIFICANT_DIGITS_USED
,
785
UNUM_MIN_SIGNIFICANT_DIGITS
,
788
UNUM_MAX_SIGNIFICANT_DIGITS
,
792
UNUM_LENIENT_PARSE
,
793
#if UCONFIG_HAVE_PARSEALLINPUT
794
798
UNUM_PARSE_ALL_INPUT,
799
#endif
800
#ifndef U_HIDE_DRAFT_API
801
810
UNUM_SCALE
=
UNUM_LENIENT_PARSE
+ 2,
811
#endif
/* U_HIDE_DRAFT_API */
812
#ifndef U_HIDE_INTERNAL_API
813
815
UNUM_NUMERIC_ATTRIBUTE_COUNT
,
816
820
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
= 0x0FFF,
821
#endif
/* U_HIDE_INTERNAL_API */
822
823
#ifndef U_HIDE_DRAFT_API
824
829
UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS
= 0x1000,
836
UNUM_PARSE_NO_EXPONENT
,
837
#endif
/* U_HIDE_DRAFT_API */
838
839
#ifndef U_HIDE_INTERNAL_API
840
842
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
843
#endif
/* U_HIDE_INTERNAL_API */
844
}
UNumberFormatAttribute
;
845
863
U_STABLE
int32_t U_EXPORT2
864
unum_getAttribute
(
const
UNumberFormat
* fmt,
865
UNumberFormatAttribute
attr);
866
886
U_STABLE
void
U_EXPORT2
887
unum_setAttribute
(
UNumberFormat
* fmt,
888
UNumberFormatAttribute
attr,
889
int32_t newValue);
890
891
906
U_STABLE
double
U_EXPORT2
907
unum_getDoubleAttribute
(
const
UNumberFormat
* fmt,
908
UNumberFormatAttribute
attr);
909
924
U_STABLE
void
U_EXPORT2
925
unum_setDoubleAttribute
(
UNumberFormat
* fmt,
926
UNumberFormatAttribute
attr,
927
double
newValue);
928
930
typedef
enum
UNumberFormatTextAttribute
{
932
UNUM_POSITIVE_PREFIX
,
934
UNUM_POSITIVE_SUFFIX
,
936
UNUM_NEGATIVE_PREFIX
,
938
UNUM_NEGATIVE_SUFFIX
,
940
UNUM_PADDING_CHARACTER
,
942
UNUM_CURRENCY_CODE
,
947
UNUM_DEFAULT_RULESET
,
954
UNUM_PUBLIC_RULESETS
955
}
UNumberFormatTextAttribute
;
956
975
U_STABLE
int32_t U_EXPORT2
976
unum_getTextAttribute
(
const
UNumberFormat
* fmt,
977
UNumberFormatTextAttribute
tag,
978
UChar
* result,
979
int32_t resultLength,
980
UErrorCode
* status);
981
998
U_STABLE
void
U_EXPORT2
999
unum_setTextAttribute
(
UNumberFormat
* fmt,
1000
UNumberFormatTextAttribute
tag,
1001
const
UChar
* newValue,
1002
int32_t newValueLength,
1003
UErrorCode
*status);
1004
1021
U_STABLE
int32_t U_EXPORT2
1022
unum_toPattern
(
const
UNumberFormat
* fmt,
1023
UBool
isPatternLocalized,
1024
UChar
* result,
1025
int32_t resultLength,
1026
UErrorCode
* status);
1027
1028
1033
typedef
enum
UNumberFormatSymbol
{
1035
UNUM_DECIMAL_SEPARATOR_SYMBOL
= 0,
1037
UNUM_GROUPING_SEPARATOR_SYMBOL
= 1,
1039
UNUM_PATTERN_SEPARATOR_SYMBOL
= 2,
1041
UNUM_PERCENT_SYMBOL
= 3,
1043
UNUM_ZERO_DIGIT_SYMBOL
= 4,
1045
UNUM_DIGIT_SYMBOL
= 5,
1047
UNUM_MINUS_SIGN_SYMBOL
= 6,
1049
UNUM_PLUS_SIGN_SYMBOL
= 7,
1051
UNUM_CURRENCY_SYMBOL
= 8,
1053
UNUM_INTL_CURRENCY_SYMBOL
= 9,
1055
UNUM_MONETARY_SEPARATOR_SYMBOL
= 10,
1057
UNUM_EXPONENTIAL_SYMBOL
= 11,
1059
UNUM_PERMILL_SYMBOL
= 12,
1061
UNUM_PAD_ESCAPE_SYMBOL
= 13,
1063
UNUM_INFINITY_SYMBOL
= 14,
1065
UNUM_NAN_SYMBOL
= 15,
1068
UNUM_SIGNIFICANT_DIGIT_SYMBOL
= 16,
1072
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
= 17,
1076
UNUM_ONE_DIGIT_SYMBOL
= 18,
1080
UNUM_TWO_DIGIT_SYMBOL
= 19,
1084
UNUM_THREE_DIGIT_SYMBOL
= 20,
1088
UNUM_FOUR_DIGIT_SYMBOL
= 21,
1092
UNUM_FIVE_DIGIT_SYMBOL
= 22,
1096
UNUM_SIX_DIGIT_SYMBOL
= 23,
1100
UNUM_SEVEN_DIGIT_SYMBOL
= 24,
1104
UNUM_EIGHT_DIGIT_SYMBOL
= 25,
1108
UNUM_NINE_DIGIT_SYMBOL
= 26,
1110
UNUM_FORMAT_SYMBOL_COUNT
= 27
1111
}
UNumberFormatSymbol
;
1112
1129
U_STABLE
int32_t U_EXPORT2
1130
unum_getSymbol
(
const
UNumberFormat
*fmt,
1131
UNumberFormatSymbol
symbol,
1132
UChar
*buffer,
1133
int32_t size,
1134
UErrorCode
*status);
1135
1149
U_STABLE
void
U_EXPORT2
1150
unum_setSymbol
(
UNumberFormat
*fmt,
1151
UNumberFormatSymbol
symbol,
1152
const
UChar
*value,
1153
int32_t length,
1154
UErrorCode
*status);
1155
1156
1166
U_STABLE
const
char
* U_EXPORT2
1167
unum_getLocaleByType
(
const
UNumberFormat
*fmt,
1168
ULocDataLocaleType
type,
1169
UErrorCode
* status);
1170
1171
#endif
/* #if !UCONFIG_NO_FORMATTING */
1172
1173
#endif
Generated on Thu May 23 2013 00:42:34 for ICU 51.2 by
1.8.1.2