PHP 8.2.30
Preview: upluralrules.h Size: 7.88 KB
/proc/self/root/proc/thread-self/root/proc/thread-self/root/opt/alt/libicu65/usr/include/unicode/upluralrules.h

// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
* Copyright (C) 2010-2013, International Business Machines
* Corporation and others. All Rights Reserved.
*****************************************************************************************
*/

#ifndef UPLURALRULES_H
#define UPLURALRULES_H

#include "unicode/utypes.h"

#if !UCONFIG_NO_FORMATTING

#include "unicode/localpointer.h"
#include "unicode/uenum.h"
#ifndef U_HIDE_INTERNAL_API
#include "unicode/unum.h"
#endif  /* U_HIDE_INTERNAL_API */

// Forward-declaration
struct UFormattedNumber;

/**
 * \file
 * \brief C API: Plural rules, select plural keywords for numeric values.
 *
 * A UPluralRules object defines rules for mapping non-negative numeric
 * values onto a small set of keywords. Rules are constructed from a text
 * description, consisting of a series of keywords and conditions.
 * The uplrules_select function examines each condition in order and
 * returns the keyword for the first condition that matches the number.
 * If none match, the default rule(other) is returned.
 *
 * For more information, see the LDML spec, C.11 Language Plural Rules:
 * http://www.unicode.org/reports/tr35/#Language_Plural_Rules
 *
 * Keywords: ICU locale data has 6 predefined values -
 * 'zero', 'one', 'two', 'few', 'many' and 'other'. Callers need to check
 * the value of keyword returned by the uplrules_select function.
 *
 * These are based on CLDR <i>Language Plural Rules</i>. For these
 * predefined rules, see the CLDR page at
 * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
 */

/**
 * Type of plurals and PluralRules.
 * @stable ICU 50
 */
enum UPluralType {
    /**
     * Plural rules for cardinal numbers: 1 file vs. 2 files.
     * @stable ICU 50
     */
    UPLURAL_TYPE_CARDINAL,
    /**
     * Plural rules for ordinal numbers: 1st file, 2nd file, 3rd file, 4th file, etc.
     * @stable ICU 50
     */
    UPLURAL_TYPE_ORDINAL,
#ifndef U_HIDE_DEPRECATED_API
    /**
     * One more than the highest normal UPluralType value.
     * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
     */
    UPLURAL_TYPE_COUNT
#endif  /* U_HIDE_DEPRECATED_API */
};
/**
 * @stable ICU 50
 */
typedef enum UPluralType UPluralType;

/**
 * Opaque UPluralRules object for use in C programs.
 * @stable ICU 4.8
 */
struct UPluralRules;
typedef struct UPluralRules UPluralRules;  /**< C typedef for struct UPluralRules. @stable ICU 4.8 */

/**
 * Opens a new UPluralRules object using the predefined cardinal-number plural rules for a
 * given locale.
 * Same as uplrules_openForType(locale, UPLURAL_TYPE_CARDINAL, status).
 * @param locale The locale for which the rules are desired.
 * @param status A pointer to a UErrorCode to receive any errors.
 * @return A UPluralRules for the specified locale, or NULL if an error occurred.
 * @stable ICU 4.8
 */
U_CAPI UPluralRules* U_EXPORT2
uplrules_open(const char *locale, UErrorCode *status);

/**
 * Opens a new UPluralRules object using the predefined plural rules for a
 * given locale and the plural type.
 * @param locale The locale for which the rules are desired.
 * @param type The plural type (e.g., cardinal or ordinal).
 * @param status A pointer to a UErrorCode to receive any errors.
 * @return A UPluralRules for the specified locale, or NULL if an error occurred.
 * @stable ICU 50
 */
U_CAPI UPluralRules* U_EXPORT2
uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status);

/**
 * Closes a UPluralRules object. Once closed it may no longer be used.
 * @param uplrules The UPluralRules object to close.
 * @stable ICU 4.8
 */
U_CAPI void U_EXPORT2
uplrules_close(UPluralRules *uplrules);


#if U_SHOW_CPLUSPLUS_API

U_NAMESPACE_BEGIN

/**
 * \class LocalUPluralRulesPointer
 * "Smart pointer" class, closes a UPluralRules via uplrules_close().
 * For most methods see the LocalPointerBase base class.
 *
 * @see LocalPointerBase
 * @see LocalPointer
 * @stable ICU 4.8
 */
U_DEFINE_LOCAL_OPEN_POINTER(LocalUPluralRulesPointer, UPluralRules, uplrules_close);

U_NAMESPACE_END

#endif


/**
 * Given a floating-point number, returns the keyword of the first rule that
 * applies to the number, according to the supplied UPluralRules object.
 * @param uplrules The UPluralRules object specifying the rules.
 * @param number The number for which the rule has to be determined.
 * @param keyword An output buffer to write the keyword of the rule that
 *         applies to number.
 * @param capacity The capacity of the keyword buffer.
 * @param status A pointer to a UErrorCode to receive any errors.
 * @return The length of the keyword.
 * @stable ICU 4.8
 */
U_CAPI int32_t U_EXPORT2
uplrules_select(const UPluralRules *uplrules,
               double number,
               UChar *keyword, int32_t capacity,
               UErrorCode *status);

