ICU 73.2  73.2
upluralrules.h
Go to the documentation of this file.
00001 // © 2016 and later: Unicode, Inc. and others.
00002 // License & terms of use: http://www.unicode.org/copyright.html
00003 /*
00004 *****************************************************************************************
00005 * Copyright (C) 2010-2013, International Business Machines
00006 * Corporation and others. All Rights Reserved.
00007 *****************************************************************************************
00008 */
00009 
00010 #ifndef UPLURALRULES_H
00011 #define UPLURALRULES_H
00012 
00013 #include "unicode/utypes.h"
00014 
00015 #if !UCONFIG_NO_FORMATTING
00016 
00017 #include "unicode/uenum.h"
00018 
00019 #if U_SHOW_CPLUSPLUS_API
00020 #include "unicode/localpointer.h"
00021 #endif   // U_SHOW_CPLUSPLUS_API
00022 
00023 #ifndef U_HIDE_INTERNAL_API
00024 #include "unicode/unum.h"
00025 #endif  /* U_HIDE_INTERNAL_API */
00026 
00027 // Forward-declaration
00028 struct UFormattedNumber;
00029 struct UFormattedNumberRange;
00030 
00059 enum UPluralType {
00064     UPLURAL_TYPE_CARDINAL,
00069     UPLURAL_TYPE_ORDINAL,
00070 #ifndef U_HIDE_DEPRECATED_API
00071 
00075     UPLURAL_TYPE_COUNT
00076 #endif  /* U_HIDE_DEPRECATED_API */
00077 };
00081 typedef enum UPluralType UPluralType;
00082 
00087 struct UPluralRules;
00088 typedef struct UPluralRules UPluralRules;  
00099 U_CAPI UPluralRules* U_EXPORT2
00100 uplrules_open(const char *locale, UErrorCode *status);
00101 
00111 U_CAPI UPluralRules* U_EXPORT2
00112 uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status);
00113 
00119 U_CAPI void U_EXPORT2
00120 uplrules_close(UPluralRules *uplrules);
00121 
00122 
00123 #if U_SHOW_CPLUSPLUS_API
00124 
00125 U_NAMESPACE_BEGIN
00126 
00136 U_DEFINE_LOCAL_OPEN_POINTER(LocalUPluralRulesPointer, UPluralRules, uplrules_close);
00137 
00138 U_NAMESPACE_END
00139 
00140 #endif
00141 
00142 
00155 U_CAPI int32_t U_EXPORT2
00156 uplrules_select(const UPluralRules *uplrules,
00157                double number,
00158                UChar *keyword, int32_t capacity,
00159                UErrorCode *status);
00160 
00178 U_CAPI int32_t U_EXPORT2
00179 uplrules_selectFormatted(const UPluralRules *uplrules,
00180                const struct UFormattedNumber* number,
00181                UChar *keyword, int32_t capacity,
00182                UErrorCode *status);
00183 
00199 U_CAPI int32_t U_EXPORT2
00200 uplrules_selectForRange(const UPluralRules *uplrules,
00201                const struct UFormattedNumberRange* urange,
00202                UChar *keyword, int32_t capacity,
00203                UErrorCode *status);
00204 
00205 #ifndef U_HIDE_INTERNAL_API
00206 
00224 U_CAPI int32_t U_EXPORT2
00225 uplrules_selectWithFormat(const UPluralRules *uplrules,
00226                           double number,
00227                           const UNumberFormat *fmt,
00228                           UChar *keyword, int32_t capacity,
00229                           UErrorCode *status);
00230 
00231 #endif  /* U_HIDE_INTERNAL_API */
00232 
00243 U_CAPI UEnumeration* U_EXPORT2
00244 uplrules_getKeywords(const UPluralRules *uplrules,
00245                      UErrorCode *status);
00246 
00247 #endif /* #if !UCONFIG_NO_FORMATTING */
00248 
00249 #endif