00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
#ifndef _UNUM
00012
#define _UNUM
00013
00014
#include "unicode/utypes.h"
00015
00016
#if !UCONFIG_NO_FORMATTING
00017
00018
#include "unicode/uloc.h"
00019
#include "unicode/umisc.h"
00020
#include "unicode/parseerr.h"
00128
typedef void*
UNumberFormat;
00129
00133
typedef enum UNumberFormatStyle {
00138
UNUM_PATTERN_DECIMAL=0,
00140
UNUM_DECIMAL=1,
00142
UNUM_CURRENCY,
00144
UNUM_PERCENT,
00146
UNUM_SCIENTIFIC,
00148
UNUM_SPELLOUT,
00153
UNUM_ORDINAL,
00158
UNUM_DURATION,
00163
UNUM_PATTERN_RULEBASED,
00165
UNUM_DEFAULT =
UNUM_DECIMAL,
00167
UNUM_IGNORE =
UNUM_PATTERN_DECIMAL
00168 }
UNumberFormatStyle;
00169
00173
typedef enum UNumberFormatRoundingMode {
00174
UNUM_ROUND_CEILING,
00175
UNUM_ROUND_FLOOR,
00176
UNUM_ROUND_DOWN,
00177
UNUM_ROUND_UP,
00178
UNUM_FOUND_HALFEVEN,
00179
UNUM_ROUND_HALFDOWN,
00180
UNUM_ROUND_HALFUP
00181 }
UNumberFormatRoundingMode;
00182
00186
typedef enum UNumberFormatPadPosition {
00187
UNUM_PAD_BEFORE_PREFIX,
00188
UNUM_PAD_AFTER_PREFIX,
00189
UNUM_PAD_BEFORE_SUFFIX,
00190
UNUM_PAD_AFTER_SUFFIX
00191 }
UNumberFormatPadPosition;
00192
00224
U_CAPI UNumberFormat*
U_EXPORT2
00225
unum_open( UNumberFormatStyle style,
00226
const UChar* pattern,
00227 int32_t patternLength,
00228
const char* locale,
00229
UParseError* parseErr,
00230 UErrorCode* status);
00231
00232
00239
U_CAPI void U_EXPORT2
00240
unum_close(UNumberFormat* fmt);
00241
00250
U_CAPI UNumberFormat*
U_EXPORT2
00251
unum_clone(
const UNumberFormat *fmt,
00252 UErrorCode *status);
00253
00275
U_CAPI int32_t U_EXPORT2
00276
unum_format(
const UNumberFormat* fmt,
00277 int32_t number,
00278 UChar* result,
00279 int32_t resultLength,
00280
UFieldPosition *pos,
00281 UErrorCode* status);
00282
00304
U_CAPI int32_t U_EXPORT2
00305
unum_formatInt64(
const UNumberFormat *fmt,
00306 int64_t number,
00307 UChar* result,
00308 int32_t resultLength,
00309
UFieldPosition *pos,
00310 UErrorCode* status);
00311
00333
U_CAPI int32_t U_EXPORT2
00334
unum_formatDouble(
const UNumberFormat* fmt,
00335
double number,
00336 UChar* result,
00337 int32_t resultLength,
00338
UFieldPosition *pos,
00339 UErrorCode* status);
00340
00362
U_DRAFT int32_t U_EXPORT2
00363
unum_formatDoubleCurrency(
const UNumberFormat* fmt,
00364
double number,
00365 UChar* currency,
00366 UChar* result,
00367 int32_t resultLength,
00368
UFieldPosition* pos,
00369 UErrorCode* status);
00370
00388
U_CAPI int32_t U_EXPORT2
00389
unum_parse(
const UNumberFormat* fmt,
00390
const UChar* text,
00391 int32_t textLength,
00392 int32_t *parsePos ,
00393 UErrorCode *status);
00394
00412
U_CAPI int64_t U_EXPORT2
00413
unum_parseInt64(
const UNumberFormat* fmt,
00414
const UChar* text,
00415 int32_t textLength,
00416 int32_t *parsePos ,
00417 UErrorCode *status);
00418
00436
U_CAPI double U_EXPORT2
00437
unum_parseDouble(
const UNumberFormat* fmt,
00438
const UChar* text,
00439 int32_t textLength,
00440 int32_t *parsePos ,
00441 UErrorCode *status);
00442
00462
U_DRAFT double U_EXPORT2
00463
unum_parseDoubleCurrency(
const UNumberFormat* fmt,
00464
const UChar* text,
00465 int32_t textLength,
00466 int32_t* parsePos,
00467 UChar* currency,
00468 UErrorCode* status);
00469
00486
U_CAPI void U_EXPORT2
00487
unum_applyPattern( UNumberFormat *format,
00488 UBool localized,
00489
const UChar *pattern,
00490 int32_t patternLength,
00491
UParseError *parseError,
00492 UErrorCode *status
00493 );
00494
00505
U_CAPI const char*
U_EXPORT2
00506
unum_getAvailable(int32_t index);
00507
00517
U_CAPI int32_t U_EXPORT2
00518
unum_countAvailable(
void);
00519
00521
typedef enum UNumberFormatAttribute {
00523
UNUM_PARSE_INT_ONLY,
00525
UNUM_GROUPING_USED,
00527
UNUM_DECIMAL_ALWAYS_SHOWN,
00529
UNUM_MAX_INTEGER_DIGITS,
00531
UNUM_MIN_INTEGER_DIGITS,
00533
UNUM_INTEGER_DIGITS,
00535
UNUM_MAX_FRACTION_DIGITS,
00537
UNUM_MIN_FRACTION_DIGITS,
00539
UNUM_FRACTION_DIGITS,
00541
UNUM_MULTIPLIER,
00543
UNUM_GROUPING_SIZE,
00545
UNUM_ROUNDING_MODE,
00547
UNUM_ROUNDING_INCREMENT,
00549
UNUM_FORMAT_WIDTH,
00551 UNUM_PADDING_POSITION,
00553
UNUM_SECONDARY_GROUPING_SIZE,
00556
UNUM_SIGNIFICANT_DIGITS_USED,
00559
UNUM_MIN_SIGNIFICANT_DIGITS,
00562
UNUM_MAX_SIGNIFICANT_DIGITS,
00566
UNUM_LENIENT_PARSE
00567 }
UNumberFormatAttribute;
00568
00585
U_CAPI int32_t U_EXPORT2
00586
unum_getAttribute(
const UNumberFormat* fmt,
00587 UNumberFormatAttribute attr);
00588
00608
U_CAPI void U_EXPORT2
00609
unum_setAttribute( UNumberFormat* fmt,
00610 UNumberFormatAttribute attr,
00611 int32_t newValue);
00612
00613
00628
U_CAPI double U_EXPORT2
00629
unum_getDoubleAttribute(
const UNumberFormat* fmt,
00630 UNumberFormatAttribute attr);
00631
00646
U_CAPI void U_EXPORT2
00647
unum_setDoubleAttribute( UNumberFormat* fmt,
00648 UNumberFormatAttribute attr,
00649
double newValue);
00650
00652
typedef enum UNumberFormatTextAttribute {
00654
UNUM_POSITIVE_PREFIX,
00656
UNUM_POSITIVE_SUFFIX,
00658
UNUM_NEGATIVE_PREFIX,
00660
UNUM_NEGATIVE_SUFFIX,
00662
UNUM_PADDING_CHARACTER,
00664
UNUM_CURRENCY_CODE,
00669
UNUM_DEFAULT_RULESET,
00676
UNUM_PUBLIC_RULESETS
00677 }
UNumberFormatTextAttribute;
00678
00697
U_CAPI int32_t U_EXPORT2
00698
unum_getTextAttribute(
const UNumberFormat* fmt,
00699 UNumberFormatTextAttribute tag,
00700 UChar* result,
00701 int32_t resultLength,
00702 UErrorCode* status);
00703
00720
U_CAPI void U_EXPORT2
00721
unum_setTextAttribute( UNumberFormat* fmt,
00722 UNumberFormatTextAttribute tag,
00723
const UChar* newValue,
00724 int32_t newValueLength,
00725 UErrorCode *status);
00726
00743
U_CAPI int32_t U_EXPORT2
00744
unum_toPattern(
const UNumberFormat* fmt,
00745 UBool isPatternLocalized,
00746 UChar* result,
00747 int32_t resultLength,
00748 UErrorCode* status);
00749
00751
#define UNFSYMBOLSMAXSIZE 10
00752
00757
typedef enum UNumberFormatSymbol {
00759
UNUM_DECIMAL_SEPARATOR_SYMBOL,
00761
UNUM_GROUPING_SEPARATOR_SYMBOL,
00763
UNUM_PATTERN_SEPARATOR_SYMBOL,
00765
UNUM_PERCENT_SYMBOL,
00767
UNUM_ZERO_DIGIT_SYMBOL,
00769
UNUM_DIGIT_SYMBOL,
00771
UNUM_MINUS_SIGN_SYMBOL,
00773
UNUM_PLUS_SIGN_SYMBOL,
00775
UNUM_CURRENCY_SYMBOL,
00777
UNUM_INTL_CURRENCY_SYMBOL,
00779
UNUM_MONETARY_SEPARATOR_SYMBOL,
00781
UNUM_EXPONENTIAL_SYMBOL,
00783
UNUM_PERMILL_SYMBOL,
00785
UNUM_PAD_ESCAPE_SYMBOL,
00787
UNUM_INFINITY_SYMBOL,
00789
UNUM_NAN_SYMBOL,
00792
UNUM_SIGNIFICANT_DIGIT_SYMBOL,
00794
UNUM_FORMAT_SYMBOL_COUNT
00795 }
UNumberFormatSymbol;
00796
00813
U_CAPI int32_t U_EXPORT2
00814
unum_getSymbol(
const UNumberFormat *fmt,
00815 UNumberFormatSymbol symbol,
00816 UChar *buffer,
00817 int32_t size,
00818 UErrorCode *status);
00819
00833
U_CAPI void U_EXPORT2
00834
unum_setSymbol(UNumberFormat *fmt,
00835 UNumberFormatSymbol symbol,
00836
const UChar *value,
00837 int32_t length,
00838 UErrorCode *status);
00839
00840
00850
U_CAPI const char*
U_EXPORT2
00851
unum_getLocaleByType(
const UNumberFormat *fmt,
00852 ULocDataLocaleType type,
00853 UErrorCode* status);
00854
00855
#endif
00856
00857
#endif