ICU 49.1.1  49.1.1
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 
365 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
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 
766 
783 U_STABLE int32_t U_EXPORT2
786 
806 U_STABLE void U_EXPORT2
809  int32_t newValue);
810 
811 
826 U_STABLE double U_EXPORT2
829 
844 U_STABLE void U_EXPORT2
847  double newValue);
848 
876 
895 U_STABLE int32_t U_EXPORT2
898  UChar* result,
899  int32_t resultLength,
900  UErrorCode* status);
901 
918 U_STABLE void U_EXPORT2
921  const UChar* newValue,
922  int32_t newValueLength,
923  UErrorCode *status);
924 
941 U_STABLE int32_t U_EXPORT2
942 unum_toPattern( const UNumberFormat* fmt,
943  UBool isPatternLocalized,
944  UChar* result,
945  int32_t resultLength,
946  UErrorCode* status);
947 
948 
953 typedef enum UNumberFormatSymbol {
1032 
1049 U_STABLE int32_t U_EXPORT2
1050 unum_getSymbol(const UNumberFormat *fmt,
1051  UNumberFormatSymbol symbol,
1052  UChar *buffer,
1053  int32_t size,
1054  UErrorCode *status);
1055 
1069 U_STABLE void U_EXPORT2
1071  UNumberFormatSymbol symbol,
1072  const UChar *value,
1073  int32_t length,
1074  UErrorCode *status);
1075 
1076 
1086 U_STABLE const char* U_EXPORT2
1088  ULocDataLocaleType type,
1089  UErrorCode* status);
1090 
1091 #endif /* #if !UCONFIG_NO_FORMATTING */
1092 
1093 #endif