X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..38fbf2fd31f5cd99b500914d6037b1d06b608645:/icuSources/i18n/unicode/rbnf.h?ds=sidebyside diff --git a/icuSources/i18n/unicode/rbnf.h b/icuSources/i18n/unicode/rbnf.h index 11034862..5f9510f3 100644 --- a/icuSources/i18n/unicode/rbnf.h +++ b/icuSources/i18n/unicode/rbnf.h @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* -* Copyright (C) 1997-2003, International Business Machines Corporation and others. +* Copyright (C) 1997-2015, International Business Machines Corporation and others. * All Rights Reserved. ******************************************************************************* */ @@ -10,46 +12,68 @@ #include "unicode/utypes.h" -#if defined(U_INT64_T_UNAVAILABLE) || UCONFIG_NO_FORMATTING +/** + * \file + * \brief C++ API: Rule Based Number Format + */ + +/** + * \def U_HAVE_RBNF + * This will be 0 if RBNF support is not included in ICU + * and 1 if it is. + * + * @stable ICU 2.4 + */ +#if UCONFIG_NO_FORMATTING #define U_HAVE_RBNF 0 #else #define U_HAVE_RBNF 1 -#include "unicode/coll.h" #include "unicode/dcfmtsym.h" #include "unicode/fmtable.h" #include "unicode/locid.h" #include "unicode/numfmt.h" #include "unicode/unistr.h" +#include "unicode/strenum.h" +#include "unicode/brkiter.h" +#include "unicode/upluralrules.h" +#if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN +class NFRule; class NFRuleSet; +class LocalizationInfo; +class PluralFormat; +class RuleBasedCollator; -/** Tags for the predefined rulesets. */ +/** + * Tags for the predefined rulesets. + * + * @stable ICU 2.2 + */ enum URBNFRuleSetTag { URBNF_SPELLOUT, URBNF_ORDINAL, URBNF_DURATION, + URBNF_NUMBERING_SYSTEM, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal URBNFRuleSetTag value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ URBNF_COUNT +#endif // U_HIDE_DEPRECATED_API }; -#if UCONFIG_NO_COLLATION -class Collator; -#endif - /** - * \brief C++ API: RuleBasedNumberFormat - * - *

Rule Based Number Format C++ API

- * - *

A class that formats numbers according to a set of rules. This number formatter is + * The RuleBasedNumberFormat class formats numbers according to a set of rules. This number formatter is * typically used for spelling out numeric values in words (e.g., 25,3476 as * "twenty-five thousand three hundred seventy-six" or "vingt-cinq mille trois * cents soixante-seize" or * "fünfundzwanzigtausenddreihundertsechsundsiebzig"), but can also be used for * other complicated formatting tasks, such as formatting a number of seconds as hours, - * minutes and seconds (e.g., 3,730 as "1:02:10").

+ * minutes and seconds (e.g., 3,730 as "1:02:10"). * *

The resources contain three predefined formatters for each locale: spellout, which * spells out a value in words (123 is "one hundred twenty-three"); ordinal, which @@ -134,7 +158,7 @@ class Collator; * * * - * + * * * * @@ -250,17 +274,47 @@ class Collator; * * * - * + * * * * - * + * * * * - * + * + * + * + * + * * * + * + * + * + * + * * * * * + * + * + * + * + * + * + * + * + * + * + * + * *
<< thousand >><< thousand >>[the rule whose base value is 1,000 is applicable to 25,340]
x.x:The rule is an improper fraction rule.The rule is an improper fraction rule. If the full stop in + * the middle of the rule name is replaced with the decimal point + * that is used in the language or DecimalFormatSymbols, then that rule will + * have precedence when formatting and parsing this rule. For example, some + * languages use the comma, and can thus be written as x,x instead. For example, + * you can use "x.x: << point >>;x,x: << comma >>;" to + * handle the decimal point that matches the language's natural spelling of + * the punctuation of either the full stop or comma.
0.x:The rule is a proper fraction rule.The rule is a proper fraction rule. If the full stop in + * the middle of the rule name is replaced with the decimal point + * that is used in the language or DecimalFormatSymbols, then that rule will + * have precedence when formatting and parsing this rule. For example, some + * languages use the comma, and can thus be written as 0,x instead. For example, + * you can use "0.x: point >>;0,x: comma >>;" to + * handle the decimal point that matches the language's natural spelling of + * the punctuation of either the full stop or comma.
x.0:The rule is a master rule.The rule is a master rule. If the full stop in + * the middle of the rule name is replaced with the decimal point + * that is used in the language or DecimalFormatSymbols, then that rule will + * have precedence when formatting and parsing this rule. For example, some + * languages use the comma, and can thus be written as x,0 instead. For example, + * you can use "x.0: << point;x,0: << comma;" to + * handle the decimal point that matches the language's natural spelling of + * the punctuation of either the full stop or comma.
Inf:The rule for infinity.
NaN:The rule for an IEEE 754 NaN (not a number).
nothingIf the rule's rule descriptor is left out, the base value is one plus the * preceding rule's base value (or zero if this is the first rule in the list) in a normal @@ -416,6 +470,24 @@ class Collator; * in rule in fraction rule setOmit the optional text if multiplying the number by the rule's base value yields 1.
$(cardinal,plural syntax)$in all rule setsThis provides the ability to choose a word based on the number divided by the radix to the power of the + * exponent of the base value for the specified locale, which is normally equivalent to the << value. + * This uses the cardinal plural rules from PluralFormat. All strings used in the plural format are treated + * as the same base value for parsing.
$(ordinal,plural syntax)$in all rule setsThis provides the ability to choose a word based on the number divided by the radix to the power of the + * exponent of the base value for the specified locale, which is normally equivalent to the << value. + * This uses the ordinal plural rules from PluralFormat. All strings used in the plural format are treated + * as the same base value for parsing.
* *

The substitution descriptor (i.e., the text between the token characters) may take one @@ -435,7 +507,8 @@ class Collator; * * nothing * Perform the mathematical operation on the number, and format the result using the rule - * set containing the current rule, except: