]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/unicode/unum.h
ICU-491.11.1.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / unum.h
index 1102bab58b3d1bb2e2b2082cb5589c5ddefe8cc0..3f9f291aac23546ec269c36d3c143683a1574eed 100644 (file)
@@ -1,6 +1,6 @@
 /*
 *******************************************************************************
-* Copyright (C) 1997-2010, International Business Machines Corporation and others.
+* Copyright (C) 1997-2012, International Business Machines Corporation and others.
 * All Rights Reserved.
 * Modification History:
 *
@@ -134,19 +134,34 @@ typedef void* UNumberFormat;
  */
 typedef enum UNumberFormatStyle {
     /**
-     * Decimal format defined by pattern 
+     * Decimal format defined by a pattern string.
      * @stable ICU 3.0
      */
     UNUM_PATTERN_DECIMAL=0,
-    /** Decimal format */
+    /**
+     * Decimal format ("normal" style).
+     * @stable ICU 2.0
+     */
     UNUM_DECIMAL=1,
-    /** Currency format */
+    /**
+     * Currency format with a currency symbol, e.g., "$1.00".
+     * @stable ICU 2.0
+     */
     UNUM_CURRENCY,
-    /** Percent format */
+    /**
+     * Percent format
+     * @stable ICU 2.0
+     */
     UNUM_PERCENT,
-    /** Scientific format */
+    /**
+     * Scientific format
+     * @stable ICU 2.1
+     */
     UNUM_SCIENTIFIC,
-    /** Spellout rule-based format */
+    /**
+     * Spellout rule-based format
+     * @stable ICU 2.0
+     */
     UNUM_SPELLOUT,
     /** 
      * Ordinal rule-based format 
@@ -159,18 +174,40 @@ typedef enum UNumberFormatStyle {
      */
     UNUM_DURATION,
     /** 
-     * Numbering system rule-based format 
+     * Numbering system rule-based format
      * @stable ICU 4.2
      */
     UNUM_NUMBERING_SYSTEM,
     /** 
-     * Rule-based format defined by pattern 
+     * Rule-based format defined by a pattern string.
      * @stable ICU 3.0
      */
     UNUM_PATTERN_RULEBASED,
-    /** Default format */
+    /**
+     * Currency format with an ISO currency code, e.g., "USD1.00".
+     * @stable ICU 4.8
+     */
+    UNUM_CURRENCY_ISO,
+    /**
+     * Currency format with a pluralized currency name,
+     * e.g., "1.00 US dollar" and "3.00 US dollars".
+     * @stable ICU 4.8
+     */
+    UNUM_CURRENCY_PLURAL,
+    /**
+     * One more than the highest number format style constant.
+     * @stable ICU 4.8
+     */
+    UNUM_FORMAT_STYLE_COUNT,
+    /**
+     * Default format
+     * @stable ICU 2.0
+     */
     UNUM_DEFAULT = UNUM_DECIMAL,
-    /** (Alias for UNUM_PATTERN_DECIMAL) */
+    /**
+     * Alias for UNUM_PATTERN_DECIMAL
+     * @stable ICU 3.0
+     */
     UNUM_IGNORE = UNUM_PATTERN_DECIMAL
 } UNumberFormatStyle;
 
