Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* |
michael@0 | 2 | ****************************************************************************** |
michael@0 | 3 | * * |
michael@0 | 4 | * Copyright (C) 2003-2013, International Business Machines * |
michael@0 | 5 | * Corporation and others. All Rights Reserved. * |
michael@0 | 6 | * * |
michael@0 | 7 | ****************************************************************************** |
michael@0 | 8 | * file name: ulocdata.h |
michael@0 | 9 | * encoding: US-ASCII |
michael@0 | 10 | * tab size: 8 (not used) |
michael@0 | 11 | * indentation:4 |
michael@0 | 12 | * |
michael@0 | 13 | * created on: 2003Oct21 |
michael@0 | 14 | * created by: Ram Viswanadha |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | #ifndef __ULOCDATA_H__ |
michael@0 | 18 | #define __ULOCDATA_H__ |
michael@0 | 19 | |
michael@0 | 20 | #include "unicode/ures.h" |
michael@0 | 21 | #include "unicode/uloc.h" |
michael@0 | 22 | #include "unicode/uset.h" |
michael@0 | 23 | #include "unicode/localpointer.h" |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * \file |
michael@0 | 27 | * \brief C API: Provides access to locale data. |
michael@0 | 28 | */ |
michael@0 | 29 | |
michael@0 | 30 | /** Forward declaration of the ULocaleData structure. @stable ICU 3.6 */ |
michael@0 | 31 | struct ULocaleData; |
michael@0 | 32 | |
michael@0 | 33 | /** A locale data object. @stable ICU 3.6 */ |
michael@0 | 34 | typedef struct ULocaleData ULocaleData; |
michael@0 | 35 | |
michael@0 | 36 | |
michael@0 | 37 | |
michael@0 | 38 | /** The possible types of exemplar character sets. |
michael@0 | 39 | * @stable ICU 3.4 |
michael@0 | 40 | */ |
michael@0 | 41 | typedef enum ULocaleDataExemplarSetType { |
michael@0 | 42 | /** Basic set @stable ICU 3.4 */ |
michael@0 | 43 | ULOCDATA_ES_STANDARD=0, |
michael@0 | 44 | /** Auxiliary set @stable ICU 3.4 */ |
michael@0 | 45 | ULOCDATA_ES_AUXILIARY=1, |
michael@0 | 46 | /** Index Character set @stable ICU 4.8 */ |
michael@0 | 47 | ULOCDATA_ES_INDEX=2, |
michael@0 | 48 | #ifndef U_HIDE_DRAFT_API |
michael@0 | 49 | /** Punctuation set @draft ICU 51 */ |
michael@0 | 50 | ULOCDATA_ES_PUNCTUATION=3, |
michael@0 | 51 | #endif /* U_HIDE_DRAFT_API */ |
michael@0 | 52 | /** One higher than the last valid type @stable ICU 3.4 */ |
michael@0 | 53 | ULOCDATA_ES_COUNT=4 |
michael@0 | 54 | } ULocaleDataExemplarSetType; |
michael@0 | 55 | |
michael@0 | 56 | /** The possible types of delimiters. |
michael@0 | 57 | * @stable ICU 3.4 |
michael@0 | 58 | */ |
michael@0 | 59 | typedef enum ULocaleDataDelimiterType { |
michael@0 | 60 | /** Quotation start @stable ICU 3.4 */ |
michael@0 | 61 | ULOCDATA_QUOTATION_START = 0, |
michael@0 | 62 | /** Quotation end @stable ICU 3.4 */ |
michael@0 | 63 | ULOCDATA_QUOTATION_END = 1, |
michael@0 | 64 | /** Alternate quotation start @stable ICU 3.4 */ |
michael@0 | 65 | ULOCDATA_ALT_QUOTATION_START = 2, |
michael@0 | 66 | /** Alternate quotation end @stable ICU 3.4 */ |
michael@0 | 67 | ULOCDATA_ALT_QUOTATION_END = 3, |
michael@0 | 68 | /** One higher than the last valid type @stable ICU 3.4 */ |
michael@0 | 69 | ULOCDATA_DELIMITER_COUNT = 4 |
michael@0 | 70 | } ULocaleDataDelimiterType; |
michael@0 | 71 | |
michael@0 | 72 | /** |
michael@0 | 73 | * Opens a locale data object for the given locale |
michael@0 | 74 | * |
michael@0 | 75 | * @param localeID Specifies the locale associated with this locale |
michael@0 | 76 | * data object. |
michael@0 | 77 | * @param status Pointer to error status code. |
michael@0 | 78 | * @stable ICU 3.4 |
michael@0 | 79 | */ |
michael@0 | 80 | U_STABLE ULocaleData* U_EXPORT2 |
michael@0 | 81 | ulocdata_open(const char *localeID, UErrorCode *status); |
michael@0 | 82 | |
michael@0 | 83 | /** |
michael@0 | 84 | * Closes a locale data object. |
michael@0 | 85 | * |
michael@0 | 86 | * @param uld The locale data object to close |
michael@0 | 87 | * @stable ICU 3.4 |
michael@0 | 88 | */ |
michael@0 | 89 | U_STABLE void U_EXPORT2 |
michael@0 | 90 | ulocdata_close(ULocaleData *uld); |
michael@0 | 91 | |
michael@0 | 92 | #if U_SHOW_CPLUSPLUS_API |
michael@0 | 93 | |
michael@0 | 94 | U_NAMESPACE_BEGIN |
michael@0 | 95 | |
michael@0 | 96 | /** |
michael@0 | 97 | * \class LocalULocaleDataPointer |
michael@0 | 98 | * "Smart pointer" class, closes a ULocaleData via ulocdata_close(). |
michael@0 | 99 | * For most methods see the LocalPointerBase base class. |
michael@0 | 100 | * |
michael@0 | 101 | * @see LocalPointerBase |
michael@0 | 102 | * @see LocalPointer |
michael@0 | 103 | * @stable ICU 4.4 |
michael@0 | 104 | */ |
michael@0 | 105 | U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDataPointer, ULocaleData, ulocdata_close); |
michael@0 | 106 | |
michael@0 | 107 | U_NAMESPACE_END |
michael@0 | 108 | |
michael@0 | 109 | #endif |
michael@0 | 110 | |
michael@0 | 111 | /** |
michael@0 | 112 | * Sets the "no Substitute" attribute of the locale data |
michael@0 | 113 | * object. If true, then any methods associated with the |
michael@0 | 114 | * locale data object will return null when there is no |
michael@0 | 115 | * data available for that method, given the locale ID |
michael@0 | 116 | * supplied to ulocdata_open(). |
michael@0 | 117 | * |
michael@0 | 118 | * @param uld The locale data object to set. |
michael@0 | 119 | * @param setting Value of the "no substitute" attribute. |
michael@0 | 120 | * @stable ICU 3.4 |
michael@0 | 121 | */ |
michael@0 | 122 | U_STABLE void U_EXPORT2 |
michael@0 | 123 | ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting); |
michael@0 | 124 | |
michael@0 | 125 | /** |
michael@0 | 126 | * Retrieves the current "no Substitute" value of the locale data |
michael@0 | 127 | * object. If true, then any methods associated with the |
michael@0 | 128 | * locale data object will return null when there is no |
michael@0 | 129 | * data available for that method, given the locale ID |
michael@0 | 130 | * supplied to ulocdata_open(). |
michael@0 | 131 | * |
michael@0 | 132 | * @param uld Pointer to the The locale data object to set. |
michael@0 | 133 | * @return UBool Value of the "no substitute" attribute. |
michael@0 | 134 | * @stable ICU 3.4 |
michael@0 | 135 | */ |
michael@0 | 136 | U_STABLE UBool U_EXPORT2 |
michael@0 | 137 | ulocdata_getNoSubstitute(ULocaleData *uld); |
michael@0 | 138 | |
michael@0 | 139 | /** |
michael@0 | 140 | * Returns the set of exemplar characters for a locale. |
michael@0 | 141 | * |
michael@0 | 142 | * @param uld Pointer to the locale data object from which the |
michael@0 | 143 | * exemplar character set is to be retrieved. |
michael@0 | 144 | * @param fillIn Pointer to a USet object to receive the |
michael@0 | 145 | * exemplar character set for the given locale. Previous |
michael@0 | 146 | * contents of fillIn are lost. <em>If fillIn is NULL, |
michael@0 | 147 | * then a new USet is created and returned. The caller |
michael@0 | 148 | * owns the result and must dispose of it by calling |
michael@0 | 149 | * uset_close.</em> |
michael@0 | 150 | * @param options Bitmask for options to apply to the exemplar pattern. |
michael@0 | 151 | * Specify zero to retrieve the exemplar set as it is |
michael@0 | 152 | * defined in the locale data. Specify |
michael@0 | 153 | * USET_CASE_INSENSITIVE to retrieve a case-folded |
michael@0 | 154 | * exemplar set. See uset_applyPattern for a complete |
michael@0 | 155 | * list of valid options. The USET_IGNORE_SPACE bit is |
michael@0 | 156 | * always set, regardless of the value of 'options'. |
michael@0 | 157 | * @param extype Specifies the type of exemplar set to be retrieved. |
michael@0 | 158 | * @param status Pointer to an input-output error code value; |
michael@0 | 159 | * must not be NULL. Will be set to U_MISSING_RESOURCE_ERROR |
michael@0 | 160 | * if the requested data is not available. |
michael@0 | 161 | * @return USet* Either fillIn, or if fillIn is NULL, a pointer to |
michael@0 | 162 | * a newly-allocated USet that the user must close. |
michael@0 | 163 | * In case of error, NULL is returned. |
michael@0 | 164 | * @stable ICU 3.4 |
michael@0 | 165 | */ |
michael@0 | 166 | U_STABLE USet* U_EXPORT2 |
michael@0 | 167 | ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn, |
michael@0 | 168 | uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status); |
michael@0 | 169 | |
michael@0 | 170 | /** |
michael@0 | 171 | * Returns one of the delimiter strings associated with a locale. |
michael@0 | 172 | * |
michael@0 | 173 | * @param uld Pointer to the locale data object from which the |
michael@0 | 174 | * delimiter string is to be retrieved. |
michael@0 | 175 | * @param type the type of delimiter to be retrieved. |
michael@0 | 176 | * @param result A pointer to a buffer to receive the result. |
michael@0 | 177 | * @param resultLength The maximum size of result. |
michael@0 | 178 | * @param status Pointer to an error code value |
michael@0 | 179 | * @return int32_t The total buffer size needed; if greater than resultLength, |
michael@0 | 180 | * the output was truncated. |
michael@0 | 181 | * @stable ICU 3.4 |
michael@0 | 182 | */ |
michael@0 | 183 | U_STABLE int32_t U_EXPORT2 |
michael@0 | 184 | ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, UChar *result, int32_t resultLength, UErrorCode *status); |
michael@0 | 185 | |
michael@0 | 186 | /** |
michael@0 | 187 | * Enumeration for representing the measurement systems. |
michael@0 | 188 | * @stable ICU 2.8 |
michael@0 | 189 | */ |
michael@0 | 190 | typedef enum UMeasurementSystem { |
michael@0 | 191 | UMS_SI, /** Measurement system specified by SI otherwise known as Metric system. */ |
michael@0 | 192 | UMS_US, /** Measurement system followed in the United States of America. */ |
michael@0 | 193 | UMS_LIMIT |
michael@0 | 194 | } UMeasurementSystem; |
michael@0 | 195 | |
michael@0 | 196 | /** |
michael@0 | 197 | * Returns the measurement system used in the locale specified by the localeID. |
michael@0 | 198 | * Please note that this API will change in ICU 3.6 and will use an ulocdata object. |
michael@0 | 199 | * |
michael@0 | 200 | * @param localeID The id of the locale for which the measurement system to be retrieved. |
michael@0 | 201 | * @param status Must be a valid pointer to an error code value, |
michael@0 | 202 | * which must not indicate a failure before the function call. |
michael@0 | 203 | * @return UMeasurementSystem the measurement system used in the locale. |
michael@0 | 204 | * @stable ICU 2.8 |
michael@0 | 205 | */ |
michael@0 | 206 | U_STABLE UMeasurementSystem U_EXPORT2 |
michael@0 | 207 | ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status); |
michael@0 | 208 | |
michael@0 | 209 | /** |
michael@0 | 210 | * Returns the element gives the normal business letter size, and customary units. |
michael@0 | 211 | * The units for the numbers are always in <em>milli-meters</em>. |
michael@0 | 212 | * For US since 8.5 and 11 do not yeild an integral value when converted to milli-meters, |
michael@0 | 213 | * the values are rounded off. |
michael@0 | 214 | * So for A4 size paper the height and width are 297 mm and 210 mm repectively, |
michael@0 | 215 | * and for US letter size the height and width are 279 mm and 216 mm respectively. |
michael@0 | 216 | * Please note that this API will change in ICU 3.6 and will use an ulocdata object. |
michael@0 | 217 | * |
michael@0 | 218 | * @param localeID The id of the locale for which the paper size information to be retrieved. |
michael@0 | 219 | * @param height A pointer to int to recieve the height information. |
michael@0 | 220 | * @param width A pointer to int to recieve the width information. |
michael@0 | 221 | * @param status Must be a valid pointer to an error code value, |
michael@0 | 222 | * which must not indicate a failure before the function call. |
michael@0 | 223 | * @stable ICU 2.8 |
michael@0 | 224 | */ |
michael@0 | 225 | U_STABLE void U_EXPORT2 |
michael@0 | 226 | ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UErrorCode *status); |
michael@0 | 227 | |
michael@0 | 228 | /** |
michael@0 | 229 | * Return the current CLDR version used by the library. |
michael@0 | 230 | * @param versionArray fillin that will recieve the version number |
michael@0 | 231 | * @param status error code - could be U_MISSING_RESOURCE_ERROR if the version was not found. |
michael@0 | 232 | * @stable ICU 4.2 |
michael@0 | 233 | */ |
michael@0 | 234 | U_STABLE void U_EXPORT2 |
michael@0 | 235 | ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status); |
michael@0 | 236 | |
michael@0 | 237 | /** |
michael@0 | 238 | * Returns locale display pattern associated with a locale. |
michael@0 | 239 | * |
michael@0 | 240 | * @param uld Pointer to the locale data object from which the |
michael@0 | 241 | * exemplar character set is to be retrieved. |
michael@0 | 242 | * @param pattern locale display pattern for locale. |
michael@0 | 243 | * @param patternCapacity the size of the buffer to store the locale display |
michael@0 | 244 | * pattern with. |
michael@0 | 245 | * @param status Must be a valid pointer to an error code value, |
michael@0 | 246 | * which must not indicate a failure before the function call. |
michael@0 | 247 | * @return the actual buffer size needed for localeDisplayPattern. If it's greater |
michael@0 | 248 | * than patternCapacity, the returned pattern will be truncated. |
michael@0 | 249 | * |
michael@0 | 250 | * @stable ICU 4.2 |
michael@0 | 251 | */ |
michael@0 | 252 | U_STABLE int32_t U_EXPORT2 |
michael@0 | 253 | ulocdata_getLocaleDisplayPattern(ULocaleData *uld, |
michael@0 | 254 | UChar *pattern, |
michael@0 | 255 | int32_t patternCapacity, |
michael@0 | 256 | UErrorCode *status); |
michael@0 | 257 | |
michael@0 | 258 | |
michael@0 | 259 | /** |
michael@0 | 260 | * Returns locale separator associated with a locale. |
michael@0 | 261 | * |
michael@0 | 262 | * @param uld Pointer to the locale data object from which the |
michael@0 | 263 | * exemplar character set is to be retrieved. |
michael@0 | 264 | * @param separator locale separator for locale. |
michael@0 | 265 | * @param separatorCapacity the size of the buffer to store the locale |
michael@0 | 266 | * separator with. |
michael@0 | 267 | * @param status Must be a valid pointer to an error code value, |
michael@0 | 268 | * which must not indicate a failure before the function call. |
michael@0 | 269 | * @return the actual buffer size needed for localeSeparator. If it's greater |
michael@0 | 270 | * than separatorCapacity, the returned separator will be truncated. |
michael@0 | 271 | * |
michael@0 | 272 | * @stable ICU 4.2 |
michael@0 | 273 | */ |
michael@0 | 274 | U_STABLE int32_t U_EXPORT2 |
michael@0 | 275 | ulocdata_getLocaleSeparator(ULocaleData *uld, |
michael@0 | 276 | UChar *separator, |
michael@0 | 277 | int32_t separatorCapacity, |
michael@0 | 278 | UErrorCode *status); |
michael@0 | 279 | #endif |