ICU 56.1  56.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
unum.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 1997-2015, 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/ucurr.h"
22 #include "unicode/umisc.h"
23 #include "unicode/parseerr.h"
24 #include "unicode/uformattable.h"
26 
134 typedef void* UNumberFormat;
135 
139 typedef enum UNumberFormatStyle {
222 #ifndef U_HIDE_DRAFT_API
223 
244 #endif /* U_HIDE_DRAFT_API */
245 
251 
263 
268  UNUM_ROUND_CEILING,
269  UNUM_ROUND_FLOOR,
270  UNUM_ROUND_DOWN,
271  UNUM_ROUND_UP,
277 #ifndef U_HIDE_DEPRECATED_API
278 
283 #endif /* U_HIDE_DEPRECATED_API */
284  UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
285  UNUM_ROUND_HALFUP,
292 
297  UNUM_PAD_BEFORE_PREFIX,
298  UNUM_PAD_AFTER_PREFIX,
299  UNUM_PAD_BEFORE_SUFFIX,
300  UNUM_PAD_AFTER_SUFFIX
302 
307 typedef enum UNumberCompactStyle {
314 
328 };
337 typedef enum UNumberFormatFields {
363 
364 
398 U_STABLE UNumberFormat* U_EXPORT2
400  const UChar* pattern,
401  int32_t patternLength,
402  const char* locale,
403  UParseError* parseErr,
404  UErrorCode* status);
405 
406 
413 U_STABLE void U_EXPORT2
415 
416 #if U_SHOW_CPLUSPLUS_API
417 
419 
430 
432 
433 #endif
434 
443 U_STABLE UNumberFormat* U_EXPORT2
444 unum_clone(const UNumberFormat *fmt,
445  UErrorCode *status);
446 
471 U_STABLE int32_t U_EXPORT2
472 unum_format( const UNumberFormat* fmt,
473  int32_t number,
474  UChar* result,
475  int32_t resultLength,
476  UFieldPosition *pos,
477  UErrorCode* status);
478 
503 U_STABLE int32_t U_EXPORT2
505  int64_t number,
506  UChar* result,
507  int32_t resultLength,
508  UFieldPosition *pos,
509  UErrorCode* status);
510 
535 U_STABLE int32_t U_EXPORT2
536 unum_formatDouble( const UNumberFormat* fmt,
537  double number,
538  UChar* result,
539  int32_t resultLength,
540  UFieldPosition *pos, /* 0 if ignore */
541  UErrorCode* status);
542 
571 U_STABLE int32_t U_EXPORT2
573  const char * number,
574  int32_t length,
575  UChar* result,
576  int32_t resultLength,
577  UFieldPosition *pos, /* 0 if ignore */
578  UErrorCode* status);
579 
604 U_STABLE int32_t U_EXPORT2
606  double number,
607  UChar* currency,
608  UChar* result,
609  int32_t resultLength,
610  UFieldPosition* pos,
611  UErrorCode* status);
612 
633 U_STABLE int32_t U_EXPORT2
635  const UFormattable *number,
636  UChar *result,
637  int32_t resultLength,
638  UFieldPosition *pos,
639  UErrorCode *status);
640 
660 U_STABLE int32_t U_EXPORT2
661 unum_parse( const UNumberFormat* fmt,
662  const UChar* text,
663  int32_t textLength,
664  int32_t *parsePos /* 0 = start */,
665  UErrorCode *status);
666 
686 U_STABLE int64_t U_EXPORT2
687 unum_parseInt64(const UNumberFormat* fmt,
688  const UChar* text,
689  int32_t textLength,
690  int32_t *parsePos /* 0 = start */,
691  UErrorCode *status);
692 
712 U_STABLE double U_EXPORT2
713 unum_parseDouble( const UNumberFormat* fmt,
714  const UChar* text,
715  int32_t textLength,
716  int32_t *parsePos /* 0 = start */,
717  UErrorCode *status);
718 
719 
747 U_STABLE int32_t U_EXPORT2
749  const UChar* text,
750  int32_t textLength,
751  int32_t *parsePos /* 0 = start */,
752  char *outBuf,
753  int32_t outBufLength,
754  UErrorCode *status);
755 
775 U_STABLE double U_EXPORT2
777  const UChar* text,
778  int32_t textLength,
779  int32_t* parsePos, /* 0 = start */
780  UChar* currency,
781  UErrorCode* status);
782 
803 U_STABLE UFormattable* U_EXPORT2
805  UFormattable *result,
806  const UChar* text,
807  int32_t textLength,
808  int32_t* parsePos, /* 0 = start */
809  UErrorCode* status);
810 
827 U_STABLE void U_EXPORT2
829  UBool localized,
830  const UChar *pattern,
831  int32_t patternLength,
832  UParseError *parseError,
833  UErrorCode *status
834  );
835 
846 U_STABLE const char* U_EXPORT2
847 unum_getAvailable(int32_t localeIndex);
848 
858 U_STABLE int32_t U_EXPORT2
859 unum_countAvailable(void);
860 
861 #if UCONFIG_HAVE_PARSEALLINPUT
862 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
866 typedef enum UNumberFormatAttributeValue {
867 #ifndef U_HIDE_INTERNAL_API
868 
869  UNUM_NO = 0,
871  UNUM_YES = 1,
873  UNUM_MAYBE = 2
874 #else
875 
876  UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
877 #endif /* U_HIDE_INTERNAL_API */
878 } UNumberFormatAttributeValue;
879 #endif
880 
928 #if UCONFIG_HAVE_PARSEALLINPUT
929 
933  UNUM_PARSE_ALL_INPUT = 20,
934 #endif
935 
945 #ifndef U_HIDE_INTERNAL_API
946 
953  /* TODO: test C API when it becomes @draft */
954 #endif /* U_HIDE_INTERNAL_API */
955 
963 
964  /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
969 
983 
993 
994  /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
999 
1017 U_STABLE int32_t U_EXPORT2
1018 unum_getAttribute(const UNumberFormat* fmt,
1019  UNumberFormatAttribute attr);
1020 
1040 U_STABLE void U_EXPORT2
1043  int32_t newValue);
1044 
1045 
1060 U_STABLE double U_EXPORT2
1062  UNumberFormatAttribute attr);
1063 
1078 U_STABLE void U_EXPORT2
1081  double newValue);
1082 
1116 
1135 U_STABLE int32_t U_EXPORT2
1138  UChar* result,
1139  int32_t resultLength,
1140  UErrorCode* status);
1141 
1158 U_STABLE void U_EXPORT2
1161  const UChar* newValue,
1162  int32_t newValueLength,
1163  UErrorCode *status);
1164 
1181 U_STABLE int32_t U_EXPORT2
1182 unum_toPattern( const UNumberFormat* fmt,
1183  UBool isPatternLocalized,
1184  UChar* result,
1185  int32_t resultLength,
1186  UErrorCode* status);
1187 
1188 
1193 typedef enum UNumberFormatSymbol {
1269 
1274 
1278 
1295 U_STABLE int32_t U_EXPORT2
1296 unum_getSymbol(const UNumberFormat *fmt,
1297  UNumberFormatSymbol symbol,
1298  UChar *buffer,
1299  int32_t size,
1300  UErrorCode *status);
1301 
1315 U_STABLE void U_EXPORT2
1317  UNumberFormatSymbol symbol,
1318  const UChar *value,
1319  int32_t length,
1320  UErrorCode *status);
1321 
1322 
1332 U_STABLE const char* U_EXPORT2
1334  ULocDataLocaleType type,
1335  UErrorCode* status);
1336 
1345 U_STABLE void U_EXPORT2
1347 
1357 U_STABLE UDisplayContext U_EXPORT2
1358 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1359 
1360 #endif /* #if !UCONFIG_NO_FORMATTING */
1361 
1362 #endif