@@ -182,18 +219,25 @@ typedef enum UNumberFormatRoundingMode {
     UNUM_ROUND_FLOOR,
     UNUM_ROUND_DOWN,
     UNUM_ROUND_UP,
+    /**
+     * Half-even rounding
+     * @stable, ICU 3.8
+     */
+    UNUM_ROUND_HALFEVEN,
+#ifndef U_HIDE_DEPRECATED_API
     /**
      * Half-even rounding, misspelled name
      * @deprecated, ICU 3.8
      */
-    UNUM_FOUND_HALFEVEN,
+    UNUM_FOUND_HALFEVEN = UNUM_ROUND_HALFEVEN,
+#endif  /* U_HIDE_DEPRECATED_API */
     UNUM_ROUND_HALFDOWN,
     UNUM_ROUND_HALFUP,
-    /**
-     * Half-even rounding
-     * @stable, ICU 3.8
-     */
-    UNUM_ROUND_HALFEVEN = UNUM_FOUND_HALFEVEN
+    /** 
+      * ROUND_UNNECESSARY reports an error if formatted result is not exact.
+      * @stable ICU 4.8
+      */
+    UNUM_ROUND_UNNECESSARY
 } UNumberFormatRoundingMode;
 
 /** The possible number format pad positions. 
@@ -206,6 +250,56 @@ typedef enum UNumberFormatPadPosition {
     UNUM_PAD_AFTER_SUFFIX
 } UNumberFormatPadPosition;
 
+/**
+ * Constants for specifying currency spacing
+ * @stable ICU 4.8
+ */
+enum UCurrencySpacing {
+    /** @stable ICU 4.8 */
+    UNUM_CURRENCY_MATCH,
+    /** @stable ICU 4.8 */
+    UNUM_CURRENCY_SURROUNDING_MATCH,
+    /** @stable ICU 4.8 */
+    UNUM_CURRENCY_INSERT,
+    /** @stable ICU 4.8 */
+    UNUM_CURRENCY_SPACING_COUNT
+};
+typedef enum UCurrencySpacing UCurrencySpacing; /**< @stable ICU 4.8 */
+
+
+/**
+ * FieldPosition and UFieldPosition selectors for format fields
+ * defined by NumberFormat and UNumberFormat.
+ * @stable ICU 49
+ */
+typedef enum UNumberFormatFields {
+    /** @stable ICU 49 */
+    UNUM_INTEGER_FIELD,
+    /** @stable ICU 49 */
+    UNUM_FRACTION_FIELD,
+    /** @stable ICU 49 */
+    UNUM_DECIMAL_SEPARATOR_FIELD,
+    /** @stable ICU 49 */
+    UNUM_EXPONENT_SYMBOL_FIELD,
+    /** @stable ICU 49 */
+    UNUM_EXPONENT_SIGN_FIELD,
+    /** @stable ICU 49 */
+    UNUM_EXPONENT_FIELD,
+    /** @stable ICU 49 */
+    UNUM_GROUPING_SEPARATOR_FIELD,
+    /** @stable ICU 49 */
+    UNUM_CURRENCY_FIELD,
+    /** @stable ICU 49 */
+    UNUM_PERCENT_FIELD,
+    /** @stable ICU 49 */
+    UNUM_PERMILL_FIELD,
+    /** @stable ICU 49 */
+    UNUM_SIGN_FIELD,
+    /** @stable ICU 49 */
+    UNUM_FIELD_COUNT
+} UNumberFormatFields;
+
+
 /**
  * Create and return a new UNumberFormat for formatting and parsing
  * numbers.  A UNumberFormat may be used to format numbers by calling
@@ -895,41 +989,41 @@ typedef enum UNumberFormatSymbol {
   /** The monetary grouping separator 
    * @stable ICU 3.6
    */
-  UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,  
+  UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
   /** One
-   * @draft ICU 4.6
+   * @stable ICU 4.6
    */
   UNUM_ONE_DIGIT_SYMBOL = 18,
   /** Two
-   * @draft ICU 4.6
+   * @stable ICU 4.6
    */
   UNUM_TWO_DIGIT_SYMBOL = 19,
   /** Three
-   * @draft ICU 4.6
+   * @stable ICU 4.6
    */
   UNUM_THREE_DIGIT_SYMBOL = 20,
   /** Four
-   * @draft ICU 4.6
+   * @stable ICU 4.6
    */
   UNUM_FOUR_DIGIT_SYMBOL = 21,
   /** Five
-   * @draft ICU 4.6
+   * @stable ICU 4.6
    */
   UNUM_FIVE_DIGIT_SYMBOL = 22,
   /** Six
-   * @draft ICU 4.6
+   * @stable ICU 4.6
    */
   UNUM_SIX_DIGIT_SYMBOL = 23,
   /** Seven
-    * @draft ICU 4.6
+    * @stable ICU 4.6
    */
   UNUM_SEVEN_DIGIT_SYMBOL = 24,
   /** Eight
-   * @draft ICU 4.6
+   * @stable ICU 4.6
    */
   UNUM_EIGHT_DIGIT_SYMBOL = 25,
   /** Nine
-   * @draft ICU 4.6
+   * @stable ICU 4.6
    */
   UNUM_NINE_DIGIT_SYMBOL = 26,
   /** count symbol constants */