#ifndef U_HIDE_DRAFT_API
/**
 * Given a formatted number, returns the keyword of the first rule
 * that applies to the number, according to the supplied UPluralRules object.
 *
 * A UFormattedNumber allows you to specify an exponent or trailing zeros,
 * which can affect the plural category. To get a UFormattedNumber, see
 * {@link UNumberFormatter}.
 *
 * @param uplrules The UPluralRules object specifying the rules.
 * @param number The formatted number for which the rule has to be determined.
 * @param keyword The destination buffer for the keyword of the rule that
 *         applies to number.
 * @param capacity The capacity of the keyword buffer.
 * @param status A pointer to a UErrorCode to receive any errors.
 * @return The length of the keyword.
 * @draft ICU 64
 */
U_CAPI int32_t U_EXPORT2
uplrules_selectFormatted(const UPluralRules *uplrules,
               const struct UFormattedNumber* number,
               UChar *keyword, int32_t capacity,
               UErrorCode *status);
#endif  /* U_HIDE_DRAFT_API */

#ifndef U_HIDE_INTERNAL_API
/**
 * Given a number, returns the keyword of the first rule that applies to the
 * number, according to the UPluralRules object and given the number format
 * specified by the UNumberFormat object.
 * Note: This internal preview interface may be removed in the future if
 * an architecturally cleaner solution reaches stable status.
 * @param uplrules The UPluralRules object specifying the rules.
 * @param number The number for which the rule has to be determined.
 * @param fmt The UNumberFormat specifying how the number will be formatted
 *        (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars").
 *        If this is NULL, the function behaves like uplrules_select.
 * @param keyword An output buffer to write the keyword of the rule that
 *         applies to number.
 * @param capacity The capacity of the keyword buffer.
 * @param status A pointer to a UErrorCode to receive any errors.
 * @return The length of keyword.
 * @internal ICU 59 technology preview, may be removed in the future
 */
U_INTERNAL int32_t U_EXPORT2
uplrules_selectWithFormat(const UPluralRules *uplrules,
                          double number,
                          const UNumberFormat *fmt,
                          UChar *keyword, int32_t capacity,
                          UErrorCode *status);

#endif  /* U_HIDE_INTERNAL_API */

/**
 * Creates a string enumeration of all plural rule keywords used in this
 * UPluralRules object. The rule "other" is always present by default.
 * @param uplrules The UPluralRules object specifying the rules for
 *        a given locale.
 * @param status A pointer to a UErrorCode to receive any errors.
 * @return a string enumeration over plural rule keywords, or NULL
 * upon error. The caller is responsible for closing the result.
 * @stable ICU 59
 */
U_STABLE UEnumeration* U_EXPORT2
uplrules_getKeywords(const UPluralRules *uplrules,
                     UErrorCode *status);

#endif /* #if !UCONFIG_NO_FORMATTING */

#endif

Directory Contents

Dirs: 0 × Files: 187

Name Size Perms Modified Actions
26.48 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
8.49 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
9.15 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
27.80 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
9.60 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
20.77 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.08 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
105.74 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.43 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
25.33 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.22 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
24.05 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
23.91 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
13.76 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
56.23 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.88 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
3.76 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.30 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
4.05 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
40.67 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
1.19 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
20.13 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
87.38 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
6.97 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
37.70 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
3.84 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
46.63 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
18.51 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
25.08 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
8.68 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
20.74 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
2.08 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
4.84 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
8.69 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
5.37 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
24.42 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
12.50 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
10.27 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
3.04 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
3.33 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
31.71 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
1.03 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
11.88 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
12.70 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
9.47 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
11.27 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
22.50 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
19.69 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.12 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
47.40 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
11.33 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
93.31 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
4.32 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
33.71 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
44.11 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
34.03 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
30.94 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
2.69 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
86.31 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
30.14 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
49.81 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
7.19 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
3.08 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
5.56 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
28.08 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
25.20 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
18.39 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
3.49 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.33 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
26.58 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
48.73 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
15.60 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
84.36 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
9.18 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
22.62 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
9.37 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
18.07 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.32 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.40 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
22.22 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
14.30 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
12.59 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
45.44 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
70.97 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
11.18 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
1.05 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
9.92 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
5.79 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.38 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
15.33 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
21.30 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
4.27 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
36.61 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
41.02 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
3.38 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
4.90 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
7.85 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
65.82 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
42.89 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
16.85 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
35.37 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
6.12 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
89.56 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
12.65 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
23.97 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
56.90 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
15.18 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
5.36 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
140.56 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
22.58 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.21 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
13.20 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
11.21 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
83.09 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.14 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.59 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
20.99 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
61.46 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
9.46 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
12.07 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
5.53 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
22.46 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
14.67 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
16.12 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
60.88 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
15.56 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
10.03 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
26.01 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
5.89 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.78 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
4.36 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
10.94 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
12.14 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
2.00 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
33.37 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
22.77 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
10.45 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
8.83 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
52.54 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
11.26 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
14.53 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
1.33 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
24.23 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
8.24 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
3.96 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
4.04 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.10 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
3.38 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
64.90 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
170.43 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
20.52 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
24.66 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
53.62 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
25.36 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
7.21 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
10.68 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.88 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
72.05 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
9.84 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
17.26 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
130.97 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
5.38 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
36.54 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
26.87 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
38.12 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
40.00 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
9.55 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
18.00 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
65.90 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
8.14 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
38.54 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
1.89 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
72.47 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
3.15 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
58.13 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
7.86 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
30.96 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
23.32 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
763 B lrw-r--r-- 2022-02-08 16:22:58
Edit Download
45.83 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
13.78 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
15.73 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
25.52 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download
30.74 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.67 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
6.00 KB lrw-r--r-- 2022-02-08 16:22:58
Edit Download
20.30 KB lrw-r--r-- 2022-02-08 16:22:59
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).