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
00081 #ifndef U_HIDE_DRAFT_API
00082
00100 typedef enum UNumberUnitWidth {
00112 UNUM_UNIT_WIDTH_NARROW,
00113
00128 UNUM_UNIT_WIDTH_SHORT,
00129
00139 UNUM_UNIT_WIDTH_FULL_NAME,
00140
00150 UNUM_UNIT_WIDTH_ISO_CODE,
00151
00159 UNUM_UNIT_WIDTH_HIDDEN,
00160
00166 UNUM_UNIT_WIDTH_COUNT
00167 } UNumberUnitWidth;
00168 #endif
00169
00170 #ifndef U_HIDE_DRAFT_API
00171
00197 typedef enum UNumberGroupingStrategy {
00203 UNUM_GROUPING_OFF,
00204
00219 UNUM_GROUPING_MIN2,
00220
00234 UNUM_GROUPING_AUTO,
00235
00250 UNUM_GROUPING_ON_ALIGNED,
00251
00258 UNUM_GROUPING_THOUSANDS
00259
00260 #ifndef U_HIDE_INTERNAL_API
00261 ,
00267 UNUM_GROUPING_COUNT
00268 #endif
00269
00270 } UNumberGroupingStrategy;
00271
00272
00273 #endif
00274
00275 #ifndef U_HIDE_DRAFT_API
00276
00295 typedef enum UNumberSignDisplay {
00302 UNUM_SIGN_AUTO,
00303
00310 UNUM_SIGN_ALWAYS,
00311
00317 UNUM_SIGN_NEVER,
00318
00333 UNUM_SIGN_ACCOUNTING,
00334
00343 UNUM_SIGN_ACCOUNTING_ALWAYS,
00344
00351 UNUM_SIGN_EXCEPT_ZERO,
00352
00360 UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
00361
00367 UNUM_SIGN_COUNT
00368 } UNumberSignDisplay;
00369 #endif
00370
00371 #ifndef U_HIDE_DRAFT_API
00372
00383 typedef enum UNumberDecimalSeparatorDisplay {
00390 UNUM_DECIMAL_SEPARATOR_AUTO,
00391
00397 UNUM_DECIMAL_SEPARATOR_ALWAYS,
00398
00404 UNUM_DECIMAL_SEPARATOR_COUNT
00405 } UNumberDecimalSeparatorDisplay;
00406 #endif
00407
00408 struct UNumberFormatter;
00416 typedef struct UNumberFormatter UNumberFormatter;
00417
00418 struct UFormattedNumber;
00426 typedef struct UFormattedNumber UFormattedNumber;
00427
00428
00446 U_STABLE UNumberFormatter* U_EXPORT2
00447 unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
00448 UErrorCode* ec);
00449
00450
00451 #ifndef U_HIDE_DRAFT_API
00452
00464 U_DRAFT UNumberFormatter* U_EXPORT2
00465 unumf_openForSkeletonAndLocaleWithError(
00466 const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec);
00467 #endif // U_HIDE_DRAFT_API
00468
00469
00478 U_STABLE UFormattedNumber* U_EXPORT2
00479 unumf_openResult(UErrorCode* ec);
00480
00481
00497 U_STABLE void U_EXPORT2
00498 unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
00499 UErrorCode* ec);
00500
00501
00517 U_STABLE void U_EXPORT2
00518 unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
00519 UErrorCode* ec);
00520
00521
00541 U_STABLE void U_EXPORT2
00542 unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
00543 UFormattedNumber* uresult, UErrorCode* ec);
00544
00545 #ifndef U_HIDE_DRAFT_API
00546
00560 U_DRAFT const UFormattedValue* U_EXPORT2
00561 unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec);
00562 #endif
00563
00564
00584 U_STABLE int32_t U_EXPORT2
00585 unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
00586 UErrorCode* ec);
00587
00588
00622 U_STABLE UBool U_EXPORT2
00623 unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec);
00624
00625
00647 U_STABLE void U_EXPORT2
00648 unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
00649 UErrorCode* ec);
00650
00651
00658 U_STABLE void U_EXPORT2
00659 unumf_close(UNumberFormatter* uformatter);
00660
00661
00668 U_STABLE void U_EXPORT2
00669 unumf_closeResult(UFormattedNumber* uresult);
00670
00671
00672 #if U_SHOW_CPLUSPLUS_API
00673 U_NAMESPACE_BEGIN
00674
00690 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close);
00691
00707 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult);
00708
00709 U_NAMESPACE_END
00710 #endif // U_SHOW_CPLUSPLUS_API
00711
00712 #endif //__UNUMBERFORMATTER_H__
00713 #endif