ICU 51.2  51.2
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"
130 typedef void* UNumberFormat;
131 
135 typedef enum UNumberFormatStyle {
213 
218  UNUM_ROUND_CEILING,
219  UNUM_ROUND_FLOOR,
220  UNUM_ROUND_DOWN,
221  UNUM_ROUND_UP,
227 #ifndef U_HIDE_DEPRECATED_API
228 
233 #endif /* U_HIDE_DEPRECATED_API */
234  UNUM_ROUND_HALFDOWN,
235  UNUM_ROUND_HALFUP,
242 
247  UNUM_PAD_BEFORE_PREFIX,
248  UNUM_PAD_AFTER_PREFIX,
249  UNUM_PAD_BEFORE_SUFFIX,
250  UNUM_PAD_AFTER_SUFFIX
252 
253 #ifndef U_HIDE_DRAFT_API
254 
258 typedef enum UNumberCompactStyle {
265 #endif /* U_HIDE_DRAFT_API */
266 
280 };
289 typedef enum UNumberFormatFields {
315 
316 
348 U_STABLE UNumberFormat* U_EXPORT2
350  const UChar* pattern,
351  int32_t patternLength,
352  const char* locale,
353  UParseError* parseErr,
354  UErrorCode* status);
355 
356 
363 U_STABLE void U_EXPORT2
365 
366 #if U_SHOW_CPLUSPLUS_API
367 
369 
380 
382 
383 #endif
384 
393 U_STABLE UNumberFormat* U_EXPORT2
394 unum_clone(const UNumberFormat *fmt,
395  UErrorCode *status);
396 
418 U_STABLE int32_t U_EXPORT2
419 unum_format( const UNumberFormat* fmt,
420  int32_t number,
421  UChar* result,
422  int32_t resultLength,
423  UFieldPosition *pos,
424  UErrorCode* status);
425 
447 U_STABLE int32_t U_EXPORT2
449  int64_t number,
450  UChar* result,
451  int32_t resultLength,
452  UFieldPosition *pos,
453  UErrorCode* status);
454 
476 U_STABLE int32_t U_EXPORT2
477 unum_formatDouble( const UNumberFormat* fmt,
478  double number,
479  UChar* result,
480  int32_t resultLength,
481  UFieldPosition *pos, /* 0 if ignore */
482  UErrorCode* status);
483 
509 U_STABLE int32_t U_EXPORT2
511  const char * number,
512  int32_t length,
513  UChar* result,
514  int32_t resultLength,
515  UFieldPosition *pos, /* 0 if ignore */
516  UErrorCode* status);
517 
539 U_STABLE int32_t U_EXPORT2
541  double number,
542  UChar* currency,
543  UChar* result,
544  int32_t resultLength,
545  UFieldPosition* pos, /* ignored if 0 */
546  UErrorCode* status);
547 
565 U_STABLE int32_t U_EXPORT2
566 unum_parse( const UNumberFormat* fmt,
567  const UChar* text,
568  int32_t textLength,
569  int32_t *parsePos /* 0 = start */,
570  UErrorCode *status);
571 
589 U_STABLE int64_t U_EXPORT2
590 unum_parseInt64(const UNumberFormat* fmt,
591  const UChar* text,
592  int32_t textLength,
593  int32_t *parsePos /* 0 = start */,
594  UErrorCode *status);
595 
613 U_STABLE double U_EXPORT2
614 unum_parseDouble( const UNumberFormat* fmt,
615  const UChar* text,
616  int32_t textLength,
617  int32_t *parsePos /* 0 = start */,
618  UErrorCode *status);
619 
620 
646 U_STABLE int32_t U_EXPORT2
648  const UChar* text,
649  int32_t textLength,
650  int32_t *parsePos /* 0 = start */,
651  char *outBuf,
652  int32_t outBufLength,
653  UErrorCode *status);
654 
674 U_STABLE double U_EXPORT2
676  const UChar* text,
677  int32_t textLength,
678  int32_t* parsePos, /* 0 = start */
679  UChar* currency,
680  UErrorCode* status);
681 
698 U_STABLE void U_EXPORT2
700  UBool localized,
701  const UChar *pattern,
702  int32_t patternLength,
703  UParseError *parseError,
704  UErrorCode *status
705  );
706 
717 U_STABLE const char* U_EXPORT2
718 unum_getAvailable(int32_t localeIndex);
719 
729 U_STABLE int32_t U_EXPORT2
730 unum_countAvailable(void);
731 
732 #if UCONFIG_HAVE_PARSEALLINPUT
733 
736 typedef enum UNumberFormatAttributeValue {
738  UNUM_NO = 0,
740  UNUM_YES = 1,
742  UNUM_MAYBE = 2
743 } UNumberFormatAttributeValue;
744 #endif
745 
793 #if UCONFIG_HAVE_PARSEALLINPUT
794 
798  UNUM_PARSE_ALL_INPUT,
799 #endif
800 #ifndef U_HIDE_DRAFT_API
801 
811 #endif /* U_HIDE_DRAFT_API */
812 #ifndef U_HIDE_INTERNAL_API
813 
816 
821 #endif /* U_HIDE_INTERNAL_API */
822 
823 #ifndef U_HIDE_DRAFT_API
824 
837 #endif /* U_HIDE_DRAFT_API */
838 
839 #ifndef U_HIDE_INTERNAL_API
840 
843 #endif /* U_HIDE_INTERNAL_API */
845 
863 U_STABLE int32_t U_EXPORT2
866 
886 U_STABLE void U_EXPORT2
889  int32_t newValue);
890 
891 
906 U_STABLE double U_EXPORT2
909 
924 U_STABLE void U_EXPORT2
927  double newValue);
928 
956 
975 U_STABLE int32_t U_EXPORT2
978  UChar* result,
979  int32_t resultLength,
980  UErrorCode* status);
981 
998 U_STABLE void U_EXPORT2
1001  const UChar* newValue,
1002  int32_t newValueLength,
1003  UErrorCode *status);
1004 
1021 U_STABLE int32_t U_EXPORT2
1022 unum_toPattern( const UNumberFormat* fmt,
1023  UBool isPatternLocalized,
1024  UChar* result,
1025  int32_t resultLength,
1026  UErrorCode* status);
1027 
1028 
1033 typedef enum UNumberFormatSymbol {
1112 
1129 U_STABLE int32_t U_EXPORT2
1130 unum_getSymbol(const UNumberFormat *fmt,
1131  UNumberFormatSymbol symbol,
1132  UChar *buffer,
1133  int32_t size,
1134  UErrorCode *status);
1135 
1149 U_STABLE void U_EXPORT2
1151  UNumberFormatSymbol symbol,
1152  const UChar *value,
1153  int32_t length,
1154  UErrorCode *status);
1155 
1156 
1166 U_STABLE const char* U_EXPORT2
1168  ULocDataLocaleType type,
1169  UErrorCode* status);
1170 
1171 #endif /* #if !UCONFIG_NO_FORMATTING */
1172 
1173 #endif