plurfmt.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. /*
  2. *******************************************************************************
  3. * Copyright (C) 2007-2014, International Business Machines Corporation and
  4. * others. All Rights Reserved.
  5. *******************************************************************************
  6. *
  7. * File PLURFMT.H
  8. ********************************************************************************
  9. */
  10. #ifndef PLURFMT
  11. #define PLURFMT
  12. #include "unicode/utypes.h"
  13. /**
  14. * \file
  15. * \brief C++ API: PluralFormat object
  16. */
  17. #if !UCONFIG_NO_FORMATTING
  18. #include "unicode/messagepattern.h"
  19. #include "unicode/numfmt.h"
  20. #include "unicode/plurrule.h"
  21. U_NAMESPACE_BEGIN
  22. class Hashtable;
  23. class NFRule;
  24. /**
  25. * <p>
  26. * <code>PluralFormat</code> supports the creation of internationalized
  27. * messages with plural inflection. It is based on <i>plural
  28. * selection</i>, i.e. the caller specifies messages for each
  29. * plural case that can appear in the user's language and the
  30. * <code>PluralFormat</code> selects the appropriate message based on
  31. * the number.
  32. * </p>
  33. * <h4>The Problem of Plural Forms in Internationalized Messages</h4>
  34. * <p>
  35. * Different languages have different ways to inflect
  36. * plurals. Creating internationalized messages that include plural
  37. * forms is only feasible when the framework is able to handle plural
  38. * forms of <i>all</i> languages correctly. <code>ChoiceFormat</code>
  39. * doesn't handle this well, because it attaches a number interval to
  40. * each message and selects the message whose interval contains a
  41. * given number. This can only handle a finite number of
  42. * intervals. But in some languages, like Polish, one plural case
  43. * applies to infinitely many intervals (e.g., the plural case applies to
  44. * numbers ending with 2, 3, or 4 except those ending with 12, 13, or
  45. * 14). Thus <code>ChoiceFormat</code> is not adequate.
  46. * </p><p>
  47. * <code>PluralFormat</code> deals with this by breaking the problem
  48. * into two parts:
  49. * <ul>
  50. * <li>It uses <code>PluralRules</code> that can define more complex
  51. * conditions for a plural case than just a single interval. These plural
  52. * rules define both what plural cases exist in a language, and to
  53. * which numbers these cases apply.
  54. * <li>It provides predefined plural rules for many languages. Thus, the programmer
  55. * need not worry about the plural cases of a language and
  56. * does not have to define the plural cases; they can simply
  57. * use the predefined keywords. The whole plural formatting of messages can
  58. * be done using localized patterns from resource bundles. For predefined plural
  59. * rules, see the CLDR <i>Language Plural Rules</i> page at
  60. * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  61. * </ul>
  62. * </p>
  63. * <h4>Usage of <code>PluralFormat</code></h4>
  64. * <p>Note: Typically, plural formatting is done via <code>MessageFormat</code>
  65. * with a <code>plural</code> argument type,
  66. * rather than using a stand-alone <code>PluralFormat</code>.
  67. * </p><p>
  68. * This discussion assumes that you use <code>PluralFormat</code> with
  69. * a predefined set of plural rules. You can create one using one of
  70. * the constructors that takes a <code>locale</code> object. To
  71. * specify the message pattern, you can either pass it to the
  72. * constructor or set it explicitly using the
  73. * <code>applyPattern()</code> method. The <code>format()</code>
  74. * method takes a number object and selects the message of the
  75. * matching plural case. This message will be returned.
  76. * </p>
  77. * <h5>Patterns and Their Interpretation</h5>
  78. * <p>
  79. * The pattern text defines the message output for each plural case of the
  80. * specified locale. Syntax:
  81. * <pre>
  82. * pluralStyle = [offsetValue] (selector '{' message '}')+
  83. * offsetValue = "offset:" number
  84. * selector = explicitValue | keyword
  85. * explicitValue = '=' number // adjacent, no white space in between
  86. * keyword = [^[[:Pattern_Syntax:][:Pattern_White_Space:]]]+
  87. * message: see {@link MessageFormat}
  88. * </pre>
  89. * Pattern_White_Space between syntax elements is ignored, except
  90. * between the {curly braces} and their sub-message,
  91. * and between the '=' and the number of an explicitValue.
  92. *
  93. * </p><p>
  94. * There are 6 predefined casekeyword in CLDR/ICU - 'zero', 'one', 'two', 'few', 'many' and
  95. * 'other'. You always have to define a message text for the default plural case
  96. * <code>other</code> which is contained in every rule set.
  97. * If you do not specify a message text for a particular plural case, the
  98. * message text of the plural case <code>other</code> gets assigned to this
  99. * plural case.
  100. * </p><p>
  101. * When formatting, the input number is first matched against the explicitValue clauses.
  102. * If there is no exact-number match, then a keyword is selected by calling
  103. * the <code>PluralRules</code> with the input number <em>minus the offset</em>.
  104. * (The offset defaults to 0 if it is omitted from the pattern string.)
  105. * If there is no clause with that keyword, then the "other" clauses is returned.
  106. * </p><p>
  107. * An unquoted pound sign (<code>#</code>) in the selected sub-message
  108. * itself (i.e., outside of arguments nested in the sub-message)
  109. * is replaced by the input number minus the offset.
  110. * The number-minus-offset value is formatted using a
  111. * <code>NumberFormat</code> for the <code>PluralFormat</code>'s locale. If you
  112. * need special number formatting, you have to use a <code>MessageFormat</code>
  113. * and explicitly specify a <code>NumberFormat</code> argument.
  114. * <strong>Note:</strong> That argument is formatting without subtracting the offset!
  115. * If you need a custom format and have a non-zero offset, then you need to pass the
  116. * number-minus-offset value as a separate parameter.
  117. * </p>
  118. * For a usage example, see the {@link MessageFormat} class documentation.
  119. *
  120. * <h4>Defining Custom Plural Rules</h4>
  121. * <p>If you need to use <code>PluralFormat</code> with custom rules, you can
  122. * create a <code>PluralRules</code> object and pass it to
  123. * <code>PluralFormat</code>'s constructor. If you also specify a locale in this
  124. * constructor, this locale will be used to format the number in the message
  125. * texts.
  126. * </p><p>
  127. * For more information about <code>PluralRules</code>, see
  128. * {@link PluralRules}.
  129. * </p>
  130. *
  131. * ported from Java
  132. * @stable ICU 4.0
  133. */
  134. class U_I18N_API PluralFormat : public Format {
  135. public:
  136. /**
  137. * Creates a new cardinal-number <code>PluralFormat</code> for the default locale.
  138. * This locale will be used to get the set of plural rules and for standard
  139. * number formatting.
  140. * @param status output param set to success/failure code on exit, which
  141. * must not indicate a failure before the function call.
  142. * @stable ICU 4.0
  143. */
  144. PluralFormat(UErrorCode& status);
  145. /**
  146. * Creates a new cardinal-number <code>PluralFormat</code> for a given locale.
  147. * @param locale the <code>PluralFormat</code> will be configured with
  148. * rules for this locale. This locale will also be used for
  149. * standard number formatting.
  150. * @param status output param set to success/failure code on exit, which
  151. * must not indicate a failure before the function call.
  152. * @stable ICU 4.0
  153. */
  154. PluralFormat(const Locale& locale, UErrorCode& status);
  155. /**
  156. * Creates a new <code>PluralFormat</code> for a given set of rules.
  157. * The standard number formatting will be done using the default locale.
  158. * @param rules defines the behavior of the <code>PluralFormat</code>
  159. * object.
  160. * @param status output param set to success/failure code on exit, which
  161. * must not indicate a failure before the function call.
  162. * @stable ICU 4.0
  163. */
  164. PluralFormat(const PluralRules& rules, UErrorCode& status);
  165. /**
  166. * Creates a new <code>PluralFormat</code> for a given set of rules.
  167. * The standard number formatting will be done using the given locale.
  168. * @param locale the default number formatting will be done using this
  169. * locale.
  170. * @param rules defines the behavior of the <code>PluralFormat</code>
  171. * object.
  172. * @param status output param set to success/failure code on exit, which
  173. * must not indicate a failure before the function call.
  174. * @stable ICU 4.0
  175. * <p>
  176. * <h4>Sample code</h4>
  177. * \snippet samples/plurfmtsample/plurfmtsample.cpp PluralFormatExample1
  178. * \snippet samples/plurfmtsample/plurfmtsample.cpp PluralFormatExample
  179. * <p>
  180. */
  181. PluralFormat(const Locale& locale, const PluralRules& rules, UErrorCode& status);
  182. /**
  183. * Creates a new <code>PluralFormat</code> for the plural type.
  184. * The standard number formatting will be done using the given locale.
  185. * @param locale the default number formatting will be done using this
  186. * locale.
  187. * @param type The plural type (e.g., cardinal or ordinal).
  188. * @param status output param set to success/failure code on exit, which
  189. * must not indicate a failure before the function call.
  190. * @stable ICU 50
  191. */
  192. PluralFormat(const Locale& locale, UPluralType type, UErrorCode& status);
  193. /**
  194. * Creates a new cardinal-number <code>PluralFormat</code> for a given pattern string.
  195. * The default locale will be used to get the set of plural rules and for
  196. * standard number formatting.
  197. * @param pattern the pattern for this <code>PluralFormat</code>.
  198. * errors are returned to status if the pattern is invalid.
  199. * @param status output param set to success/failure code on exit, which
  200. * must not indicate a failure before the function call.
  201. * @stable ICU 4.0
  202. */
  203. PluralFormat(const UnicodeString& pattern, UErrorCode& status);
  204. /**
  205. * Creates a new cardinal-number <code>PluralFormat</code> for a given pattern string and
  206. * locale.
  207. * The locale will be used to get the set of plural rules and for
  208. * standard number formatting.
  209. * @param locale the <code>PluralFormat</code> will be configured with
  210. * rules for this locale. This locale will also be used for
  211. * standard number formatting.
  212. * @param pattern the pattern for this <code>PluralFormat</code>.
  213. * errors are returned to status if the pattern is invalid.
  214. * @param status output param set to success/failure code on exit, which
  215. * must not indicate a failure before the function call.
  216. * @stable ICU 4.0
  217. */
  218. PluralFormat(const Locale& locale, const UnicodeString& pattern, UErrorCode& status);
  219. /**
  220. * Creates a new <code>PluralFormat</code> for a given set of rules, a
  221. * pattern and a locale.
  222. * @param rules defines the behavior of the <code>PluralFormat</code>
  223. * object.
  224. * @param pattern the pattern for this <code>PluralFormat</code>.
  225. * errors are returned to status if the pattern is invalid.
  226. * @param status output param set to success/failure code on exit, which
  227. * must not indicate a failure before the function call.
  228. * @stable ICU 4.0
  229. */
  230. PluralFormat(const PluralRules& rules,
  231. const UnicodeString& pattern,
  232. UErrorCode& status);
  233. /**
  234. * Creates a new <code>PluralFormat</code> for a given set of rules, a
  235. * pattern and a locale.
  236. * @param locale the <code>PluralFormat</code> will be configured with
  237. * rules for this locale. This locale will also be used for
  238. * standard number formatting.
  239. * @param rules defines the behavior of the <code>PluralFormat</code>
  240. * object.
  241. * @param pattern the pattern for this <code>PluralFormat</code>.
  242. * errors are returned to status if the pattern is invalid.
  243. * @param status output param set to success/failure code on exit, which
  244. * must not indicate a failure before the function call.
  245. * @stable ICU 4.0
  246. */
  247. PluralFormat(const Locale& locale,
  248. const PluralRules& rules,
  249. const UnicodeString& pattern,
  250. UErrorCode& status);
  251. /**
  252. * Creates a new <code>PluralFormat</code> for a plural type, a
  253. * pattern and a locale.
  254. * @param locale the <code>PluralFormat</code> will be configured with
  255. * rules for this locale. This locale will also be used for
  256. * standard number formatting.
  257. * @param type The plural type (e.g., cardinal or ordinal).
  258. * @param pattern the pattern for this <code>PluralFormat</code>.
  259. * errors are returned to status if the pattern is invalid.
  260. * @param status output param set to success/failure code on exit, which
  261. * must not indicate a failure before the function call.
  262. * @stable ICU 50
  263. */
  264. PluralFormat(const Locale& locale,
  265. UPluralType type,
  266. const UnicodeString& pattern,
  267. UErrorCode& status);
  268. /**
  269. * copy constructor.
  270. * @stable ICU 4.0
  271. */
  272. PluralFormat(const PluralFormat& other);
  273. /**
  274. * Destructor.
  275. * @stable ICU 4.0
  276. */
  277. virtual ~PluralFormat();
  278. /**
  279. * Sets the pattern used by this plural format.
  280. * The method parses the pattern and creates a map of format strings
  281. * for the plural rules.
  282. * Patterns and their interpretation are specified in the class description.
  283. *
  284. * @param pattern the pattern for this plural format
  285. * errors are returned to status if the pattern is invalid.
  286. * @param status output param set to success/failure code on exit, which
  287. * must not indicate a failure before the function call.
  288. * @stable ICU 4.0
  289. */
  290. void applyPattern(const UnicodeString& pattern, UErrorCode& status);
  291. using Format::format;
  292. /**
  293. * Formats a plural message for a given number.
  294. *
  295. * @param number a number for which the plural message should be formatted
  296. * for. If no pattern has been applied to this
  297. * <code>PluralFormat</code> object yet, the formatted number
  298. * will be returned.
  299. * @param status output param set to success/failure code on exit, which
  300. * must not indicate a failure before the function call.
  301. * @return the string containing the formatted plural message.
  302. * @stable ICU 4.0
  303. */
  304. UnicodeString format(int32_t number, UErrorCode& status) const;
  305. /**
  306. * Formats a plural message for a given number.
  307. *
  308. * @param number a number for which the plural message should be formatted
  309. * for. If no pattern has been applied to this
  310. * PluralFormat object yet, the formatted number
  311. * will be returned.
  312. * @param status output param set to success or failure code on exit, which
  313. * must not indicate a failure before the function call.
  314. * @return the string containing the formatted plural message.
  315. * @stable ICU 4.0
  316. */
  317. UnicodeString format(double number, UErrorCode& status) const;
  318. /**
  319. * Formats a plural message for a given number.
  320. *
  321. * @param number a number for which the plural message should be formatted
  322. * for. If no pattern has been applied to this
  323. * <code>PluralFormat</code> object yet, the formatted number
  324. * will be returned.
  325. * @param appendTo output parameter to receive result.
  326. * result is appended to existing contents.
  327. * @param pos On input: an alignment field, if desired.
  328. * On output: the offsets of the alignment field.
  329. * @param status output param set to success/failure code on exit, which
  330. * must not indicate a failure before the function call.
  331. * @return the string containing the formatted plural message.
  332. * @stable ICU 4.0
  333. */
  334. UnicodeString& format(int32_t number,
  335. UnicodeString& appendTo,
  336. FieldPosition& pos,
  337. UErrorCode& status) const;
  338. /**
  339. * Formats a plural message for a given number.
  340. *
  341. * @param number a number for which the plural message should be formatted
  342. * for. If no pattern has been applied to this
  343. * PluralFormat object yet, the formatted number
  344. * will be returned.
  345. * @param appendTo output parameter to receive result.
  346. * result is appended to existing contents.
  347. * @param pos On input: an alignment field, if desired.
  348. * On output: the offsets of the alignment field.
  349. * @param status output param set to success/failure code on exit, which
  350. * must not indicate a failure before the function call.
  351. * @return the string containing the formatted plural message.
  352. * @stable ICU 4.0
  353. */
  354. UnicodeString& format(double number,
  355. UnicodeString& appendTo,
  356. FieldPosition& pos,
  357. UErrorCode& status) const;
  358. #ifndef U_HIDE_DEPRECATED_API
  359. /**
  360. * Sets the locale used by this <code>PluraFormat</code> object.
  361. * Note: Calling this method resets this <code>PluraFormat</code> object,
  362. * i.e., a pattern that was applied previously will be removed,
  363. * and the NumberFormat is set to the default number format for
  364. * the locale. The resulting format behaves the same as one
  365. * constructed from {@link #PluralFormat(const Locale& locale, UPluralType type, UErrorCode& status)}
  366. * with UPLURAL_TYPE_CARDINAL.
  367. * @param locale the <code>locale</code> to use to configure the formatter.
  368. * @param status output param set to success/failure code on exit, which
  369. * must not indicate a failure before the function call.
  370. * @deprecated ICU 50 This method clears the pattern and might create
  371. * a different kind of PluralRules instance;
  372. * use one of the constructors to create a new instance instead.
  373. */
  374. void setLocale(const Locale& locale, UErrorCode& status);
  375. #endif /* U_HIDE_DEPRECATED_API */
  376. /**
  377. * Sets the number format used by this formatter. You only need to
  378. * call this if you want a different number format than the default
  379. * formatter for the locale.
  380. * @param format the number format to use.
  381. * @param status output param set to success/failure code on exit, which
  382. * must not indicate a failure before the function call.
  383. * @stable ICU 4.0
  384. */
  385. void setNumberFormat(const NumberFormat* format, UErrorCode& status);
  386. /**
  387. * Assignment operator
  388. *
  389. * @param other the PluralFormat object to copy from.
  390. * @stable ICU 4.0
  391. */
  392. PluralFormat& operator=(const PluralFormat& other);
  393. /**
  394. * Return true if another object is semantically equal to this one.
  395. *
  396. * @param other the PluralFormat object to be compared with.
  397. * @return true if other is semantically equal to this.
  398. * @stable ICU 4.0
  399. */
  400. virtual UBool operator==(const Format& other) const;
  401. /**
  402. * Return true if another object is semantically unequal to this one.
  403. *
  404. * @param other the PluralFormat object to be compared with.
  405. * @return true if other is semantically unequal to this.
  406. * @stable ICU 4.0
  407. */
  408. virtual UBool operator!=(const Format& other) const;
  409. /**
  410. * Clones this Format object polymorphically. The caller owns the
  411. * result and should delete it when done.
  412. * @stable ICU 4.0
  413. */
  414. virtual Format* clone(void) const;
  415. /**
  416. * Formats a plural message for a number taken from a Formattable object.
  417. *
  418. * @param obj The object containing a number for which the
  419. * plural message should be formatted.
  420. * The object must be of a numeric type.
  421. * @param appendTo output parameter to receive result.
  422. * Result is appended to existing contents.
  423. * @param pos On input: an alignment field, if desired.
  424. * On output: the offsets of the alignment field.
  425. * @param status output param filled with success/failure status.
  426. * @return Reference to 'appendTo' parameter.
  427. * @stable ICU 4.0
  428. */
  429. UnicodeString& format(const Formattable& obj,
  430. UnicodeString& appendTo,
  431. FieldPosition& pos,
  432. UErrorCode& status) const;
  433. /**
  434. * Returns the pattern from applyPattern() or constructor().
  435. *
  436. * @param appendTo output parameter to receive result.
  437. * Result is appended to existing contents.
  438. * @return the UnicodeString with inserted pattern.
  439. * @stable ICU 4.0
  440. */
  441. UnicodeString& toPattern(UnicodeString& appendTo);
  442. /**
  443. * This method is not yet supported by <code>PluralFormat</code>.
  444. * <P>
  445. * Before calling, set parse_pos.index to the offset you want to start
  446. * parsing at in the source. After calling, parse_pos.index is the end of
  447. * the text you parsed. If error occurs, index is unchanged.
  448. * <P>
  449. * When parsing, leading whitespace is discarded (with a successful parse),
  450. * while trailing whitespace is left as is.
  451. * <P>
  452. * See Format::parseObject() for more.
  453. *
  454. * @param source The string to be parsed into an object.
  455. * @param result Formattable to be set to the parse result.
  456. * If parse fails, return contents are undefined.
  457. * @param parse_pos The position to start parsing at. Upon return
  458. * this param is set to the position after the
  459. * last character successfully parsed. If the
  460. * source is not parsed successfully, this param
  461. * will remain unchanged.
  462. * @stable ICU 4.0
  463. */
  464. virtual void parseObject(const UnicodeString& source,
  465. Formattable& result,
  466. ParsePosition& parse_pos) const;
  467. /**
  468. * ICU "poor man's RTTI", returns a UClassID for this class.
  469. *
  470. * @stable ICU 4.0
  471. *
  472. */
  473. static UClassID U_EXPORT2 getStaticClassID(void);
  474. /**
  475. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  476. *
  477. * @stable ICU 4.0
  478. */
  479. virtual UClassID getDynamicClassID() const;
  480. #if (defined(__xlC__) && (__xlC__ < 0x0C00)) || (U_PLATFORM == U_PF_OS390) || (U_PLATFORM ==U_PF_OS400)
  481. // Work around a compiler bug on xlC 11.1 on AIX 7.1 that would
  482. // prevent PluralSelectorAdapter from implementing private PluralSelector.
  483. // xlC error message:
  484. // 1540-0300 (S) The "private" member "class icu_49::PluralFormat::PluralSelector" cannot be accessed.
  485. public:
  486. #else
  487. private:
  488. #endif
  489. /**
  490. * @internal
  491. */
  492. class U_I18N_API PluralSelector : public UMemory {
  493. public:
  494. virtual ~PluralSelector();
  495. /**
  496. * Given a number, returns the appropriate PluralFormat keyword.
  497. *
  498. * @param context worker object for the selector.
  499. * @param number The number to be plural-formatted.
  500. * @param ec Error code.
  501. * @return The selected PluralFormat keyword.
  502. * @internal
  503. */
  504. virtual UnicodeString select(void *context, double number, UErrorCode& ec) const = 0;
  505. };
  506. /**
  507. * @internal
  508. */
  509. class U_I18N_API PluralSelectorAdapter : public PluralSelector {
  510. public:
  511. PluralSelectorAdapter() : pluralRules(NULL) {
  512. }
  513. virtual ~PluralSelectorAdapter();
  514. virtual UnicodeString select(void *context, double number, UErrorCode& /*ec*/) const; /**< @internal */
  515. void reset();
  516. PluralRules* pluralRules;
  517. };
  518. #if defined(__xlC__)
  519. // End of xlC bug workaround, keep remaining definitions private.
  520. private:
  521. #endif
  522. Locale locale;
  523. MessagePattern msgPattern;
  524. NumberFormat* numberFormat;
  525. double offset;
  526. PluralSelectorAdapter pluralRulesWrapper;
  527. PluralFormat(); // default constructor not implemented
  528. void init(const PluralRules* rules, UPluralType type, UErrorCode& status);
  529. /**
  530. * Copies dynamically allocated values (pointer fields).
  531. * Others are copied using their copy constructors and assignment operators.
  532. */
  533. void copyObjects(const PluralFormat& other);
  534. UnicodeString& format(const Formattable& numberObject, double number,
  535. UnicodeString& appendTo,
  536. FieldPosition& pos,
  537. UErrorCode& status) const; /**< @internal */
  538. /**
  539. * Finds the PluralFormat sub-message for the given number, or the "other" sub-message.
  540. * @param pattern A MessagePattern.
  541. * @param partIndex the index of the first PluralFormat argument style part.
  542. * @param selector the PluralSelector for mapping the number (minus offset) to a keyword.
  543. * @param context worker object for the selector.
  544. * @param number a number to be matched to one of the PluralFormat argument's explicit values,
  545. * or mapped via the PluralSelector.
  546. * @param ec ICU error code.
  547. * @return the sub-message start part index.
  548. */
  549. static int32_t findSubMessage(
  550. const MessagePattern& pattern, int32_t partIndex,
  551. const PluralSelector& selector, void *context, double number, UErrorCode& ec); /**< @internal */
  552. void parseType(const UnicodeString& source, const NFRule *rbnfLenientScanner,
  553. Formattable& result, FieldPosition& pos) const;
  554. friend class MessageFormat;
  555. friend class NFRule;
  556. };
  557. U_NAMESPACE_END
  558. #endif /* #if !UCONFIG_NO_FORMATTING */
  559. #endif // _PLURFMT
  560. //eof