|
||||
Warning, file /include/unicode/unumsys.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // © 2016 and later: Unicode, Inc. and others. 0002 // License & terms of use: http://www.unicode.org/copyright.html 0003 /* 0004 ***************************************************************************************** 0005 * Copyright (C) 2013-2014, International Business Machines 0006 * Corporation and others. All Rights Reserved. 0007 ***************************************************************************************** 0008 */ 0009 0010 #ifndef UNUMSYS_H 0011 #define UNUMSYS_H 0012 0013 #include "unicode/utypes.h" 0014 0015 #if !UCONFIG_NO_FORMATTING 0016 0017 #include "unicode/uenum.h" 0018 0019 #if U_SHOW_CPLUSPLUS_API 0020 #include "unicode/localpointer.h" 0021 #endif // U_SHOW_CPLUSPLUS_API 0022 0023 /** 0024 * \file 0025 * \brief C API: UNumberingSystem, information about numbering systems 0026 * 0027 * Defines numbering systems. A numbering system describes the scheme by which 0028 * numbers are to be presented to the end user. In its simplest form, a numbering 0029 * system describes the set of digit characters that are to be used to display 0030 * numbers, such as Western digits, Thai digits, Arabic-Indic digits, etc., in a 0031 * positional numbering system with a specified radix (typically 10). 0032 * More complicated numbering systems are algorithmic in nature, and require use 0033 * of an RBNF formatter (rule based number formatter), in order to calculate 0034 * the characters to be displayed for a given number. Examples of algorithmic 0035 * numbering systems include Roman numerals, Chinese numerals, and Hebrew numerals. 0036 * Formatting rules for many commonly used numbering systems are included in 0037 * the ICU package, based on the numbering system rules defined in CLDR. 0038 * Alternate numbering systems can be specified to a locale by using the 0039 * numbers locale keyword. 0040 */ 0041 0042 /** 0043 * Opaque UNumberingSystem object for use in C programs. 0044 * @stable ICU 52 0045 */ 0046 struct UNumberingSystem; 0047 typedef struct UNumberingSystem UNumberingSystem; /**< C typedef for struct UNumberingSystem. @stable ICU 52 */ 0048 0049 /** 0050 * Opens a UNumberingSystem object using the default numbering system for the specified 0051 * locale. 0052 * @param locale The locale for which the default numbering system should be opened. 0053 * @param status A pointer to a UErrorCode to receive any errors. For example, this 0054 * may be U_UNSUPPORTED_ERROR for a locale such as "en@numbers=xyz" that 0055 * specifies a numbering system unknown to ICU. 0056 * @return A UNumberingSystem for the specified locale, or NULL if an error 0057 * occurred. 0058 * @stable ICU 52 0059 */ 0060 U_CAPI UNumberingSystem * U_EXPORT2 0061 unumsys_open(const char *locale, UErrorCode *status); 0062 0063 /** 0064 * Opens a UNumberingSystem object using the name of one of the predefined numbering 0065 * systems specified by CLDR and known to ICU, such as "latn", "arabext", or "hanidec"; 0066 * the full list is returned by unumsys_openAvailableNames. Note that some of the names 0067 * listed at http://unicode.org/repos/cldr/tags/latest/common/bcp47/number.xml - e.g. 0068 * default, native, traditional, finance - do not identify specific numbering systems, 0069 * but rather key values that may only be used as part of a locale, which in turn 0070 * defines how they are mapped to a specific numbering system such as "latn" or "hant". 0071 * 0072 * @param name The name of the numbering system for which a UNumberingSystem object 0073 * should be opened. 0074 * @param status A pointer to a UErrorCode to receive any errors. For example, this 0075 * may be U_UNSUPPORTED_ERROR for a numbering system such as "xyz" that 0076 * is unknown to ICU. 0077 * @return A UNumberingSystem for the specified name, or NULL if an error 0078 * occurred. 0079 * @stable ICU 52 0080 */ 0081 U_CAPI UNumberingSystem * U_EXPORT2 0082 unumsys_openByName(const char *name, UErrorCode *status); 0083 0084 /** 0085 * Close a UNumberingSystem object. Once closed it may no longer be used. 0086 * @param unumsys The UNumberingSystem object to close. 0087 * @stable ICU 52 0088 */ 0089 U_CAPI void U_EXPORT2 0090 unumsys_close(UNumberingSystem *unumsys); 0091 0092 #if U_SHOW_CPLUSPLUS_API 0093 U_NAMESPACE_BEGIN 0094 0095 /** 0096 * \class LocalUNumberingSystemPointer 0097 * "Smart pointer" class, closes a UNumberingSystem via unumsys_close(). 0098 * For most methods see the LocalPointerBase base class. 0099 * @see LocalPointerBase 0100 * @see LocalPointer 0101 * @stable ICU 52 0102 */ 0103 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberingSystemPointer, UNumberingSystem, unumsys_close); 0104 0105 U_NAMESPACE_END 0106 #endif 0107 0108 /** 0109 * Returns an enumeration over the names of all of the predefined numbering systems known 0110 * to ICU. 0111 * The numbering system names will be in alphabetical (invariant) order. 0112 * @param status A pointer to a UErrorCode to receive any errors. 0113 * @return A pointer to a UEnumeration that must be closed with uenum_close(), 0114 * or NULL if an error occurred. 0115 * @stable ICU 52 0116 */ 0117 U_CAPI UEnumeration * U_EXPORT2 0118 unumsys_openAvailableNames(UErrorCode *status); 0119 0120 /** 0121 * Returns the name of the specified UNumberingSystem object (if it is one of the 0122 * predefined names known to ICU). 0123 * @param unumsys The UNumberingSystem whose name is desired. 0124 * @return A pointer to the name of the specified UNumberingSystem object, or 0125 * NULL if the name is not one of the ICU predefined names. The pointer 0126 * is only valid for the lifetime of the UNumberingSystem object. 0127 * @stable ICU 52 0128 */ 0129 U_CAPI const char * U_EXPORT2 0130 unumsys_getName(const UNumberingSystem *unumsys); 0131 0132 /** 0133 * Returns whether the given UNumberingSystem object is for an algorithmic (not purely 0134 * positional) system. 0135 * @param unumsys The UNumberingSystem whose algorithmic status is desired. 0136 * @return true if the specified UNumberingSystem object is for an algorithmic 0137 * system. 0138 * @stable ICU 52 0139 */ 0140 U_CAPI UBool U_EXPORT2 0141 unumsys_isAlgorithmic(const UNumberingSystem *unumsys); 0142 0143 /** 0144 * Returns the radix of the specified UNumberingSystem object. Simple positional 0145 * numbering systems typically have radix 10, but might have a radix of e.g. 16 for 0146 * hexadecimal. The radix is less well-defined for non-positional algorithmic systems. 0147 * @param unumsys The UNumberingSystem whose radix is desired. 0148 * @return The radix of the specified UNumberingSystem object. 0149 * @stable ICU 52 0150 */ 0151 U_CAPI int32_t U_EXPORT2 0152 unumsys_getRadix(const UNumberingSystem *unumsys); 0153 0154 /** 0155 * Get the description string of the specified UNumberingSystem object. For simple 0156 * positional systems this is the ordered string of digits (with length matching 0157 * the radix), e.g. "\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D" 0158 * for "hanidec"; it would be "0123456789ABCDEF" for hexadecimal. For 0159 * algorithmic systems this is the name of the RBNF ruleset used for formatting, 0160 * e.g. "zh/SpelloutRules/%spellout-cardinal" for "hans" or "%greek-upper" for 0161 * "grek". 0162 * @param unumsys The UNumberingSystem whose description string is desired. 0163 * @param result A pointer to a buffer to receive the description string. 0164 * @param resultLength The maximum size of result. 0165 * @param status A pointer to a UErrorCode to receive any errors. 0166 * @return The total buffer size needed; if greater than resultLength, the 0167 * output was truncated. 0168 * @stable ICU 52 0169 */ 0170 U_CAPI int32_t U_EXPORT2 0171 unumsys_getDescription(const UNumberingSystem *unumsys, UChar *result, 0172 int32_t resultLength, UErrorCode *status); 0173 0174 #endif /* #if !UCONFIG_NO_FORMATTING */ 0175 0176 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |