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/ufieldpositer.h"
00011 #include "unicode/umisc.h"
00012
00013
00079 #ifndef U_HIDE_DRAFT_API
00080
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 #endif
00167
00168 #ifndef U_HIDE_DRAFT_API
00169
00195 typedef enum UNumberGroupingStrategy {
00201 UNUM_GROUPING_OFF,
00202
00217 UNUM_GROUPING_MIN2,
00218
00232 UNUM_GROUPING_AUTO,
00233
00248 UNUM_GROUPING_ON_ALIGNED,
00249
00256 UNUM_GROUPING_THOUSANDS
00257
00258 #ifndef U_HIDE_INTERNAL_API
00259 ,
00265 UNUM_GROUPING_COUNT
00266 #endif
00267
00268 } UNumberGroupingStrategy;
00269
00270 #ifndef U_HIDE_DEPRECATED_API
00271
00275 typedef UNumberGroupingStrategy UGroupingStrategy;
00276 #endif
00277
00278 #endif
00279
00280 #ifndef U_HIDE_DRAFT_API
00281
00300 typedef enum UNumberSignDisplay {
00307 UNUM_SIGN_AUTO,
00308
00315 UNUM_SIGN_ALWAYS,
00316
00322 UNUM_SIGN_NEVER,
00323
00338 UNUM_SIGN_ACCOUNTING,
00339
00348 UNUM_SIGN_ACCOUNTING_ALWAYS,
00349
00356 UNUM_SIGN_EXCEPT_ZERO,
00357
00365 UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
00366
00372 UNUM_SIGN_COUNT
00373 } UNumberSignDisplay;
00374 #endif
00375
00376 #ifndef U_HIDE_DRAFT_API
00377
00386 typedef enum UNumberDecimalSeparatorDisplay {
00393 UNUM_DECIMAL_SEPARATOR_AUTO,
00394
00400 UNUM_DECIMAL_SEPARATOR_ALWAYS,
00401
00407 UNUM_DECIMAL_SEPARATOR_COUNT
00408 } UNumberDecimalSeparatorDisplay;
00409 #endif
00410
00411 #ifndef U_HIDE_DRAFT_API
00412
00413 struct UNumberFormatter;
00421 typedef struct UNumberFormatter UNumberFormatter;
00422
00423 struct UFormattedNumber;
00431 typedef struct UFormattedNumber UFormattedNumber;
00432
00433
00451 U_DRAFT UNumberFormatter* U_EXPORT2
00452 unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
00453 UErrorCode* ec);
00454
00455
00466 U_DRAFT UFormattedNumber* U_EXPORT2
00467 unumf_openResult(UErrorCode* ec);
00468
00469
00485 U_DRAFT void U_EXPORT2
00486 unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
00487 UErrorCode* ec);
00488
00489
00505 U_DRAFT void U_EXPORT2
00506 unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
00507 UErrorCode* ec);
00508
00509
00529 U_DRAFT void U_EXPORT2
00530 unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
00531 UFormattedNumber* uresult, UErrorCode* ec);
00532
00533
00548 U_DRAFT int32_t U_EXPORT2
00549 unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
00550 UErrorCode* ec);
00551
00552
00584 U_DRAFT UBool U_EXPORT2
00585 unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec);
00586
00587
00606 U_DRAFT void U_EXPORT2
00607 unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
00608 UErrorCode* ec);
00609
00610
00619 U_DRAFT void U_EXPORT2
00620 unumf_close(UNumberFormatter* uformatter);
00621
00622
00631 U_DRAFT void U_EXPORT2
00632 unumf_closeResult(UFormattedNumber* uresult);
00633
00634
00635 #if U_SHOW_CPLUSPLUS_API
00636 U_NAMESPACE_BEGIN
00637
00653 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close);
00654
00670 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult);
00671
00672 U_NAMESPACE_END
00673 #endif // U_SHOW_CPLUSPLUS_API
00674
00675 #endif
00676
00677 #endif //__UNUMBERFORMATTER_H__
00678 #endif
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729