Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: source/i18n/unicode/plurrule.h

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/i18n/unicode/numfmt.h ('k') | source/i18n/unicode/rbnf.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * Copyright (C) 2008-2014, International Business Machines Corporation and 3 * Copyright (C) 2008-2015, International Business Machines Corporation and
4 * others. All Rights Reserved. 4 * others. All Rights Reserved.
5 ******************************************************************************* 5 *******************************************************************************
6 * 6 *
7 * 7 *
8 * File PLURRULE.H 8 * File PLURRULE.H
9 * 9 *
10 * Modification History:* 10 * Modification History:*
11 * Date Name Description 11 * Date Name Description
12 * 12 *
13 ******************************************************************************** 13 ********************************************************************************
(...skipping 18 matching lines...) Expand all
32 * Value returned by PluralRules::getUniqueKeywordValue() when there is no 32 * Value returned by PluralRules::getUniqueKeywordValue() when there is no
33 * unique value to return. 33 * unique value to return.
34 * @stable ICU 4.8 34 * @stable ICU 4.8
35 */ 35 */
36 #define UPLRULES_NO_UNIQUE_VALUE ((double)-0.00123456777) 36 #define UPLRULES_NO_UNIQUE_VALUE ((double)-0.00123456777)
37 37
38 U_NAMESPACE_BEGIN 38 U_NAMESPACE_BEGIN
39 39
40 class Hashtable; 40 class Hashtable;
41 class FixedDecimal; 41 class FixedDecimal;
42 class VisibleDigitsWithExponent;
42 class RuleChain; 43 class RuleChain;
43 class PluralRuleParser; 44 class PluralRuleParser;
44 class PluralKeywordEnumeration; 45 class PluralKeywordEnumeration;
45 class AndConstraint; 46 class AndConstraint;
46 class SharedPluralRules; 47 class SharedPluralRules;
47 48
48 /** 49 /**
49 * Defines rules for mapping non-negative numeric values onto a small set of 50 * Defines rules for mapping non-negative numeric values onto a small set of
50 * keywords. Rules are constructed from a text description, consisting 51 * keywords. Rules are constructed from a text description, consisting
51 * of a series of keywords and conditions. The {@link #select} method 52 * of a series of keywords and conditions. The {@link #select} method
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 * The difference between 'in' and 'within' is that 'in' only includes integers in the specified range, while 'within' 157 * The difference between 'in' and 'within' is that 'in' only includes integers in the specified range, while 'within'
157 * includes all values. Using 'within' with a range_list consisting entirely of values is the same as using 'in' (it's 158 * includes all values. Using 'within' with a range_list consisting entirely of values is the same as using 'in' (it's
158 * not an error). 159 * not an error).
159 * </p> 160 * </p>
160 161
161 * An "identifier" is a sequence of characters that do not have the 162 * An "identifier" is a sequence of characters that do not have the
162 * Unicode Pattern_Syntax or Pattern_White_Space properties. 163 * Unicode Pattern_Syntax or Pattern_White_Space properties.
163 * <p> 164 * <p>
164 * The difference between 'in' and 'within' is that 'in' only includes 165 * The difference between 'in' and 'within' is that 'in' only includes
165 * integers in the specified range, while 'within' includes all values. 166 * integers in the specified range, while 'within' includes all values.
166 * Using 'within' with a range_list consisting entirely of values is the 167 * Using 'within' with a range_list consisting entirely of values is the
167 * same as using 'in' (it's not an error). 168 * same as using 'in' (it's not an error).
168 *</p> 169 *</p>
169 * <p> 170 * <p>
170 * Keywords 171 * Keywords
171 * could be defined by users or from ICU locale data. There are 6 172 * could be defined by users or from ICU locale data. There are 6
172 * predefined values in ICU - 'zero', 'one', 'two', 'few', 'many' and 173 * predefined values in ICU - 'zero', 'one', 'two', 'few', 'many' and
173 * 'other'. Callers need to check the value of keyword returned by 174 * 'other'. Callers need to check the value of keyword returned by
174 * {@link #select} method. 175 * {@link #select} method.
175 * </p> 176 * </p>
176 * 177 *
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 /** 295 /**
295 * Returns whether or not there are overrides. 296 * Returns whether or not there are overrides.
296 * @param locale the locale to check. 297 * @param locale the locale to check.
297 * @return 298 * @return
298 * @internal 299 * @internal
299 */ 300 */
300 static UBool hasOverride(const Locale &locale); 301 static UBool hasOverride(const Locale &locale);
301 302
302 /** 303 /**
303 * For ICU use only. 304 * For ICU use only.
304 * creates a SharedPluralRules object 305 * creates a SharedPluralRules object
305 * @internal 306 * @internal
306 */ 307 */
307 static PluralRules* U_EXPORT2 internalForLocale(const Locale& locale, UPlura lType type, UErrorCode& status); 308 static PluralRules* U_EXPORT2 internalForLocale(const Locale& locale, UPlura lType type, UErrorCode& status);
308 309
309 /** 310 /**
310 * For ICU use only. 311 * For ICU use only.
311 * Returns handle to the shared, cached PluralRules instance. 312 * Returns handle to the shared, cached PluralRules instance.
312 * Caller must call removeRef() on returned value once it is done with 313 * Caller must call removeRef() on returned value once it is done with
313 * the shared instance. 314 * the shared instance.
314 * @internal 315 * @internal
315 */ 316 */
316 static const SharedPluralRules* U_EXPORT2 createSharedInstance( 317 static const SharedPluralRules* U_EXPORT2 createSharedInstance(
317 const Locale& locale, UPluralType type, UErrorCode& status); 318 const Locale& locale, UPluralType type, UErrorCode& status);
318 319
319 320
320 #endif /* U_HIDE_INTERNAL_API */ 321 #endif /* U_HIDE_INTERNAL_API */
321 322
322 /** 323 /**
323 * Given a number, returns the keyword of the first rule that applies to 324 * Given a number, returns the keyword of the first rule that applies to
324 * the number. This function can be used with isKeyword* functions to 325 * the number. This function can be used with isKeyword* functions to
325 * determine the keyword for default plural rules. 326 * determine the keyword for default plural rules.
326 * 327 *
327 * @param number The number for which the rule has to be determined. 328 * @param number The number for which the rule has to be determined.
328 * @return The keyword of the selected rule. 329 * @return The keyword of the selected rule.
329 * @stable ICU 4.0 330 * @stable ICU 4.0
330 */ 331 */
331 UnicodeString select(int32_t number) const; 332 UnicodeString select(int32_t number) const;
332 333
333 /** 334 /**
334 * Given a number, returns the keyword of the first rule that applies to 335 * Given a number, returns the keyword of the first rule that applies to
335 * the number. This function can be used with isKeyword* functions to 336 * the number. This function can be used with isKeyword* functions to
336 * determine the keyword for default plural rules. 337 * determine the keyword for default plural rules.
337 * 338 *
338 * @param number The number for which the rule has to be determined. 339 * @param number The number for which the rule has to be determined.
339 * @return The keyword of the selected rule. 340 * @return The keyword of the selected rule.
340 * @stable ICU 4.0 341 * @stable ICU 4.0
341 */ 342 */
342 UnicodeString select(double number) const; 343 UnicodeString select(double number) const;
343 344
344 #ifndef U_HIDE_INTERNAL_API 345 #ifndef U_HIDE_INTERNAL_API
345 /** 346 /**
346 * @internal 347 * @internal
347 */ 348 */
348 UnicodeString select(const FixedDecimal &number) const; 349 UnicodeString select(const FixedDecimal &number) const;
350 /**
351 * @internal
352 */
353 UnicodeString select(const VisibleDigitsWithExponent &number) const;
349 #endif /* U_HIDE_INTERNAL_API */ 354 #endif /* U_HIDE_INTERNAL_API */
350 355
351 /** 356 /**
352 * Returns a list of all rule keywords used in this <code>PluralRules</code> 357 * Returns a list of all rule keywords used in this <code>PluralRules</code>
353 * object. The rule 'other' is always present by default. 358 * object. The rule 'other' is always present by default.
354 * 359 *
355 * @param status Output param set to success/failure code on exit, which 360 * @param status Output param set to success/failure code on exit, which
356 * must not indicate a failure before the function call. 361 * must not indicate a failure before the function call.
357 * @return StringEnumeration with the keywords. 362 * @return StringEnumeration with the keywords.
358 * The caller must delete the object. 363 * The caller must delete the object.
359 * @stable ICU 4.0 364 * @stable ICU 4.0
360 */ 365 */
361 StringEnumeration* getKeywords(UErrorCode& status) const; 366 StringEnumeration* getKeywords(UErrorCode& status) const;
362 367
368 #ifndef U_HIDE_DEPRECATED_API
363 /** 369 /**
364 * Returns a unique value for this keyword if it exists, else the constant 370 * Deprecated Function, does not return useful results.
365 * UPLRULES_NO_UNIQUE_VALUE. 371 *
372 * Originally intended to return a unique value for this keyword if it exist s,
373 * else the constant UPLRULES_NO_UNIQUE_VALUE.
366 * 374 *
367 * @param keyword The keyword. 375 * @param keyword The keyword.
368 * @return The unique value that generates the keyword, or 376 * @return Stub deprecated function returns UPLRULES_NO_UNIQUE_VALUE always.
369 * UPLRULES_NO_UNIQUE_VALUE if the keyword is undefined or th ere is no 377 * @deprecated ICU 55
370 * unique value that generates this keyword.
371 * @stable ICU 4.8
372 */ 378 */
373 double getUniqueKeywordValue(const UnicodeString& keyword); 379 double getUniqueKeywordValue(const UnicodeString& keyword);
374 380
375 /** 381 /**
376 * Returns all the values for which select() would return the keyword. If 382 * Deprecated Function, does not produce useful results.
377 * the keyword is unknown, returns no values, but this is not an error. If 383 *
384 * Orginally intended to return all the values for which select() would retu rn the keyword.
385 * If the keyword is unknown, returns no values, but this is not an error. If
378 * the number of values is unlimited, returns no values and -1 as the 386 * the number of values is unlimited, returns no values and -1 as the
379 * count. 387 * count.
380 * 388 *
381 * The number of returned values is typically small. 389 * The number of returned values is typically small.
382 * 390 *
383 * @param keyword The keyword. 391 * @param keyword The keyword.
384 * @param dest Array into which to put the returned values. May 392 * @param dest Array into which to put the returned values. May
385 * be NULL if destCapacity is 0. 393 * be NULL if destCapacity is 0.
386 * @param destCapacity The capacity of the array, must be at least 0. 394 * @param destCapacity The capacity of the array, must be at least 0.
387 * @param status The error code. 395 * @param status The error code. Deprecated function, always sets U_UN SUPPORTED_ERROR.
388 * @return The count of values available, or -1. This count 396 * @return The count of values available, or -1. This count
389 * can be larger than destCapacity, but no more than 397 * can be larger than destCapacity, but no more than
390 * destCapacity values will be written. 398 * destCapacity values will be written.
391 * @stable ICU 4.8 399 * @deprecated ICU 55
392 */ 400 */
393 int32_t getAllKeywordValues(const UnicodeString &keyword, 401 int32_t getAllKeywordValues(const UnicodeString &keyword,
394 double *dest, int32_t destCapacity, 402 double *dest, int32_t destCapacity,
395 UErrorCode& status); 403 UErrorCode& status);
404 #endif /* U_HIDE_DEPRECATED_API */
396 405
397 /** 406 /**
398 * Returns sample values for which select() would return the keyword. If 407 * Returns sample values for which select() would return the keyword. If
399 * the keyword is unknown, returns no values, but this is not an error. 408 * the keyword is unknown, returns no values, but this is not an error.
400 * 409 *
401 * The number of returned values is typically small. 410 * The number of returned values is typically small.
402 * 411 *
403 * @param keyword The keyword. 412 * @param keyword The keyword.
404 * @param dest Array into which to put the returned values. May 413 * @param dest Array into which to put the returned values. May
405 * be NULL if destCapacity is 0. 414 * be NULL if destCapacity is 0.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 501
493 friend class PluralRuleParser; 502 friend class PluralRuleParser;
494 }; 503 };
495 504
496 U_NAMESPACE_END 505 U_NAMESPACE_END
497 506
498 #endif /* #if !UCONFIG_NO_FORMATTING */ 507 #endif /* #if !UCONFIG_NO_FORMATTING */
499 508
500 #endif // _PLURRULE 509 #endif // _PLURRULE
501 //eof 510 //eof
OLDNEW
« no previous file with comments | « source/i18n/unicode/numfmt.h ('k') | source/i18n/unicode/rbnf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698