00001
00002
00003
00004 #include "unicode/utypes.h"
00005
00006 #if !UCONFIG_NO_FORMATTING
00007 #ifndef __UNUMBERFORMATTER_H__
00008 #define __UNUMBERFORMATTER_H__
00009
00010 #include "unicode/parseerr.h"
00011 #include "unicode/ufieldpositer.h"
00012 #include "unicode/umisc.h"
00013 #include "unicode/uformattedvalue.h"
00014
00015
00098 typedef enum UNumberUnitWidth {
00110 UNUM_UNIT_WIDTH_NARROW,
00111
00126 UNUM_UNIT_WIDTH_SHORT,
00127
00137 UNUM_UNIT_WIDTH_FULL_NAME,
00138
00148 UNUM_UNIT_WIDTH_ISO_CODE,
00149
00157 UNUM_UNIT_WIDTH_HIDDEN,
00158
00164 UNUM_UNIT_WIDTH_COUNT
00165 } UNumberUnitWidth;
00166
00193 typedef enum UNumberGroupingStrategy {
00199 UNUM_GROUPING_OFF,
00200
00215 UNUM_GROUPING_MIN2,
00216
00230 UNUM_GROUPING_AUTO,
00231
00246 UNUM_GROUPING_ON_ALIGNED,
00247
00254 UNUM_GROUPING_THOUSANDS
00255
00256 #ifndef U_HIDE_INTERNAL_API
00257 ,
00263 UNUM_GROUPING_COUNT
00264 #endif
00265
00266 } UNumberGroupingStrategy;
00267
00287 typedef enum UNumberSignDisplay {
00294 UNUM_SIGN_AUTO,
00295
00302 UNUM_SIGN_ALWAYS,
00303
00309 UNUM_SIGN_NEVER,
00310
00325 UNUM_SIGN_ACCOUNTING,
00326
00335 UNUM_SIGN_ACCOUNTING_ALWAYS,
00336
00343 UNUM_SIGN_EXCEPT_ZERO,
00344
00353 UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
00354
00360 UNUM_SIGN_COUNT
00361 } UNumberSignDisplay;
00362
00374 typedef enum UNumberDecimalSeparatorDisplay {
00381 UNUM_DECIMAL_SEPARATOR_AUTO,
00382
00388 UNUM_DECIMAL_SEPARATOR_ALWAYS,
00389
00395 UNUM_DECIMAL_SEPARATOR_COUNT
00396 } UNumberDecimalSeparatorDisplay;
00397
00398 struct UNumberFormatter;
00406 typedef struct UNumberFormatter UNumberFormatter;
00407
00408 struct UFormattedNumber;
00416 typedef struct UFormattedNumber UFormattedNumber;
00417
00418
00436 U_STABLE UNumberFormatter* U_EXPORT2
00437 unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
00438 UErrorCode* ec);
00439
00440
00441 #ifndef U_HIDE_DRAFT_API
00442
00454 U_DRAFT UNumberFormatter* U_EXPORT2
00455 unumf_openForSkeletonAndLocaleWithError(
00456 const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec);
00457 #endif // U_HIDE_DRAFT_API
00458
00459
00468 U_STABLE UFormattedNumber* U_EXPORT2
00469 unumf_openResult(UErrorCode* ec);
00470
00471
00487 U_STABLE void U_EXPORT2
00488 unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
00489 UErrorCode* ec);
00490
00491
00507 U_STABLE void U_EXPORT2
00508 unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
00509 UErrorCode* ec);
00510
00511
00531 U_STABLE void U_EXPORT2
00532 unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
00533 UFormattedNumber* uresult, UErrorCode* ec);
00534
00535 #ifndef U_HIDE_DRAFT_API
00536
00550 U_DRAFT const UFormattedValue* U_EXPORT2
00551 unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec);
00552 #endif
00553
00554
00574 U_STABLE int32_t U_EXPORT2
00575 unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
00576 UErrorCode* ec);
00577
00578
00612 U_STABLE UBool U_EXPORT2
00613 unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec);
00614
00615
00637 U_STABLE void U_EXPORT2
00638 unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
00639 UErrorCode* ec);
00640
00641
00642
00643
00644
00645
00646
00647
00648
00655 U_STABLE void U_EXPORT2
00656 unumf_close(UNumberFormatter* uformatter);
00657
00658
00665 U_STABLE void U_EXPORT2
00666 unumf_closeResult(UFormattedNumber* uresult);
00667
00668
00669 #if U_SHOW_CPLUSPLUS_API
00670 U_NAMESPACE_BEGIN
00671
00687 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close);
00688
00704 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult);
00705
00706 U_NAMESPACE_END
00707 #endif // U_SHOW_CPLUSPLUS_API
00708
00709 #endif //__UNUMBERFORMATTER_H__
00710 #endif