jpayne@69: // © 2016 and later: Unicode, Inc. and others.
jpayne@69: // License & terms of use: http://www.unicode.org/copyright.html
jpayne@69: /*
jpayne@69: ******************************************************************************
jpayne@69: * *
jpayne@69: * Copyright (C) 2003-2015, International Business Machines *
jpayne@69: * Corporation and others. All Rights Reserved. *
jpayne@69: * *
jpayne@69: ******************************************************************************
jpayne@69: * file name: ulocdata.h
jpayne@69: * encoding: UTF-8
jpayne@69: * tab size: 8 (not used)
jpayne@69: * indentation:4
jpayne@69: *
jpayne@69: * created on: 2003Oct21
jpayne@69: * created by: Ram Viswanadha
jpayne@69: */
jpayne@69:
jpayne@69: #ifndef __ULOCDATA_H__
jpayne@69: #define __ULOCDATA_H__
jpayne@69:
jpayne@69: #include "unicode/ures.h"
jpayne@69: #include "unicode/uloc.h"
jpayne@69: #include "unicode/uset.h"
jpayne@69: #include "unicode/localpointer.h"
jpayne@69:
jpayne@69: /**
jpayne@69: * \file
jpayne@69: * \brief C API: Provides access to locale data.
jpayne@69: */
jpayne@69:
jpayne@69: /** Forward declaration of the ULocaleData structure. @stable ICU 3.6 */
jpayne@69: struct ULocaleData;
jpayne@69:
jpayne@69: /** A locale data object. @stable ICU 3.6 */
jpayne@69: typedef struct ULocaleData ULocaleData;
jpayne@69:
jpayne@69:
jpayne@69:
jpayne@69: /** The possible types of exemplar character sets.
jpayne@69: * @stable ICU 3.4
jpayne@69: */
jpayne@69: typedef enum ULocaleDataExemplarSetType {
jpayne@69: /** Basic set @stable ICU 3.4 */
jpayne@69: ULOCDATA_ES_STANDARD=0,
jpayne@69: /** Auxiliary set @stable ICU 3.4 */
jpayne@69: ULOCDATA_ES_AUXILIARY=1,
jpayne@69: /** Index Character set @stable ICU 4.8 */
jpayne@69: ULOCDATA_ES_INDEX=2,
jpayne@69: /** Punctuation set @stable ICU 51 */
jpayne@69: ULOCDATA_ES_PUNCTUATION=3,
jpayne@69: #ifndef U_HIDE_DEPRECATED_API
jpayne@69: /**
jpayne@69: * One more than the highest normal ULocaleDataExemplarSetType value.
jpayne@69: * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
jpayne@69: */
jpayne@69: ULOCDATA_ES_COUNT=4
jpayne@69: #endif /* U_HIDE_DEPRECATED_API */
jpayne@69: } ULocaleDataExemplarSetType;
jpayne@69:
jpayne@69: /** The possible types of delimiters.
jpayne@69: * @stable ICU 3.4
jpayne@69: */
jpayne@69: typedef enum ULocaleDataDelimiterType {
jpayne@69: /** Quotation start @stable ICU 3.4 */
jpayne@69: ULOCDATA_QUOTATION_START = 0,
jpayne@69: /** Quotation end @stable ICU 3.4 */
jpayne@69: ULOCDATA_QUOTATION_END = 1,
jpayne@69: /** Alternate quotation start @stable ICU 3.4 */
jpayne@69: ULOCDATA_ALT_QUOTATION_START = 2,
jpayne@69: /** Alternate quotation end @stable ICU 3.4 */
jpayne@69: ULOCDATA_ALT_QUOTATION_END = 3,
jpayne@69: #ifndef U_HIDE_DEPRECATED_API
jpayne@69: /**
jpayne@69: * One more than the highest normal ULocaleDataDelimiterType value.
jpayne@69: * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
jpayne@69: */
jpayne@69: ULOCDATA_DELIMITER_COUNT = 4
jpayne@69: #endif /* U_HIDE_DEPRECATED_API */
jpayne@69: } ULocaleDataDelimiterType;
jpayne@69:
jpayne@69: /**
jpayne@69: * Opens a locale data object for the given locale
jpayne@69: *
jpayne@69: * @param localeID Specifies the locale associated with this locale
jpayne@69: * data object.
jpayne@69: * @param status Pointer to error status code.
jpayne@69: * @stable ICU 3.4
jpayne@69: */
jpayne@69: U_STABLE ULocaleData* U_EXPORT2
jpayne@69: ulocdata_open(const char *localeID, UErrorCode *status);
jpayne@69:
jpayne@69: /**
jpayne@69: * Closes a locale data object.
jpayne@69: *
jpayne@69: * @param uld The locale data object to close
jpayne@69: * @stable ICU 3.4
jpayne@69: */
jpayne@69: U_STABLE void U_EXPORT2
jpayne@69: ulocdata_close(ULocaleData *uld);
jpayne@69:
jpayne@69: #if U_SHOW_CPLUSPLUS_API
jpayne@69:
jpayne@69: U_NAMESPACE_BEGIN
jpayne@69:
jpayne@69: /**
jpayne@69: * \class LocalULocaleDataPointer
jpayne@69: * "Smart pointer" class, closes a ULocaleData via ulocdata_close().
jpayne@69: * For most methods see the LocalPointerBase base class.
jpayne@69: *
jpayne@69: * @see LocalPointerBase
jpayne@69: * @see LocalPointer
jpayne@69: * @stable ICU 4.4
jpayne@69: */
jpayne@69: U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDataPointer, ULocaleData, ulocdata_close);
jpayne@69:
jpayne@69: U_NAMESPACE_END
jpayne@69:
jpayne@69: #endif
jpayne@69:
jpayne@69: /**
jpayne@69: * Sets the "no Substitute" attribute of the locale data
jpayne@69: * object. If true, then any methods associated with the
jpayne@69: * locale data object will return null when there is no
jpayne@69: * data available for that method, given the locale ID
jpayne@69: * supplied to ulocdata_open().
jpayne@69: *
jpayne@69: * @param uld The locale data object to set.
jpayne@69: * @param setting Value of the "no substitute" attribute.
jpayne@69: * @stable ICU 3.4
jpayne@69: */
jpayne@69: U_STABLE void U_EXPORT2
jpayne@69: ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting);
jpayne@69:
jpayne@69: /**
jpayne@69: * Retrieves the current "no Substitute" value of the locale data
jpayne@69: * object. If true, then any methods associated with the
jpayne@69: * locale data object will return null when there is no
jpayne@69: * data available for that method, given the locale ID
jpayne@69: * supplied to ulocdata_open().
jpayne@69: *
jpayne@69: * @param uld Pointer to the The locale data object to set.
jpayne@69: * @return UBool Value of the "no substitute" attribute.
jpayne@69: * @stable ICU 3.4
jpayne@69: */
jpayne@69: U_STABLE UBool U_EXPORT2
jpayne@69: ulocdata_getNoSubstitute(ULocaleData *uld);
jpayne@69:
jpayne@69: /**
jpayne@69: * Returns the set of exemplar characters for a locale.
jpayne@69: *
jpayne@69: * @param uld Pointer to the locale data object from which the
jpayne@69: * exemplar character set is to be retrieved.
jpayne@69: * @param fillIn Pointer to a USet object to receive the
jpayne@69: * exemplar character set for the given locale. Previous
jpayne@69: * contents of fillIn are lost. If fillIn is NULL,
jpayne@69: * then a new USet is created and returned. The caller
jpayne@69: * owns the result and must dispose of it by calling
jpayne@69: * uset_close.
jpayne@69: * @param options Bitmask for options to apply to the exemplar pattern.
jpayne@69: * Specify zero to retrieve the exemplar set as it is
jpayne@69: * defined in the locale data. Specify
jpayne@69: * USET_CASE_INSENSITIVE to retrieve a case-folded
jpayne@69: * exemplar set. See uset_applyPattern for a complete
jpayne@69: * list of valid options. The USET_IGNORE_SPACE bit is
jpayne@69: * always set, regardless of the value of 'options'.
jpayne@69: * @param extype Specifies the type of exemplar set to be retrieved.
jpayne@69: * @param status Pointer to an input-output error code value;
jpayne@69: * must not be NULL. Will be set to U_MISSING_RESOURCE_ERROR
jpayne@69: * if the requested data is not available.
jpayne@69: * @return USet* Either fillIn, or if fillIn is NULL, a pointer to
jpayne@69: * a newly-allocated USet that the user must close.
jpayne@69: * In case of error, NULL is returned.
jpayne@69: * @stable ICU 3.4
jpayne@69: */
jpayne@69: U_STABLE USet* U_EXPORT2
jpayne@69: ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
jpayne@69: uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status);
jpayne@69:
jpayne@69: /**
jpayne@69: * Returns one of the delimiter strings associated with a locale.
jpayne@69: *
jpayne@69: * @param uld Pointer to the locale data object from which the
jpayne@69: * delimiter string is to be retrieved.
jpayne@69: * @param type the type of delimiter to be retrieved.
jpayne@69: * @param result A pointer to a buffer to receive the result.
jpayne@69: * @param resultLength The maximum size of result.
jpayne@69: * @param status Pointer to an error code value
jpayne@69: * @return int32_t The total buffer size needed; if greater than resultLength,
jpayne@69: * the output was truncated.
jpayne@69: * @stable ICU 3.4
jpayne@69: */
jpayne@69: U_STABLE int32_t U_EXPORT2
jpayne@69: ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, UChar *result, int32_t resultLength, UErrorCode *status);
jpayne@69:
jpayne@69: /**
jpayne@69: * Enumeration for representing the measurement systems.
jpayne@69: * @stable ICU 2.8
jpayne@69: */
jpayne@69: typedef enum UMeasurementSystem {
jpayne@69: UMS_SI, /**< Measurement system specified by SI otherwise known as Metric system. @stable ICU 2.8 */
jpayne@69: UMS_US, /**< Measurement system followed in the United States of America. @stable ICU 2.8 */
jpayne@69: UMS_UK, /**< Mix of metric and imperial units used in Great Britain. @stable ICU 55 */
jpayne@69: #ifndef U_HIDE_DEPRECATED_API
jpayne@69: /**
jpayne@69: * One more than the highest normal UMeasurementSystem value.
jpayne@69: * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
jpayne@69: */
jpayne@69: UMS_LIMIT
jpayne@69: #endif /* U_HIDE_DEPRECATED_API */
jpayne@69: } UMeasurementSystem;
jpayne@69:
jpayne@69: /**
jpayne@69: * Returns the measurement system used in the locale specified by the localeID.
jpayne@69: * Please note that this API will change in ICU 3.6 and will use an ulocdata object.
jpayne@69: *
jpayne@69: * @param localeID The id of the locale for which the measurement system to be retrieved.
jpayne@69: * @param status Must be a valid pointer to an error code value,
jpayne@69: * which must not indicate a failure before the function call.
jpayne@69: * @return UMeasurementSystem the measurement system used in the locale.
jpayne@69: * @stable ICU 2.8
jpayne@69: */
jpayne@69: U_STABLE UMeasurementSystem U_EXPORT2
jpayne@69: ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status);
jpayne@69:
jpayne@69: /**
jpayne@69: * Returns the element gives the normal business letter size, and customary units.
jpayne@69: * The units for the numbers are always in milli-meters.
jpayne@69: * For US since 8.5 and 11 do not yeild an integral value when converted to milli-meters,
jpayne@69: * the values are rounded off.
jpayne@69: * So for A4 size paper the height and width are 297 mm and 210 mm repectively,
jpayne@69: * and for US letter size the height and width are 279 mm and 216 mm respectively.
jpayne@69: * Please note that this API will change in ICU 3.6 and will use an ulocdata object.
jpayne@69: *
jpayne@69: * @param localeID The id of the locale for which the paper size information to be retrieved.
jpayne@69: * @param height A pointer to int to recieve the height information.
jpayne@69: * @param width A pointer to int to recieve the width information.
jpayne@69: * @param status Must be a valid pointer to an error code value,
jpayne@69: * which must not indicate a failure before the function call.
jpayne@69: * @stable ICU 2.8
jpayne@69: */
jpayne@69: U_STABLE void U_EXPORT2
jpayne@69: ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UErrorCode *status);
jpayne@69:
jpayne@69: /**
jpayne@69: * Return the current CLDR version used by the library.
jpayne@69: * @param versionArray fillin that will recieve the version number
jpayne@69: * @param status error code - could be U_MISSING_RESOURCE_ERROR if the version was not found.
jpayne@69: * @stable ICU 4.2
jpayne@69: */
jpayne@69: U_STABLE void U_EXPORT2
jpayne@69: ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status);
jpayne@69:
jpayne@69: /**
jpayne@69: * Returns locale display pattern associated with a locale.
jpayne@69: *
jpayne@69: * @param uld Pointer to the locale data object from which the
jpayne@69: * exemplar character set is to be retrieved.
jpayne@69: * @param pattern locale display pattern for locale.
jpayne@69: * @param patternCapacity the size of the buffer to store the locale display
jpayne@69: * pattern with.
jpayne@69: * @param status Must be a valid pointer to an error code value,
jpayne@69: * which must not indicate a failure before the function call.
jpayne@69: * @return the actual buffer size needed for localeDisplayPattern. If it's greater
jpayne@69: * than patternCapacity, the returned pattern will be truncated.
jpayne@69: *
jpayne@69: * @stable ICU 4.2
jpayne@69: */
jpayne@69: U_STABLE int32_t U_EXPORT2
jpayne@69: ulocdata_getLocaleDisplayPattern(ULocaleData *uld,
jpayne@69: UChar *pattern,
jpayne@69: int32_t patternCapacity,
jpayne@69: UErrorCode *status);
jpayne@69:
jpayne@69:
jpayne@69: /**
jpayne@69: * Returns locale separator associated with a locale.
jpayne@69: *
jpayne@69: * @param uld Pointer to the locale data object from which the
jpayne@69: * exemplar character set is to be retrieved.
jpayne@69: * @param separator locale separator for locale.
jpayne@69: * @param separatorCapacity the size of the buffer to store the locale
jpayne@69: * separator with.
jpayne@69: * @param status Must be a valid pointer to an error code value,
jpayne@69: * which must not indicate a failure before the function call.
jpayne@69: * @return the actual buffer size needed for localeSeparator. If it's greater
jpayne@69: * than separatorCapacity, the returned separator will be truncated.
jpayne@69: *
jpayne@69: * @stable ICU 4.2
jpayne@69: */
jpayne@69: U_STABLE int32_t U_EXPORT2
jpayne@69: ulocdata_getLocaleSeparator(ULocaleData *uld,
jpayne@69: UChar *separator,
jpayne@69: int32_t separatorCapacity,
jpayne@69: UErrorCode *status);
jpayne@69: #endif