annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/ulocdata.h @ 69:33d812a61356

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