ICU 52.1  52.1
unum.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 1997-2013, 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"
23 #include "unicode/uformattable.h"
24 
132 typedef void* UNumberFormat;
133 
137 typedef enum UNumberFormatStyle {
215 
220  UNUM_ROUND_CEILING,
221  UNUM_ROUND_FLOOR,
222  UNUM_ROUND_DOWN,
223  UNUM_ROUND_UP,
229 #ifndef U_HIDE_DEPRECATED_API
230 
235 #endif /* U_HIDE_DEPRECATED_API */
236  UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
237  UNUM_ROUND_HALFUP,
244 
249  UNUM_PAD_BEFORE_PREFIX,
250  UNUM_PAD_AFTER_PREFIX,
251  UNUM_PAD_BEFORE_SUFFIX,
252  UNUM_PAD_AFTER_SUFFIX
254 
255 #ifndef U_HIDE_DRAFT_API
256 
260 typedef enum UNumberCompactStyle {
267 #endif /* U_HIDE_DRAFT_API */
268 
282 };
291 typedef enum UNumberFormatFields {
317 
318 
350 U_STABLE UNumberFormat* U_EXPORT2
352  const UChar* pattern,
353  int32_t patternLength,
354  const char* locale,
355  UParseError* parseErr,
356  UErrorCode* status);
357 
358 
365 U_STABLE void U_EXPORT2
367 
368 #if U_SHOW_CPLUSPLUS_API
369 
371 
382 
384 
385 #endif
386 
395 U_STABLE UNumberFormat* U_EXPORT2
396 unum_clone(const UNumberFormat *fmt,
397  UErrorCode *status);
398 
423 U_STABLE int32_t U_EXPORT2
424 unum_format( const UNumberFormat* fmt,
425  int32_t number,
426  UChar* result,
427  int32_t resultLength,
428  UFieldPosition *pos,
429  UErrorCode* status);
430 
455 U_STABLE int32_t U_EXPORT2
457  int64_t number,
458  UChar* result,
459  int32_t resultLength,
460  UFieldPosition *pos,
461  UErrorCode* status);
462 
487 U_STABLE int32_t U_EXPORT2
488 unum_formatDouble( const UNumberFormat* fmt,
489  double number,
490  UChar* result,
491  int32_t resultLength,
492  UFieldPosition *pos, /* 0 if ignore */
493  UErrorCode* status);
494 
523 U_STABLE int32_t U_EXPORT2
525  const char * number,
526  int32_t length,
527  UChar* result,
528  int32_t resultLength,
529  UFieldPosition *pos, /* 0 if ignore */
530  UErrorCode* status);
531 
556 U_STABLE int32_t U_EXPORT2
558  double number,
559  UChar* currency,
560  UChar* result,
561  int32_t resultLength,
562  UFieldPosition* pos,
563  UErrorCode* status);
564 
565 #ifndef U_HIDE_DRAFT_API
566 
586 U_DRAFT int32_t U_EXPORT2
588  const UFormattable *number,
589  UChar *result,
590  int32_t resultLength,
591  UFieldPosition *pos,
592  UErrorCode *status);
593 #endif /* U_HIDE_DRAFT_API */
594 
612 U_STABLE int32_t U_EXPORT2
613 unum_parse( const UNumberFormat* fmt,
614  const UChar* text,
615  int32_t textLength,
616  int32_t *parsePos /* 0 = start */,
617  UErrorCode *status);
618 
636 U_STABLE int64_t U_EXPORT2
637 unum_parseInt64(const UNumberFormat* fmt,
638  const UChar* text,
639  int32_t textLength,
640  int32_t *parsePos /* 0 = start */,
641  UErrorCode *status);
642 
660 U_STABLE double U_EXPORT2
661 unum_parseDouble( const UNumberFormat* fmt,
662  const UChar* text,
663  int32_t textLength,
664  int32_t *parsePos /* 0 = start */,
665  UErrorCode *status);
666 
667 
693 U_STABLE int32_t U_EXPORT2
695  const UChar* text,
696  int32_t textLength,
697  int32_t *parsePos /* 0 = start */,
698  char *outBuf,
699  int32_t outBufLength,
700  UErrorCode *status);
701 
721 U_STABLE double U_EXPORT2
723  const UChar* text,
724  int32_t textLength,
725  int32_t* parsePos, /* 0 = start */
726  UChar* currency,
727  UErrorCode* status);
728 
729 #ifndef U_HIDE_DRAFT_API
730 
748 U_DRAFT UFormattable* U_EXPORT2
750  UFormattable *result,
751  const UChar* text,
752  int32_t textLength,
753  int32_t* parsePos, /* 0 = start */
754  UErrorCode* status);
755 #endif /* U_HIDE_DRAFT_API */
756 
773 U_STABLE void U_EXPORT2
775  UBool localized,
776  const UChar *pattern,
777  int32_t patternLength,
778  UParseError *parseError,
779  UErrorCode *status
780  );
781 
792 U_STABLE const char* U_EXPORT2
793 unum_getAvailable(int32_t localeIndex);
794 
804 U_STABLE int32_t U_EXPORT2
805 unum_countAvailable(void);
806 
807 #if UCONFIG_HAVE_PARSEALLINPUT
808 
811 typedef enum UNumberFormatAttributeValue {
813  UNUM_NO = 0,
815  UNUM_YES = 1,
817  UNUM_MAYBE = 2
818 } UNumberFormatAttributeValue;
819 #endif
820 
868 #if UCONFIG_HAVE_PARSEALLINPUT
869 
873  UNUM_PARSE_ALL_INPUT = UNUM_LENIENT_PARSE + 1,
874 #endif
875 #ifndef U_HIDE_DRAFT_API
876 
886 #endif /* U_HIDE_DRAFT_API */
887 
888 #ifndef U_HIDE_INTERNAL_API
889 
892 
897 #endif /* U_HIDE_INTERNAL_API */
898 
912 
913 #ifndef U_HIDE_INTERNAL_API
914 
917 #endif /* U_HIDE_INTERNAL_API */
919 
937 U_STABLE int32_t U_EXPORT2
940 
960 U_STABLE void U_EXPORT2
963  int32_t newValue);
964 
965 
980 U_STABLE double U_EXPORT2
983 
998 U_STABLE void U_EXPORT2
1001  double newValue);
1002 
1030 
1049 U_STABLE int32_t U_EXPORT2
1052  UChar* result,
1053  int32_t resultLength,
1054  UErrorCode* status);
1055 
1072 U_STABLE void U_EXPORT2
1075  const UChar* newValue,
1076  int32_t newValueLength,
1077  UErrorCode *status);
1078 
1095 U_STABLE int32_t U_EXPORT2
1096 unum_toPattern( const UNumberFormat* fmt,
1097  UBool isPatternLocalized,
1098  UChar* result,
1099  int32_t resultLength,
1100  UErrorCode* status);
1101 
1102 
1107 typedef enum UNumberFormatSymbol {
1186 
1203 U_STABLE int32_t U_EXPORT2
1204 unum_getSymbol(const UNumberFormat *fmt,
1205  UNumberFormatSymbol symbol,
1206  UChar *buffer,
1207  int32_t size,
1208  UErrorCode *status);
1209 
1223 U_STABLE void U_EXPORT2
1225  UNumberFormatSymbol symbol,
1226  const UChar *value,
1227  int32_t length,
1228  UErrorCode *status);
1229 
1230 
1240 U_STABLE const char* U_EXPORT2
1242  ULocDataLocaleType type,
1243  UErrorCode* status);
1244 
1245 #endif /* #if !UCONFIG_NO_FORMATTING */
1246 
1247 #endif