]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/quantityformatter.h
ICU-64232.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / quantityformatter.h
index ca3fb3d83b8a775638c580be6fc4a4d416a52b2d..046eec7509ecb07b8d136c9b1b02c1e6369363d5 100644 (file)
@@ -27,6 +27,12 @@ class NumberFormat;
 class Formattable;
 class FieldPosition;
 
+namespace number {
+namespace impl {
+class NumberStringBuilder;
+}
+}
+
 /**
  * A plural aware formatter that is good for expressing a single quantity and
  * a unit.
@@ -111,6 +117,7 @@ public:
 
     /**
      * Selects the standard plural form for the number/formatter/rules.
+     * TODO(13591): Remove this method.
      */
     static StandardPlural::Form selectPlural(
             const Formattable &number,
@@ -120,8 +127,30 @@ public:
             FieldPosition &pos,
             UErrorCode &status);
 
+    /**
+     * Formats a quantity and selects its plural form. The output is appended
+     * to a NumberStringBuilder in order to retain field information.
+     *
+     * @param quantity The number to format.
+     * @param fmt The formatter to use to format the number.
+     * @param rules The rules to use to select the plural form of the
+     *              formatted number.
+     * @param output Where to append the result of the format operation.
+     * @param pluralForm Output variable populated with the plural form of the
+     *                   formatted number.
+     * @param status Set if an error occurs.
+     */
+    static void formatAndSelect(
+            double quantity,
+            const NumberFormat& fmt,
+            const PluralRules& rules,
+            number::impl::NumberStringBuilder& output,
+            StandardPlural::Form& pluralForm,
+            UErrorCode& status);
+
     /**
      * Formats the pattern with the value and adjusts the FieldPosition.
+     * TODO: Remove?
      */
     static UnicodeString &format(
             const SimpleFormatter &pattern,