w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

upluralrules.cpp File Reference
#include "unicode/utypes.h"
#include "unicode/upluralrules.h"
#include "unicode/plurrule.h"
#include "unicode/locid.h"
#include "unicode/unistr.h"
#include "unicode/unum.h"
#include "unicode/numfmt.h"
#include "unicode/unumberformatter.h"
#include "number_decimalquantity.h"
#include "number_utypes.h"
#include "numrange_impl.h"
Include dependency graph for upluralrules.cpp:

Go to the source code of this file.

Namespaces

namespace  U_NAMESPACE_USE
 

Functions

UnicodeString U_NAMESPACE_USE::select (const PluralRules &rules, const Formattable &obj, const NumberFormat &fmt, UErrorCode &status)
 
UPluralRulesuplrules_open_68 (const char *locale, UErrorCode *status)
 
UPluralRulesuplrules_openForType_68 (const char *locale, UPluralType type, UErrorCode *status)
 
void uplrules_close_68 (UPluralRules *uplrules)
 
int32_t uplrules_select_68 (const UPluralRules *uplrules, double number, UChar *keyword, int32_t capacity, UErrorCode *status)
 
int32_t uplrules_selectFormatted_68 (const UPluralRules *uplrules, const UFormattedNumber *number, UChar *keyword, int32_t capacity, UErrorCode *status)
 
int32_t uplrules_selectForRange_68 (const UPluralRules *uplrules, const UFormattedNumberRange *urange, UChar *keyword, int32_t capacity, UErrorCode *status)
 
int32_t uplrules_selectWithFormat_68 (const UPluralRules *uplrules, double number, const UNumberFormat *fmt, UChar *keyword, int32_t capacity, UErrorCode *status)
 
UEnumerationuplrules_getKeywords_68 (const UPluralRules *uplrules, UErrorCode *status)
 

Function Documentation

◆ uplrules_close_68()

void uplrules_close_68 ( UPluralRules uplrules)

Closes a UPluralRules object. Once closed it may no longer be used.

Parameters
uplrulesThe UPluralRules object to close. @stable ICU 4.8

Definition at line 75 of file upluralrules.cpp.

◆ uplrules_getKeywords_68()

UEnumeration* uplrules_getKeywords_68 ( const UPluralRules uplrules,
UErrorCode status 
)

Creates a string enumeration of all plural rule keywords used in this UPluralRules object. The rule "other" is always present by default.

Parameters
uplrulesThe UPluralRules object specifying the rules for a given locale.
statusA pointer to a UErrorCode to receive any errors.
Returns
a string enumeration over plural rule keywords, or NULL upon error. The caller is responsible for closing the result. @stable ICU 59

Definition at line 160 of file upluralrules.cpp.

References NULL, status, U_FAILURE, U_ILLEGAL_ARGUMENT_ERROR, U_MEMORY_ALLOCATION_ERROR, and uenum_openFromStringEnumeration.

◆ uplrules_open_68()

UPluralRules* uplrules_open_68 ( const char *  locale,
UErrorCode status 
)

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).

Parameters
localeThe locale for which the rules are desired.
statusA pointer to a UErrorCode to receive any errors.
Returns
A UPluralRules for the specified locale, or NULL if an error occurred. @stable ICU 4.8

Definition at line 63 of file upluralrules.cpp.

References locale, status, uplrules_openForType, and UPLURAL_TYPE_CARDINAL.

◆ uplrules_openForType_68()

UPluralRules* uplrules_openForType_68 ( const char *  locale,
UPluralType  type,
UErrorCode status 
)

Opens a new UPluralRules object using the predefined plural rules for a given locale and the plural type.

Parameters
localeThe locale for which the rules are desired.
typeThe plural type (e.g., cardinal or ordinal).
statusA pointer to a UErrorCode to receive any errors.
Returns
A UPluralRules for the specified locale, or NULL if an error occurred. @stable ICU 50

Definition at line 69 of file upluralrules.cpp.

References locale, status, and type.

◆ uplrules_select_68()

int32_t uplrules_select_68 ( const UPluralRules uplrules,
double  number,
UChar keyword,
int32_t  capacity,
UErrorCode status 
)

Given a floating-point number, returns the keyword of the first rule that applies to the number, according to the supplied UPluralRules object.

Parameters
uplrulesThe UPluralRules object specifying the rules.
numberThe number for which the rule has to be determined.
keywordAn output buffer to write the keyword of the rule that applies to number.
capacityThe capacity of the keyword buffer.
statusA pointer to a UErrorCode to receive any errors.
Returns
The length of the keyword. @stable ICU 4.8

Definition at line 81 of file upluralrules.cpp.

References capacity, keyword, NULL, check-static-inits::result, status, U_FAILURE, and U_ILLEGAL_ARGUMENT_ERROR.

◆ uplrules_selectFormatted_68()

int32_t uplrules_selectFormatted_68 ( const UPluralRules uplrules,
const UFormattedNumber number,
UChar keyword,
int32_t  capacity,
UErrorCode status 
)

◆ uplrules_selectForRange_68()

int32_t uplrules_selectForRange_68 ( const UPluralRules uplrules,
const UFormattedNumberRange urange,
UChar keyword,
int32_t  capacity,
UErrorCode status 
)

◆ uplrules_selectWithFormat_68()

int32_t uplrules_selectWithFormat_68 ( const UPluralRules uplrules,
double  number,
const UNumberFormat fmt,
UChar keyword,
int32_t  capacity,
UErrorCode status 
)

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.

Parameters
uplrulesThe UPluralRules object specifying the rules.
numberThe number for which the rule has to be determined.
fmtThe 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.
keywordAn output buffer to write the keyword of the rule that applies to number.
capacityThe capacity of the keyword buffer.
statusA pointer to a UErrorCode to receive any errors.
Returns
The length of keyword.

Definition at line 139 of file upluralrules.cpp.

References capacity, fmt, keyword, NULL, check-static-inits::result, U_NAMESPACE_USE::select(), status, U_FAILURE, and U_ILLEGAL_ARGUMENT_ERROR.