X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/f3c0d7a59d99c2a94c6b8822291f0e42be3773c9..a01113dcd0f39d5da295ef82785beff9ed86fe38:/icuSources/i18n/quantityformatter.h diff --git a/icuSources/i18n/quantityformatter.h b/icuSources/i18n/quantityformatter.h index ca3fb3d8..046eec75 100644 --- a/icuSources/i18n/quantityformatter.h +++ b/icuSources/i18n/quantityformatter.h @@ -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,