Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:12

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 ******************************************************************************
0005 *                                                                            *
0006 * Copyright (C) 2003-2015, International Business Machines                   *
0007 *                Corporation and others. All Rights Reserved.                *
0008 *                                                                            *
0009 ******************************************************************************
0010 *   file name:  ulocdata.h
0011 *   encoding:   UTF-8
0012 *   tab size:   8 (not used)
0013 *   indentation:4
0014 *
0015 *   created on: 2003Oct21
0016 *   created by: Ram Viswanadha
0017 */
0018 
0019 #ifndef __ULOCDATA_H__
0020 #define __ULOCDATA_H__
0021 
0022 #include "unicode/ures.h"
0023 #include "unicode/uloc.h"
0024 #include "unicode/uset.h"
0025 
0026 #if U_SHOW_CPLUSPLUS_API
0027 #include "unicode/localpointer.h"
0028 #endif   // U_SHOW_CPLUSPLUS_API
0029 
0030 /**
0031  * \file
0032  * \brief C API: Provides access to locale data.
0033  */
0034 
0035 /** Forward declaration of the ULocaleData structure. @stable ICU 3.6 */
0036 struct ULocaleData;
0037 
0038 /** A locale data object. @stable ICU 3.6 */
0039 typedef struct ULocaleData ULocaleData;
0040 
0041 
0042 
0043 /** The possible types of exemplar character sets.
0044   * @stable ICU 3.4
0045   */
0046 typedef enum ULocaleDataExemplarSetType  {
0047     /** Basic set @stable ICU 3.4 */
0048     ULOCDATA_ES_STANDARD=0,
0049     /** Auxiliary set @stable ICU 3.4 */
0050     ULOCDATA_ES_AUXILIARY=1,
0051     /** Index Character set @stable ICU 4.8 */
0052     ULOCDATA_ES_INDEX=2,
0053     /** Punctuation set @stable ICU 51 */
0054     ULOCDATA_ES_PUNCTUATION=3,
0055 #ifndef U_HIDE_DEPRECATED_API
0056     /**
0057      * One more than the highest normal ULocaleDataExemplarSetType value.
0058      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
0059      */
0060     ULOCDATA_ES_COUNT=4
0061 #endif  /* U_HIDE_DEPRECATED_API */
0062 } ULocaleDataExemplarSetType;
0063 
0064 /** The possible types of delimiters.
0065   * @stable ICU 3.4
0066   */
0067 typedef enum ULocaleDataDelimiterType {
0068     /** Quotation start @stable ICU 3.4 */
0069     ULOCDATA_QUOTATION_START = 0,
0070     /** Quotation end @stable ICU 3.4 */
0071     ULOCDATA_QUOTATION_END = 1,
0072     /** Alternate quotation start @stable ICU 3.4 */
0073     ULOCDATA_ALT_QUOTATION_START = 2,
0074     /** Alternate quotation end @stable ICU 3.4 */
0075     ULOCDATA_ALT_QUOTATION_END = 3,
0076 #ifndef U_HIDE_DEPRECATED_API
0077     /**
0078      * One more than the highest normal ULocaleDataDelimiterType value.
0079      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
0080      */
0081     ULOCDATA_DELIMITER_COUNT = 4
0082 #endif  /* U_HIDE_DEPRECATED_API */
0083 } ULocaleDataDelimiterType;
0084 
0085 /**
0086  * Opens a locale data object for the given locale
0087  *
0088  * @param localeID  Specifies the locale associated with this locale
0089  *                  data object.
0090  * @param status    Pointer to error status code.
0091  * @stable ICU 3.4
0092  */
0093 U_CAPI ULocaleData* U_EXPORT2
0094 ulocdata_open(const char *localeID, UErrorCode *status);
0095 
0096 /**
0097  * Closes a locale data object.
0098  *
0099  * @param uld       The locale data object to close
0100  * @stable ICU 3.4
0101  */
0102 U_CAPI void U_EXPORT2
0103 ulocdata_close(ULocaleData *uld);
0104 
0105 #if U_SHOW_CPLUSPLUS_API
0106 
0107 U_NAMESPACE_BEGIN
0108 
0109 /**
0110  * \class LocalULocaleDataPointer
0111  * "Smart pointer" class, closes a ULocaleData via ulocdata_close().
0112  * For most methods see the LocalPointerBase base class.
0113  *
0114  * @see LocalPointerBase
0115  * @see LocalPointer
0116  * @stable ICU 4.4
0117  */
0118 U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDataPointer, ULocaleData, ulocdata_close);
0119 
0120 U_NAMESPACE_END
0121 
0122 #endif
0123 
0124 /**
0125  * Sets the "no Substitute" attribute of the locale data
0126  * object.  If true, then any methods associated with the
0127  * locale data object will return null when there is no
0128  * data available for that method, given the locale ID
0129  * supplied to ulocdata_open().
0130  *
0131  * @param uld       The locale data object to set.
0132  * @param setting   Value of the "no substitute" attribute.
0133  * @stable ICU 3.4
0134  */
0135 U_CAPI void U_EXPORT2
0136 ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting);
0137 
0138 /**
0139  * Retrieves the current "no Substitute" value of the locale data
0140  * object.  If true, then any methods associated with the
0141  * locale data object will return null when there is no
0142  * data available for that method, given the locale ID
0143  * supplied to ulocdata_open().
0144  *
0145  * @param uld       Pointer to the The locale data object to set.
0146  * @return UBool    Value of the "no substitute" attribute.
0147  * @stable ICU 3.4
0148  */
0149 U_CAPI UBool U_EXPORT2
0150 ulocdata_getNoSubstitute(ULocaleData *uld);
0151 
0152 /**
0153  * Returns the set of exemplar characters for a locale.
0154  *
0155  * @param uld       Pointer to the locale data object from which the
0156  *                  exemplar character set is to be retrieved.
0157  * @param fillIn    Pointer to a USet object to receive the
0158  *                  exemplar character set for the given locale.  Previous
0159  *                  contents of fillIn are lost.  <em>If fillIn is NULL,
0160  *                  then a new USet is created and returned.  The caller
0161  *                  owns the result and must dispose of it by calling
0162  *                  uset_close.</em>
0163  * @param options   Bitmask for options to apply to the exemplar pattern.
0164  *                  Specify zero to retrieve the exemplar set as it is
0165  *                  defined in the locale data.  Specify
0166  *                  USET_CASE_INSENSITIVE to retrieve a case-folded
0167  *                  exemplar set.  See uset_applyPattern for a complete
0168  *                  list of valid options.  The USET_IGNORE_SPACE bit is
0169  *                  always set, regardless of the value of 'options'.
0170  * @param extype    Specifies the type of exemplar set to be retrieved.
0171  * @param status    Pointer to an input-output error code value;
0172  *                  must not be NULL.  Will be set to U_MISSING_RESOURCE_ERROR
0173  *                  if the requested data is not available.
0174  * @return USet*    Either fillIn, or if fillIn is NULL, a pointer to
0175  *                  a newly-allocated USet that the user must close.
0176  *                  In case of error, NULL is returned.
0177  * @stable ICU 3.4
0178  */
0179 U_CAPI USet* U_EXPORT2
0180 ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
0181                         uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status);
0182 
0183 /**
0184  * Returns one of the delimiter strings associated with a locale.
0185  *
0186  * @param uld           Pointer to the locale data object from which the
0187  *                      delimiter string is to be retrieved.
0188  * @param type          the type of delimiter to be retrieved.
0189  * @param result        A pointer to a buffer to receive the result.
0190  * @param resultLength  The maximum size of result.
0191  * @param status        Pointer to an error code value
0192  * @return int32_t      The total buffer size needed; if greater than resultLength,
0193  *                      the output was truncated.
0194  * @stable ICU 3.4
0195  */
0196 U_CAPI int32_t U_EXPORT2
0197 ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, UChar *result, int32_t resultLength, UErrorCode *status);
0198 
0199 /**
0200  * Enumeration for representing the measurement systems.
0201  * @stable ICU 2.8
0202  */
0203 typedef enum UMeasurementSystem {
0204     UMS_SI,     /**< Measurement system specified by SI otherwise known as Metric system. @stable ICU 2.8 */
0205     UMS_US,     /**< Measurement system followed in the United States of America. @stable ICU 2.8 */
0206     UMS_UK,     /**< Mix of metric and imperial units used in Great Britain. @stable ICU 55 */
0207 #ifndef U_HIDE_DEPRECATED_API
0208     /**
0209      * One more than the highest normal UMeasurementSystem value.
0210      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
0211      */
0212     UMS_LIMIT
0213 #endif  /* U_HIDE_DEPRECATED_API */
0214 } UMeasurementSystem;
0215 
0216 /**
0217  * Returns the measurement system used in the locale specified by the localeID.
0218  * Please note that this API will change in ICU 3.6 and will use an ulocdata object.
0219  *
0220  * @param localeID      The id of the locale for which the measurement system to be retrieved.
0221  * @param status        Must be a valid pointer to an error code value,
0222  *                      which must not indicate a failure before the function call.
0223  * @return UMeasurementSystem the measurement system used in the locale.
0224  * @stable ICU 2.8
0225  */
0226 U_CAPI UMeasurementSystem U_EXPORT2
0227 ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status);
0228 
0229 /**
0230  * Returns the element gives the normal business letter size, and customary units.
0231  * The units for the numbers are always in <em>milli-meters</em>.
0232  * For US since 8.5 and 11 do not yield an integral value when converted to milli-meters,
0233  * the values are rounded off.
0234  * So for A4 size paper the height and width are 297 mm and 210 mm respectively,
0235  * and for US letter size the height and width are 279 mm and 216 mm respectively.
0236  * Please note that this API will change in ICU 3.6 and will use an ulocdata object.
0237  *
0238  * @param localeID      The id of the locale for which the paper size information to be retrieved.
0239  * @param height        A pointer to int to receive the height information.
0240  * @param width         A pointer to int to receive the width information.
0241  * @param status        Must be a valid pointer to an error code value,
0242  *                      which must not indicate a failure before the function call.
0243  * @stable ICU 2.8
0244  */
0245 U_CAPI void U_EXPORT2
0246 ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UErrorCode *status);
0247 
0248 /**
0249  * Return the current CLDR version used by the library.
0250  * @param versionArray fill-in that will receive the version number
0251  * @param status error code - could be U_MISSING_RESOURCE_ERROR if the version was not found.
0252  * @stable ICU 4.2
0253  */
0254 U_CAPI void U_EXPORT2
0255 ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status);
0256 
0257 /**
0258  * Returns locale display pattern associated with a locale.
0259  *
0260  * @param uld       Pointer to the locale data object from which the
0261  *                  exemplar character set is to be retrieved.
0262  * @param pattern   locale display pattern for locale.
0263  * @param patternCapacity the size of the buffer to store the locale display
0264  *                  pattern with.
0265  * @param status    Must be a valid pointer to an error code value,
0266  *                  which must not indicate a failure before the function call.
0267  * @return the actual buffer size needed for localeDisplayPattern.  If it's greater
0268  * than patternCapacity, the returned pattern will be truncated.
0269  *
0270  * @stable ICU 4.2
0271  */
0272 U_CAPI int32_t U_EXPORT2
0273 ulocdata_getLocaleDisplayPattern(ULocaleData *uld,
0274                                  UChar *pattern,
0275                                  int32_t patternCapacity,
0276                                  UErrorCode *status);
0277 
0278 
0279 /**
0280  * Returns locale separator associated with a locale.
0281  *
0282  * @param uld       Pointer to the locale data object from which the
0283  *                  exemplar character set is to be retrieved.
0284  * @param separator locale separator for locale.
0285  * @param separatorCapacity the size of the buffer to store the locale
0286  *                  separator with.
0287  * @param status    Must be a valid pointer to an error code value,
0288  *                  which must not indicate a failure before the function call.
0289  * @return the actual buffer size needed for localeSeparator.  If it's greater
0290  * than separatorCapacity, the returned separator will be truncated.
0291  *
0292  * @stable ICU 4.2
0293  */
0294 U_CAPI int32_t U_EXPORT2
0295 ulocdata_getLocaleSeparator(ULocaleData *uld,
0296                             UChar *separator,
0297                             int32_t separatorCapacity,
0298                             UErrorCode *status);
0299 #endif