ICU 50.1.2  50.1.2
unum.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 1997-2012, 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 
266 };
275 typedef enum UNumberFormatFields {
301 
302 
334 U_STABLE UNumberFormat* U_EXPORT2
336  const UChar* pattern,
337  int32_t patternLength,
338  const char* locale,
339  UParseError* parseErr,
340  UErrorCode* status);
341 
342 
349 U_STABLE void U_EXPORT2
351 
352 #if U_SHOW_CPLUSPLUS_API
353 
355 
366 
368 
369 #endif
370 
379 U_STABLE UNumberFormat* U_EXPORT2
380 unum_clone(const UNumberFormat *fmt,
381  UErrorCode *status);
382 
404 U_STABLE int32_t U_EXPORT2
405 unum_format( const UNumberFormat* fmt,
406  int32_t number,
407  UChar* result,
408  int32_t resultLength,
409  UFieldPosition *pos,
410  UErrorCode* status);
411 
433 U_STABLE int32_t U_EXPORT2
435  int64_t number,
436  UChar* result,
437  int32_t resultLength,
438  UFieldPosition *pos,
439  UErrorCode* status);
440 
462 U_STABLE int32_t U_EXPORT2
463 unum_formatDouble( const UNumberFormat* fmt,
464  double number,
465  UChar* result,
466  int32_t resultLength,
467  UFieldPosition *pos, /* 0 if ignore */
468  UErrorCode* status);
469 
495 U_STABLE int32_t U_EXPORT2
497  const char * number,
498  int32_t length,
499  UChar* result,
500  int32_t resultLength,
501  UFieldPosition *pos, /* 0 if ignore */
502  UErrorCode* status);
503 
525 U_STABLE int32_t U_EXPORT2
527  double number,
528  UChar* currency,
529  UChar* result,
530  int32_t resultLength,
531  UFieldPosition* pos, /* ignored if 0 */
532  UErrorCode* status);
533 
551 U_STABLE int32_t U_EXPORT2
552 unum_parse( const UNumberFormat* fmt,
553  const UChar* text,
554  int32_t textLength,
555  int32_t *parsePos /* 0 = start */,
556  UErrorCode *status);
557 
575 U_STABLE int64_t U_EXPORT2
576 unum_parseInt64(const UNumberFormat* fmt,
577  const UChar* text,
578  int32_t textLength,
579  int32_t *parsePos /* 0 = start */,
580  UErrorCode *status);
581 
599 U_STABLE double U_EXPORT2
600 unum_parseDouble( const UNumberFormat* fmt,
601  const UChar* text,
602  int32_t textLength,
603  int32_t *parsePos /* 0 = start */,
604  UErrorCode *status);
605 
606 
632 U_STABLE int32_t U_EXPORT2
634  const UChar* text,
635  int32_t textLength,
636  int32_t *parsePos /* 0 = start */,
637  char *outBuf,
638  int32_t outBufLength,
639  UErrorCode *status);
640 
660 U_STABLE double U_EXPORT2
662  const UChar* text,
663  int32_t textLength,
664  int32_t* parsePos, /* 0 = start */
665  UChar* currency,
666  UErrorCode* status);
667 
684 U_STABLE void U_EXPORT2
686  UBool localized,
687  const UChar *pattern,
688  int32_t patternLength,
689  UParseError *parseError,
690  UErrorCode *status
691  );
692 
703 U_STABLE const char* U_EXPORT2
704 unum_getAvailable(int32_t localeIndex);
705 
715 U_STABLE int32_t U_EXPORT2
716 unum_countAvailable(void);
717 
718 #if UCONFIG_HAVE_PARSEALLINPUT
719 
722 typedef enum UNumberFormatAttributeValue {
724  UNUM_NO = 0,
726  UNUM_YES = 1,
728  UNUM_MAYBE = 2
729 } UNumberFormatAttributeValue;
730 #endif
731 
779 #if UCONFIG_HAVE_PARSEALLINPUT
780 
784  UNUM_PARSE_ALL_INPUT,
785 #endif
786 
790 
795 
809 
814 
831 U_STABLE int32_t U_EXPORT2
834 
854 U_STABLE void U_EXPORT2
857  int32_t newValue);
858 
859 
874 U_STABLE double U_EXPORT2
877 
892 U_STABLE void U_EXPORT2
895  double newValue);
896 
924 
943 U_STABLE int32_t U_EXPORT2
946  UChar* result,
947  int32_t resultLength,
948  UErrorCode* status);
949 
966 U_STABLE void U_EXPORT2
969  const UChar* newValue,
970  int32_t newValueLength,
971  UErrorCode *status);
972 
989 U_STABLE int32_t U_EXPORT2
990 unum_toPattern( const UNumberFormat* fmt,
991  UBool isPatternLocalized,
992  UChar* result,
993  int32_t resultLength,
994  UErrorCode* status);
995 
996 
1001 typedef enum UNumberFormatSymbol {
1080 
1097 U_STABLE int32_t U_EXPORT2
1098 unum_getSymbol(const UNumberFormat *fmt,
1099  UNumberFormatSymbol symbol,
1100  UChar *buffer,
1101  int32_t size,
1102  UErrorCode *status);
1103 
1117 U_STABLE void U_EXPORT2
1119  UNumberFormatSymbol symbol,
1120  const UChar *value,
1121  int32_t length,
1122  UErrorCode *status);
1123 
1124 
1134 U_STABLE const char* U_EXPORT2
1136  ULocDataLocaleType type,
1137  UErrorCode* status);
1138 
1139 #endif /* #if !UCONFIG_NO_FORMATTING */
1140 
1141 #endif