ICU 55.1  55.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 {
211 #ifndef U_HIDE_DRAFT_API
212 
218 #endif /* U_HIDE_DRAFT_API */
219 
225 
237 
242  UNUM_ROUND_CEILING,
243  UNUM_ROUND_FLOOR,
244  UNUM_ROUND_DOWN,
245  UNUM_ROUND_UP,
251 #ifndef U_HIDE_DEPRECATED_API
252 
257 #endif /* U_HIDE_DEPRECATED_API */
258  UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
259  UNUM_ROUND_HALFUP,
266 
271  UNUM_PAD_BEFORE_PREFIX,
272  UNUM_PAD_AFTER_PREFIX,
273  UNUM_PAD_BEFORE_SUFFIX,
274  UNUM_PAD_AFTER_SUFFIX
276 
281 typedef enum UNumberCompactStyle {
288 
302 };
311 typedef enum UNumberFormatFields {
337 
338 
372 U_STABLE UNumberFormat* U_EXPORT2
374  const UChar* pattern,
375  int32_t patternLength,
376  const char* locale,
377  UParseError* parseErr,
378  UErrorCode* status);
379 
380 
387 U_STABLE void U_EXPORT2
389 
390 #if U_SHOW_CPLUSPLUS_API
391 
393 
404 
406 
407 #endif
408 
417 U_STABLE UNumberFormat* U_EXPORT2
418 unum_clone(const UNumberFormat *fmt,
419  UErrorCode *status);
420 
445 U_STABLE int32_t U_EXPORT2
446 unum_format( const UNumberFormat* fmt,
447  int32_t number,
448  UChar* result,
449  int32_t resultLength,
450  UFieldPosition *pos,
451  UErrorCode* status);
452 
477 U_STABLE int32_t U_EXPORT2
479  int64_t number,
480  UChar* result,
481  int32_t resultLength,
482  UFieldPosition *pos,
483  UErrorCode* status);
484 
509 U_STABLE int32_t U_EXPORT2
510 unum_formatDouble( const UNumberFormat* fmt,
511  double number,
512  UChar* result,
513  int32_t resultLength,
514  UFieldPosition *pos, /* 0 if ignore */
515  UErrorCode* status);
516 
545 U_STABLE int32_t U_EXPORT2
547  const char * number,
548  int32_t length,
549  UChar* result,
550  int32_t resultLength,
551  UFieldPosition *pos, /* 0 if ignore */
552  UErrorCode* status);
553 
578 U_STABLE int32_t U_EXPORT2
580  double number,
581  UChar* currency,
582  UChar* result,
583  int32_t resultLength,
584  UFieldPosition* pos,
585  UErrorCode* status);
586 
607 U_STABLE int32_t U_EXPORT2
609  const UFormattable *number,
610  UChar *result,
611  int32_t resultLength,
612  UFieldPosition *pos,
613  UErrorCode *status);
614 
632 U_STABLE int32_t U_EXPORT2
633 unum_parse( const UNumberFormat* fmt,
634  const UChar* text,
635  int32_t textLength,
636  int32_t *parsePos /* 0 = start */,
637  UErrorCode *status);
638 
656 U_STABLE int64_t U_EXPORT2
657 unum_parseInt64(const UNumberFormat* fmt,
658  const UChar* text,
659  int32_t textLength,
660  int32_t *parsePos /* 0 = start */,
661  UErrorCode *status);
662 
680 U_STABLE double U_EXPORT2
681 unum_parseDouble( const UNumberFormat* fmt,
682  const UChar* text,
683  int32_t textLength,
684  int32_t *parsePos /* 0 = start */,
685  UErrorCode *status);
686 
687 
713 U_STABLE int32_t U_EXPORT2
715  const UChar* text,
716  int32_t textLength,
717  int32_t *parsePos /* 0 = start */,
718  char *outBuf,
719  int32_t outBufLength,
720  UErrorCode *status);
721 
741 U_STABLE double U_EXPORT2
743  const UChar* text,
744  int32_t textLength,
745  int32_t* parsePos, /* 0 = start */
746  UChar* currency,
747  UErrorCode* status);
748 
767 U_STABLE UFormattable* U_EXPORT2
769  UFormattable *result,
770  const UChar* text,
771  int32_t textLength,
772  int32_t* parsePos, /* 0 = start */
773  UErrorCode* status);
774 
791 U_STABLE void U_EXPORT2
793  UBool localized,
794  const UChar *pattern,
795  int32_t patternLength,
796  UParseError *parseError,
797  UErrorCode *status
798  );
799 
810 U_STABLE const char* U_EXPORT2
811 unum_getAvailable(int32_t localeIndex);
812 
822 U_STABLE int32_t U_EXPORT2
823 unum_countAvailable(void);
824 
825 #if UCONFIG_HAVE_PARSEALLINPUT
826 /* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
830 typedef enum UNumberFormatAttributeValue {
831 #ifndef U_HIDE_INTERNAL_API
832 
833  UNUM_NO = 0,
835  UNUM_YES = 1,
837  UNUM_MAYBE = 2
838 #endif /* U_HIDE_INTERNAL_API */
839 } UNumberFormatAttributeValue;
840 #endif
841 
889 #if UCONFIG_HAVE_PARSEALLINPUT
890 
894  UNUM_PARSE_ALL_INPUT = UNUM_LENIENT_PARSE + 1,
895 #endif
896 
906 
907 #ifndef U_HIDE_INTERNAL_API
908 
911 #endif /* U_HIDE_INTERNAL_API */
912 
913 #ifndef U_HIDE_DRAFT_API
914 
921 #endif /* U_HIDE_DRAFT_API */
922 
923  /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
928 
942 
943 #ifndef U_HIDE_DRAFT_API
944 
953 #endif /* U_HIDE_DRAFT_API */
954 
955  /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
960 
978 U_STABLE int32_t U_EXPORT2
981 
1001 U_STABLE void U_EXPORT2
1004  int32_t newValue);
1005 
1006 
1021 U_STABLE double U_EXPORT2
1023  UNumberFormatAttribute attr);
1024 
1039 U_STABLE void U_EXPORT2
1042  double newValue);
1043 
1077 
1096 U_STABLE int32_t U_EXPORT2
1099  UChar* result,
1100  int32_t resultLength,
1101  UErrorCode* status);
1102 
1119 U_STABLE void U_EXPORT2
1122  const UChar* newValue,
1123  int32_t newValueLength,
1124  UErrorCode *status);
1125 
1142 U_STABLE int32_t U_EXPORT2
1143 unum_toPattern( const UNumberFormat* fmt,
1144  UBool isPatternLocalized,
1145  UChar* result,
1146  int32_t resultLength,
1147  UErrorCode* status);
1148 
1149 
1154 typedef enum UNumberFormatSymbol {
1230 
1231 #ifndef U_HIDE_DRAFT_API
1232 
1236 #endif /* U_HIDE_DRAFT_API */
1237 
1241 
1258 U_STABLE int32_t U_EXPORT2
1259 unum_getSymbol(const UNumberFormat *fmt,
1260  UNumberFormatSymbol symbol,
1261  UChar *buffer,
1262  int32_t size,
1263  UErrorCode *status);
1264 
1278 U_STABLE void U_EXPORT2
1280  UNumberFormatSymbol symbol,
1281  const UChar *value,
1282  int32_t length,
1283  UErrorCode *status);
1284 
1285 
1295 U_STABLE const char* U_EXPORT2
1297  ULocDataLocaleType type,
1298  UErrorCode* status);
1299 
1308 U_STABLE void U_EXPORT2
1310 
1320 U_STABLE UDisplayContext U_EXPORT2
1321 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
1322 
1323 #endif /* #if !UCONFIG_NO_FORMATTING */
1324 
1325 #endif