ICU 4.8.1.1
4.8.1.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
i18n
unicode
unum.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************
3
* Copyright (C) 1997-2011, International Business Machines Corporation and others.
4
* All Rights Reserved.
5
* Modification History:
6
*
7
* Date Name Description
8
* 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes
9
*******************************************************************************
10
*/
11
12
#ifndef _UNUM
13
#define _UNUM
14
15
#include "
unicode/utypes.h
"
16
17
#if !UCONFIG_NO_FORMATTING
18
19
#include "
unicode/localpointer.h
"
20
#include "
unicode/uloc.h
"
21
#include "
unicode/umisc.h
"
22
#include "
unicode/parseerr.h
"
130
typedef
void
*
UNumberFormat
;
131
135
typedef
enum
UNumberFormatStyle
{
140
UNUM_PATTERN_DECIMAL
=0,
145
UNUM_DECIMAL
=1,
150
UNUM_CURRENCY
,
155
UNUM_PERCENT
,
160
UNUM_SCIENTIFIC
,
165
UNUM_SPELLOUT
,
170
UNUM_ORDINAL
,
175
UNUM_DURATION
,
180
UNUM_NUMBERING_SYSTEM
,
185
UNUM_PATTERN_RULEBASED
,
190
UNUM_CURRENCY_ISO
,
196
UNUM_CURRENCY_PLURAL
,
201
UNUM_FORMAT_STYLE_COUNT
,
206
UNUM_DEFAULT
=
UNUM_DECIMAL
,
211
UNUM_IGNORE
=
UNUM_PATTERN_DECIMAL
212
}
UNumberFormatStyle
;
213
217
typedef
enum
UNumberFormatRoundingMode
{
218
UNUM_ROUND_CEILING,
219
UNUM_ROUND_FLOOR,
220
UNUM_ROUND_DOWN,
221
UNUM_ROUND_UP,
226
UNUM_FOUND_HALFEVEN
,
227
UNUM_ROUND_HALFDOWN,
228
UNUM_ROUND_HALFUP,
233
UNUM_ROUND_UNNECESSARY
,
238
UNUM_ROUND_HALFEVEN
=
UNUM_FOUND_HALFEVEN
239
}
UNumberFormatRoundingMode
;
240
244
typedef
enum
UNumberFormatPadPosition
{
245
UNUM_PAD_BEFORE_PREFIX,
246
UNUM_PAD_AFTER_PREFIX,
247
UNUM_PAD_BEFORE_SUFFIX,
248
UNUM_PAD_AFTER_SUFFIX
249
}
UNumberFormatPadPosition
;
250
255
enum
UCurrencySpacing
{
256
UNUM_CURRENCY_MATCH,
257
UNUM_CURRENCY_SURROUNDING_MATCH,
258
UNUM_CURRENCY_INSERT,
259
UNUM_CURRENCY_SPACING_COUNT
260
};
261
typedef
enum
UCurrencySpacing
UCurrencySpacing
;
294
U_STABLE
UNumberFormat
*
U_EXPORT2
295
unum_open
(
UNumberFormatStyle
style,
296
const
UChar
* pattern,
297
int32_t patternLength,
298
const
char
* locale,
299
UParseError
* parseErr,
300
UErrorCode
* status);
301
302
309
U_STABLE
void
U_EXPORT2
310
unum_close
(
UNumberFormat
* fmt);
311
312
#if U_SHOW_CPLUSPLUS_API
313
314
U_NAMESPACE_BEGIN
315
325
U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer,
UNumberFormat
,
unum_close
);
326
327
U_NAMESPACE_END
328
329
#endif
330
339
U_STABLE
UNumberFormat
*
U_EXPORT2
340
unum_clone
(
const
UNumberFormat
*fmt,
341
UErrorCode
*status);
342
364
U_STABLE
int32_t
U_EXPORT2
365
unum_format
(
const
UNumberFormat
* fmt,
366
int32_t number,
367
UChar
* result,
368
int32_t resultLength,
369
UFieldPosition
*pos,
370
UErrorCode
* status);
371
393
U_STABLE
int32_t
U_EXPORT2
394
unum_formatInt64
(
const
UNumberFormat
*fmt,
395
int64_t number,
396
UChar
* result,
397
int32_t resultLength,
398
UFieldPosition
*pos,
399
UErrorCode
* status);
400
422
U_STABLE
int32_t
U_EXPORT2
423
unum_formatDouble
(
const
UNumberFormat
* fmt,
424
double
number,
425
UChar
* result,
426
int32_t resultLength,
427
UFieldPosition
*pos,
/* 0 if ignore */
428
UErrorCode
* status);
429
455
U_STABLE
int32_t
U_EXPORT2
456
unum_formatDecimal
(
const
UNumberFormat
* fmt,
457
const
char
* number,
458
int32_t length,
459
UChar
* result,
460
int32_t resultLength,
461
UFieldPosition
*pos,
/* 0 if ignore */
462
UErrorCode
* status);
463
485
U_STABLE
int32_t
U_EXPORT2
486
unum_formatDoubleCurrency
(
const
UNumberFormat
* fmt,
487
double
number,
488
UChar
* currency,
489
UChar
* result,
490
int32_t resultLength,
491
UFieldPosition
* pos,
/* ignored if 0 */
492
UErrorCode
* status);
493
511
U_STABLE
int32_t
U_EXPORT2
512
unum_parse
(
const
UNumberFormat
* fmt,
513
const
UChar
* text,
514
int32_t textLength,
515
int32_t *parsePos
/* 0 = start */
,
516
UErrorCode
*status);
517
535
U_STABLE
int64_t
U_EXPORT2
536
unum_parseInt64
(
const
UNumberFormat
* fmt,
537
const
UChar
* text,
538
int32_t textLength,
539
int32_t *parsePos
/* 0 = start */
,
540
UErrorCode
*status);
541
559
U_STABLE
double
U_EXPORT2
560
unum_parseDouble
(
const
UNumberFormat
* fmt,
561
const
UChar
* text,
562
int32_t textLength,
563
int32_t *parsePos
/* 0 = start */
,
564
UErrorCode
*status);
565
566
592
U_STABLE
int32_t
U_EXPORT2
593
unum_parseDecimal
(
const
UNumberFormat
* fmt,
594
const
UChar
* text,
595
int32_t textLength,
596
int32_t *parsePos
/* 0 = start */
,
597
char
*outBuf,
598
int32_t outBufLength,
599
UErrorCode
*status);
600
620
U_STABLE
double
U_EXPORT2
621
unum_parseDoubleCurrency
(
const
UNumberFormat
* fmt,
622
const
UChar
* text,
623
int32_t textLength,
624
int32_t* parsePos,
/* 0 = start */
625
UChar
* currency,
626
UErrorCode
* status);
627
644
U_STABLE
void
U_EXPORT2
645
unum_applyPattern
(
UNumberFormat
*format,
646
UBool
localized,
647
const
UChar
*pattern,
648
int32_t patternLength,
649
UParseError
*parseError,
650
UErrorCode
*status
651
);
652
663
U_STABLE
const
char
*
U_EXPORT2
664
unum_getAvailable
(int32_t localeIndex);
665
675
U_STABLE
int32_t
U_EXPORT2
676
unum_countAvailable
(
void
);
677
679
typedef
enum
UNumberFormatAttribute
{
681
UNUM_PARSE_INT_ONLY
,
683
UNUM_GROUPING_USED
,
685
UNUM_DECIMAL_ALWAYS_SHOWN
,
687
UNUM_MAX_INTEGER_DIGITS
,
689
UNUM_MIN_INTEGER_DIGITS
,
691
UNUM_INTEGER_DIGITS
,
693
UNUM_MAX_FRACTION_DIGITS
,
695
UNUM_MIN_FRACTION_DIGITS
,
697
UNUM_FRACTION_DIGITS
,
699
UNUM_MULTIPLIER
,
701
UNUM_GROUPING_SIZE
,
703
UNUM_ROUNDING_MODE
,
705
UNUM_ROUNDING_INCREMENT
,
707
UNUM_FORMAT_WIDTH
,
709
UNUM_PADDING_POSITION
,
711
UNUM_SECONDARY_GROUPING_SIZE
,
714
UNUM_SIGNIFICANT_DIGITS_USED
,
717
UNUM_MIN_SIGNIFICANT_DIGITS
,
720
UNUM_MAX_SIGNIFICANT_DIGITS
,
724
UNUM_LENIENT_PARSE
725
}
UNumberFormatAttribute
;
726
743
U_STABLE
int32_t
U_EXPORT2
744
unum_getAttribute
(
const
UNumberFormat
* fmt,
745
UNumberFormatAttribute
attr);
746
766
U_STABLE
void
U_EXPORT2
767
unum_setAttribute
(
UNumberFormat
* fmt,
768
UNumberFormatAttribute
attr,
769
int32_t newValue);
770
771
786
U_STABLE
double
U_EXPORT2
787
unum_getDoubleAttribute
(
const
UNumberFormat
* fmt,
788
UNumberFormatAttribute
attr);
789
804
U_STABLE
void
U_EXPORT2
805
unum_setDoubleAttribute
(
UNumberFormat
* fmt,
806
UNumberFormatAttribute
attr,
807
double
newValue);
808
810
typedef
enum
UNumberFormatTextAttribute
{
812
UNUM_POSITIVE_PREFIX
,
814
UNUM_POSITIVE_SUFFIX
,
816
UNUM_NEGATIVE_PREFIX
,
818
UNUM_NEGATIVE_SUFFIX
,
820
UNUM_PADDING_CHARACTER
,
822
UNUM_CURRENCY_CODE
,
827
UNUM_DEFAULT_RULESET
,
834
UNUM_PUBLIC_RULESETS
835
}
UNumberFormatTextAttribute
;
836
855
U_STABLE
int32_t
U_EXPORT2
856
unum_getTextAttribute
(
const
UNumberFormat
* fmt,
857
UNumberFormatTextAttribute
tag,
858
UChar
* result,
859
int32_t resultLength,
860
UErrorCode
* status);
861
878
U_STABLE
void
U_EXPORT2
879
unum_setTextAttribute
(
UNumberFormat
* fmt,
880
UNumberFormatTextAttribute
tag,
881
const
UChar
* newValue,
882
int32_t newValueLength,
883
UErrorCode
*status);
884
901
U_STABLE
int32_t
U_EXPORT2
902
unum_toPattern
(
const
UNumberFormat
* fmt,
903
UBool
isPatternLocalized,
904
UChar
* result,
905
int32_t resultLength,
906
UErrorCode
* status);
907
908
913
typedef
enum
UNumberFormatSymbol
{
915
UNUM_DECIMAL_SEPARATOR_SYMBOL
= 0,
917
UNUM_GROUPING_SEPARATOR_SYMBOL
= 1,
919
UNUM_PATTERN_SEPARATOR_SYMBOL
= 2,
921
UNUM_PERCENT_SYMBOL
= 3,
923
UNUM_ZERO_DIGIT_SYMBOL
= 4,
925
UNUM_DIGIT_SYMBOL
= 5,
927
UNUM_MINUS_SIGN_SYMBOL
= 6,
929
UNUM_PLUS_SIGN_SYMBOL
= 7,
931
UNUM_CURRENCY_SYMBOL
= 8,
933
UNUM_INTL_CURRENCY_SYMBOL
= 9,
935
UNUM_MONETARY_SEPARATOR_SYMBOL
= 10,
937
UNUM_EXPONENTIAL_SYMBOL
= 11,
939
UNUM_PERMILL_SYMBOL
= 12,
941
UNUM_PAD_ESCAPE_SYMBOL
= 13,
943
UNUM_INFINITY_SYMBOL
= 14,
945
UNUM_NAN_SYMBOL
= 15,
948
UNUM_SIGNIFICANT_DIGIT_SYMBOL
= 16,
952
UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
= 17,
956
UNUM_ONE_DIGIT_SYMBOL
= 18,
960
UNUM_TWO_DIGIT_SYMBOL
= 19,
964
UNUM_THREE_DIGIT_SYMBOL
= 20,
968
UNUM_FOUR_DIGIT_SYMBOL
= 21,
972
UNUM_FIVE_DIGIT_SYMBOL
= 22,
976
UNUM_SIX_DIGIT_SYMBOL
= 23,
980
UNUM_SEVEN_DIGIT_SYMBOL
= 24,
984
UNUM_EIGHT_DIGIT_SYMBOL
= 25,
988
UNUM_NINE_DIGIT_SYMBOL
= 26,
990
UNUM_FORMAT_SYMBOL_COUNT
= 27
991
}
UNumberFormatSymbol
;
992
1009
U_STABLE
int32_t
U_EXPORT2
1010
unum_getSymbol
(
const
UNumberFormat
*fmt,
1011
UNumberFormatSymbol
symbol,
1012
UChar
*buffer,
1013
int32_t size,
1014
UErrorCode
*status);
1015
1029
U_STABLE
void
U_EXPORT2
1030
unum_setSymbol
(
UNumberFormat
*fmt,
1031
UNumberFormatSymbol
symbol,
1032
const
UChar
*value,
1033
int32_t length,
1034
UErrorCode
*status);
1035
1036
1046
U_STABLE
const
char
*
U_EXPORT2
1047
unum_getLocaleByType
(
const
UNumberFormat
*fmt,
1048
ULocDataLocaleType
type,
1049
UErrorCode
* status);
1050
1051
#endif
/* #if !UCONFIG_NO_FORMATTING */
1052
1053
#endif
Generated on Mon Dec 11 2017 18:07:29 for ICU 4.8.1.1 by
1.8.1.2