00001
00002
00003
00004 #ifndef __UNUMBERFORMATTER_H__
00005 #define __UNUMBERFORMATTER_H__
00006
00007 #include "unicode/utypes.h"
00008
00009 #if !UCONFIG_NO_FORMATTING
00010
00011 #include "unicode/parseerr.h"
00012 #include "unicode/unumberoptions.h"
00013 #include "unicode/uformattednumber.h"
00014
00015
00118 typedef enum UNumberRoundingPriority {
00124 UNUM_ROUNDING_PRIORITY_RELAXED,
00125
00131 UNUM_ROUNDING_PRIORITY_STRICT,
00132 } UNumberRoundingPriority;
00133
00152 typedef enum UNumberUnitWidth {
00164 UNUM_UNIT_WIDTH_NARROW = 0,
00165
00180 UNUM_UNIT_WIDTH_SHORT = 1,
00181
00191 UNUM_UNIT_WIDTH_FULL_NAME = 2,
00192
00202 UNUM_UNIT_WIDTH_ISO_CODE = 3,
00203
00213 UNUM_UNIT_WIDTH_FORMAL = 4,
00214
00224 UNUM_UNIT_WIDTH_VARIANT = 5,
00225
00233 UNUM_UNIT_WIDTH_HIDDEN = 6,
00234
00235
00236
00242 UNUM_UNIT_WIDTH_COUNT = 7
00243 } UNumberUnitWidth;
00244
00264 typedef enum UNumberSignDisplay {
00274 UNUM_SIGN_AUTO,
00275
00282 UNUM_SIGN_ALWAYS,
00283
00289 UNUM_SIGN_NEVER,
00290
00305 UNUM_SIGN_ACCOUNTING,
00306
00315 UNUM_SIGN_ACCOUNTING_ALWAYS,
00316
00323 UNUM_SIGN_EXCEPT_ZERO,
00324
00332 UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
00333
00339 UNUM_SIGN_NEGATIVE,
00340
00346 UNUM_SIGN_ACCOUNTING_NEGATIVE,
00347
00348
00349
00355 UNUM_SIGN_COUNT = 9,
00356 } UNumberSignDisplay;
00357
00369 typedef enum UNumberDecimalSeparatorDisplay {
00376 UNUM_DECIMAL_SEPARATOR_AUTO,
00377
00383 UNUM_DECIMAL_SEPARATOR_ALWAYS,
00384
00385
00386
00392 UNUM_DECIMAL_SEPARATOR_COUNT
00393 } UNumberDecimalSeparatorDisplay;
00394
00403 typedef enum UNumberTrailingZeroDisplay {
00409 UNUM_TRAILING_ZERO_AUTO,
00410
00416 UNUM_TRAILING_ZERO_HIDE_IF_WHOLE,
00417 } UNumberTrailingZeroDisplay;
00418
00419 struct UNumberFormatter;
00427 typedef struct UNumberFormatter UNumberFormatter;
00428
00429
00450 U_CAPI UNumberFormatter* U_EXPORT2
00451 unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
00452 UErrorCode* ec);
00453
00454
00470 U_CAPI UNumberFormatter* U_EXPORT2
00471 unumf_openForSkeletonAndLocaleWithError(
00472 const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec);
00473
00474
00475
00491 U_CAPI void U_EXPORT2
00492 unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
00493 UErrorCode* ec);
00494
00495
00511 U_CAPI void U_EXPORT2
00512 unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
00513 UErrorCode* ec);
00514
00515
00535 U_CAPI void U_EXPORT2
00536 unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
00537 UFormattedNumber* uresult, UErrorCode* ec);
00538
00539
00540
00547 U_CAPI void U_EXPORT2
00548 unumf_close(UNumberFormatter* uformatter);
00549
00550
00551
00552 #if U_SHOW_CPLUSPLUS_API
00553 U_NAMESPACE_BEGIN
00554
00570 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close);
00571
00572 U_NAMESPACE_END
00573 #endif // U_SHOW_CPLUSPLUS_API
00574
00575 #endif
00576 #endif //__UNUMBERFORMATTER_H__