1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/unicode/ulocdata.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,279 @@ 1.4 +/* 1.5 +****************************************************************************** 1.6 +* * 1.7 +* Copyright (C) 2003-2013, International Business Machines * 1.8 +* Corporation and others. All Rights Reserved. * 1.9 +* * 1.10 +****************************************************************************** 1.11 +* file name: ulocdata.h 1.12 +* encoding: US-ASCII 1.13 +* tab size: 8 (not used) 1.14 +* indentation:4 1.15 +* 1.16 +* created on: 2003Oct21 1.17 +* created by: Ram Viswanadha 1.18 +*/ 1.19 + 1.20 +#ifndef __ULOCDATA_H__ 1.21 +#define __ULOCDATA_H__ 1.22 + 1.23 +#include "unicode/ures.h" 1.24 +#include "unicode/uloc.h" 1.25 +#include "unicode/uset.h" 1.26 +#include "unicode/localpointer.h" 1.27 + 1.28 +/** 1.29 + * \file 1.30 + * \brief C API: Provides access to locale data. 1.31 + */ 1.32 + 1.33 +/** Forward declaration of the ULocaleData structure. @stable ICU 3.6 */ 1.34 +struct ULocaleData; 1.35 + 1.36 +/** A locale data object. @stable ICU 3.6 */ 1.37 +typedef struct ULocaleData ULocaleData; 1.38 + 1.39 + 1.40 + 1.41 +/** The possible types of exemplar character sets. 1.42 + * @stable ICU 3.4 1.43 + */ 1.44 +typedef enum ULocaleDataExemplarSetType { 1.45 + /** Basic set @stable ICU 3.4 */ 1.46 + ULOCDATA_ES_STANDARD=0, 1.47 + /** Auxiliary set @stable ICU 3.4 */ 1.48 + ULOCDATA_ES_AUXILIARY=1, 1.49 + /** Index Character set @stable ICU 4.8 */ 1.50 + ULOCDATA_ES_INDEX=2, 1.51 +#ifndef U_HIDE_DRAFT_API 1.52 + /** Punctuation set @draft ICU 51 */ 1.53 + ULOCDATA_ES_PUNCTUATION=3, 1.54 +#endif /* U_HIDE_DRAFT_API */ 1.55 + /** One higher than the last valid type @stable ICU 3.4 */ 1.56 + ULOCDATA_ES_COUNT=4 1.57 +} ULocaleDataExemplarSetType; 1.58 + 1.59 +/** The possible types of delimiters. 1.60 + * @stable ICU 3.4 1.61 + */ 1.62 +typedef enum ULocaleDataDelimiterType { 1.63 + /** Quotation start @stable ICU 3.4 */ 1.64 + ULOCDATA_QUOTATION_START = 0, 1.65 + /** Quotation end @stable ICU 3.4 */ 1.66 + ULOCDATA_QUOTATION_END = 1, 1.67 + /** Alternate quotation start @stable ICU 3.4 */ 1.68 + ULOCDATA_ALT_QUOTATION_START = 2, 1.69 + /** Alternate quotation end @stable ICU 3.4 */ 1.70 + ULOCDATA_ALT_QUOTATION_END = 3, 1.71 + /** One higher than the last valid type @stable ICU 3.4 */ 1.72 + ULOCDATA_DELIMITER_COUNT = 4 1.73 +} ULocaleDataDelimiterType; 1.74 + 1.75 +/** 1.76 + * Opens a locale data object for the given locale 1.77 + * 1.78 + * @param localeID Specifies the locale associated with this locale 1.79 + * data object. 1.80 + * @param status Pointer to error status code. 1.81 + * @stable ICU 3.4 1.82 + */ 1.83 +U_STABLE ULocaleData* U_EXPORT2 1.84 +ulocdata_open(const char *localeID, UErrorCode *status); 1.85 + 1.86 +/** 1.87 + * Closes a locale data object. 1.88 + * 1.89 + * @param uld The locale data object to close 1.90 + * @stable ICU 3.4 1.91 + */ 1.92 +U_STABLE void U_EXPORT2 1.93 +ulocdata_close(ULocaleData *uld); 1.94 + 1.95 +#if U_SHOW_CPLUSPLUS_API 1.96 + 1.97 +U_NAMESPACE_BEGIN 1.98 + 1.99 +/** 1.100 + * \class LocalULocaleDataPointer 1.101 + * "Smart pointer" class, closes a ULocaleData via ulocdata_close(). 1.102 + * For most methods see the LocalPointerBase base class. 1.103 + * 1.104 + * @see LocalPointerBase 1.105 + * @see LocalPointer 1.106 + * @stable ICU 4.4 1.107 + */ 1.108 +U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDataPointer, ULocaleData, ulocdata_close); 1.109 + 1.110 +U_NAMESPACE_END 1.111 + 1.112 +#endif 1.113 + 1.114 +/** 1.115 + * Sets the "no Substitute" attribute of the locale data 1.116 + * object. If true, then any methods associated with the 1.117 + * locale data object will return null when there is no 1.118 + * data available for that method, given the locale ID 1.119 + * supplied to ulocdata_open(). 1.120 + * 1.121 + * @param uld The locale data object to set. 1.122 + * @param setting Value of the "no substitute" attribute. 1.123 + * @stable ICU 3.4 1.124 + */ 1.125 +U_STABLE void U_EXPORT2 1.126 +ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting); 1.127 + 1.128 +/** 1.129 + * Retrieves the current "no Substitute" value of the locale data 1.130 + * object. If true, then any methods associated with the 1.131 + * locale data object will return null when there is no 1.132 + * data available for that method, given the locale ID 1.133 + * supplied to ulocdata_open(). 1.134 + * 1.135 + * @param uld Pointer to the The locale data object to set. 1.136 + * @return UBool Value of the "no substitute" attribute. 1.137 + * @stable ICU 3.4 1.138 + */ 1.139 +U_STABLE UBool U_EXPORT2 1.140 +ulocdata_getNoSubstitute(ULocaleData *uld); 1.141 + 1.142 +/** 1.143 + * Returns the set of exemplar characters for a locale. 1.144 + * 1.145 + * @param uld Pointer to the locale data object from which the 1.146 + * exemplar character set is to be retrieved. 1.147 + * @param fillIn Pointer to a USet object to receive the 1.148 + * exemplar character set for the given locale. Previous 1.149 + * contents of fillIn are lost. <em>If fillIn is NULL, 1.150 + * then a new USet is created and returned. The caller 1.151 + * owns the result and must dispose of it by calling 1.152 + * uset_close.</em> 1.153 + * @param options Bitmask for options to apply to the exemplar pattern. 1.154 + * Specify zero to retrieve the exemplar set as it is 1.155 + * defined in the locale data. Specify 1.156 + * USET_CASE_INSENSITIVE to retrieve a case-folded 1.157 + * exemplar set. See uset_applyPattern for a complete 1.158 + * list of valid options. The USET_IGNORE_SPACE bit is 1.159 + * always set, regardless of the value of 'options'. 1.160 + * @param extype Specifies the type of exemplar set to be retrieved. 1.161 + * @param status Pointer to an input-output error code value; 1.162 + * must not be NULL. Will be set to U_MISSING_RESOURCE_ERROR 1.163 + * if the requested data is not available. 1.164 + * @return USet* Either fillIn, or if fillIn is NULL, a pointer to 1.165 + * a newly-allocated USet that the user must close. 1.166 + * In case of error, NULL is returned. 1.167 + * @stable ICU 3.4 1.168 + */ 1.169 +U_STABLE USet* U_EXPORT2 1.170 +ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn, 1.171 + uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status); 1.172 + 1.173 +/** 1.174 + * Returns one of the delimiter strings associated with a locale. 1.175 + * 1.176 + * @param uld Pointer to the locale data object from which the 1.177 + * delimiter string is to be retrieved. 1.178 + * @param type the type of delimiter to be retrieved. 1.179 + * @param result A pointer to a buffer to receive the result. 1.180 + * @param resultLength The maximum size of result. 1.181 + * @param status Pointer to an error code value 1.182 + * @return int32_t The total buffer size needed; if greater than resultLength, 1.183 + * the output was truncated. 1.184 + * @stable ICU 3.4 1.185 + */ 1.186 +U_STABLE int32_t U_EXPORT2 1.187 +ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, UChar *result, int32_t resultLength, UErrorCode *status); 1.188 + 1.189 +/** 1.190 + * Enumeration for representing the measurement systems. 1.191 + * @stable ICU 2.8 1.192 + */ 1.193 +typedef enum UMeasurementSystem { 1.194 + UMS_SI, /** Measurement system specified by SI otherwise known as Metric system. */ 1.195 + UMS_US, /** Measurement system followed in the United States of America. */ 1.196 + UMS_LIMIT 1.197 +} UMeasurementSystem; 1.198 + 1.199 +/** 1.200 + * Returns the measurement system used in the locale specified by the localeID. 1.201 + * Please note that this API will change in ICU 3.6 and will use an ulocdata object. 1.202 + * 1.203 + * @param localeID The id of the locale for which the measurement system to be retrieved. 1.204 + * @param status Must be a valid pointer to an error code value, 1.205 + * which must not indicate a failure before the function call. 1.206 + * @return UMeasurementSystem the measurement system used in the locale. 1.207 + * @stable ICU 2.8 1.208 + */ 1.209 +U_STABLE UMeasurementSystem U_EXPORT2 1.210 +ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status); 1.211 + 1.212 +/** 1.213 + * Returns the element gives the normal business letter size, and customary units. 1.214 + * The units for the numbers are always in <em>milli-meters</em>. 1.215 + * For US since 8.5 and 11 do not yeild an integral value when converted to milli-meters, 1.216 + * the values are rounded off. 1.217 + * So for A4 size paper the height and width are 297 mm and 210 mm repectively, 1.218 + * and for US letter size the height and width are 279 mm and 216 mm respectively. 1.219 + * Please note that this API will change in ICU 3.6 and will use an ulocdata object. 1.220 + * 1.221 + * @param localeID The id of the locale for which the paper size information to be retrieved. 1.222 + * @param height A pointer to int to recieve the height information. 1.223 + * @param width A pointer to int to recieve the width information. 1.224 + * @param status Must be a valid pointer to an error code value, 1.225 + * which must not indicate a failure before the function call. 1.226 + * @stable ICU 2.8 1.227 + */ 1.228 +U_STABLE void U_EXPORT2 1.229 +ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UErrorCode *status); 1.230 + 1.231 +/** 1.232 + * Return the current CLDR version used by the library. 1.233 + * @param versionArray fillin that will recieve the version number 1.234 + * @param status error code - could be U_MISSING_RESOURCE_ERROR if the version was not found. 1.235 + * @stable ICU 4.2 1.236 + */ 1.237 +U_STABLE void U_EXPORT2 1.238 +ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status); 1.239 + 1.240 +/** 1.241 + * Returns locale display pattern associated with a locale. 1.242 + * 1.243 + * @param uld Pointer to the locale data object from which the 1.244 + * exemplar character set is to be retrieved. 1.245 + * @param pattern locale display pattern for locale. 1.246 + * @param patternCapacity the size of the buffer to store the locale display 1.247 + * pattern with. 1.248 + * @param status Must be a valid pointer to an error code value, 1.249 + * which must not indicate a failure before the function call. 1.250 + * @return the actual buffer size needed for localeDisplayPattern. If it's greater 1.251 + * than patternCapacity, the returned pattern will be truncated. 1.252 + * 1.253 + * @stable ICU 4.2 1.254 + */ 1.255 +U_STABLE int32_t U_EXPORT2 1.256 +ulocdata_getLocaleDisplayPattern(ULocaleData *uld, 1.257 + UChar *pattern, 1.258 + int32_t patternCapacity, 1.259 + UErrorCode *status); 1.260 + 1.261 + 1.262 +/** 1.263 + * Returns locale separator associated with a locale. 1.264 + * 1.265 + * @param uld Pointer to the locale data object from which the 1.266 + * exemplar character set is to be retrieved. 1.267 + * @param separator locale separator for locale. 1.268 + * @param separatorCapacity the size of the buffer to store the locale 1.269 + * separator with. 1.270 + * @param status Must be a valid pointer to an error code value, 1.271 + * which must not indicate a failure before the function call. 1.272 + * @return the actual buffer size needed for localeSeparator. If it's greater 1.273 + * than separatorCapacity, the returned separator will be truncated. 1.274 + * 1.275 + * @stable ICU 4.2 1.276 + */ 1.277 +U_STABLE int32_t U_EXPORT2 1.278 +ulocdata_getLocaleSeparator(ULocaleData *uld, 1.279 + UChar *separator, 1.280 + int32_t separatorCapacity, 1.281 + UErrorCode *status); 1.282 +#endif