annotate modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/common/unicode/uldnames.h @ 11038:20a8447c71c6

8207159: Update ICU to version 62.1 Reviewed-by: mbilla, kcr, ghb
author arajkumar
date Fri, 24 Aug 2018 15:06:40 +0530
parents modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/unicode/uldnames.h@fee4ef5c87df
children
rev   line source
arajkumar@11038 1 // © 2016 and later: Unicode, Inc. and others.
arajkumar@11038 2 // License & terms of use: http://www.unicode.org/copyright.html
ghb@10550 3 /*
ghb@10550 4 *******************************************************************************
arajkumar@11038 5 * Copyright (C) 2010-2016, International Business Machines Corporation and
arajkumar@11038 6 * others. All Rights Reserved.
ghb@10550 7 *******************************************************************************
ghb@10550 8 */
ghb@10550 9
ghb@10550 10 #ifndef __ULDNAMES_H__
ghb@10550 11 #define __ULDNAMES_H__
ghb@10550 12
ghb@10550 13 /**
ghb@10550 14 * \file
ghb@10550 15 * \brief C API: Provides display names of Locale ids and their components.
ghb@10550 16 */
ghb@10550 17
ghb@10550 18 #include "unicode/utypes.h"
ghb@10550 19 #include "unicode/localpointer.h"
ghb@10550 20 #include "unicode/uscript.h"
ghb@10550 21 #include "unicode/udisplaycontext.h"
ghb@10550 22
ghb@10550 23 /**
ghb@10550 24 * Enum used in LocaleDisplayNames::createInstance.
ghb@10550 25 * @stable ICU 4.4
ghb@10550 26 */
ghb@10550 27 typedef enum {
ghb@10550 28 /**
ghb@10550 29 * Use standard names when generating a locale name,
ghb@10550 30 * e.g. en_GB displays as 'English (United Kingdom)'.
ghb@10550 31 * @stable ICU 4.4
ghb@10550 32 */
ghb@10550 33 ULDN_STANDARD_NAMES = 0,
ghb@10550 34 /**
ghb@10550 35 * Use dialect names, when generating a locale name,
ghb@10550 36 * e.g. en_GB displays as 'British English'.
ghb@10550 37 * @stable ICU 4.4
ghb@10550 38 */
ghb@10550 39 ULDN_DIALECT_NAMES
ghb@10550 40 } UDialectHandling;
ghb@10550 41
ghb@10550 42 /**
ghb@10550 43 * Opaque C service object type for the locale display names API
ghb@10550 44 * @stable ICU 4.4
ghb@10550 45 */
ghb@10550 46 struct ULocaleDisplayNames;
ghb@10550 47
ghb@10550 48 /**
ghb@10550 49 * C typedef for struct ULocaleDisplayNames.
ghb@10550 50 * @stable ICU 4.4
ghb@10550 51 */
ghb@10550 52 typedef struct ULocaleDisplayNames ULocaleDisplayNames;
ghb@10550 53
ghb@10550 54 #if !UCONFIG_NO_FORMATTING
ghb@10550 55
ghb@10550 56 /**
ghb@10550 57 * Returns an instance of LocaleDisplayNames that returns names
ghb@10550 58 * formatted for the provided locale, using the provided
ghb@10550 59 * dialectHandling. The usual value for dialectHandling is
ghb@10550 60 * ULOC_STANDARD_NAMES.
ghb@10550 61 *
ghb@10550 62 * @param locale the display locale
ghb@10550 63 * @param dialectHandling how to select names for locales
ghb@10550 64 * @return a ULocaleDisplayNames instance
ghb@10550 65 * @param pErrorCode the status code
ghb@10550 66 * @stable ICU 4.4
ghb@10550 67 */
ghb@10550 68 U_STABLE ULocaleDisplayNames * U_EXPORT2
ghb@10550 69 uldn_open(const char * locale,
ghb@10550 70 UDialectHandling dialectHandling,
ghb@10550 71 UErrorCode *pErrorCode);
ghb@10550 72
ghb@10550 73 /**
ghb@10550 74 * Closes a ULocaleDisplayNames instance obtained from uldn_open().
ghb@10550 75 * @param ldn the ULocaleDisplayNames instance to be closed
ghb@10550 76 * @stable ICU 4.4
ghb@10550 77 */
ghb@10550 78 U_STABLE void U_EXPORT2
ghb@10550 79 uldn_close(ULocaleDisplayNames *ldn);
ghb@10550 80
ghb@10550 81 #if U_SHOW_CPLUSPLUS_API
ghb@10550 82
ghb@10550 83 U_NAMESPACE_BEGIN
ghb@10550 84
ghb@10550 85 /**
ghb@10550 86 * \class LocalULocaleDisplayNamesPointer
ghb@10550 87 * "Smart pointer" class, closes a ULocaleDisplayNames via uldn_close().
ghb@10550 88 * For most methods see the LocalPointerBase base class.
ghb@10550 89 *
ghb@10550 90 * @see LocalPointerBase
ghb@10550 91 * @see LocalPointer
ghb@10550 92 * @stable ICU 4.4
ghb@10550 93 */
ghb@10550 94 U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDisplayNamesPointer, ULocaleDisplayNames, uldn_close);
ghb@10550 95
ghb@10550 96 U_NAMESPACE_END
ghb@10550 97
ghb@10550 98 #endif
ghb@10550 99
ghb@10550 100 /* getters for state */
ghb@10550 101
ghb@10550 102 /**
ghb@10550 103 * Returns the locale used to determine the display names. This is
ghb@10550 104 * not necessarily the same locale passed to {@link #uldn_open}.
ghb@10550 105 * @param ldn the LocaleDisplayNames instance
ghb@10550 106 * @return the display locale
ghb@10550 107 * @stable ICU 4.4
ghb@10550 108 */
ghb@10550 109 U_STABLE const char * U_EXPORT2
ghb@10550 110 uldn_getLocale(const ULocaleDisplayNames *ldn);
ghb@10550 111
ghb@10550 112 /**
ghb@10550 113 * Returns the dialect handling used in the display names.
ghb@10550 114 * @param ldn the LocaleDisplayNames instance
ghb@10550 115 * @return the dialect handling enum
ghb@10550 116 * @stable ICU 4.4
ghb@10550 117 */
ghb@10550 118 U_STABLE UDialectHandling U_EXPORT2
ghb@10550 119 uldn_getDialectHandling(const ULocaleDisplayNames *ldn);
ghb@10550 120
ghb@10550 121 /* names for entire locales */
ghb@10550 122
ghb@10550 123 /**
ghb@10550 124 * Returns the display name of the provided locale.
ghb@10550 125 * @param ldn the LocaleDisplayNames instance
ghb@10550 126 * @param locale the locale whose display name to return
ghb@10550 127 * @param result receives the display name
ghb@10550 128 * @param maxResultSize the size of the result buffer
ghb@10550 129 * @param pErrorCode the status code
ghb@10550 130 * @return the actual buffer size needed for the display name. If it's
ghb@10550 131 * greater than maxResultSize, the returned name will be truncated.
ghb@10550 132 * @stable ICU 4.4
ghb@10550 133 */
ghb@10550 134 U_STABLE int32_t U_EXPORT2
ghb@10550 135 uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
ghb@10550 136 const char *locale,
ghb@10550 137 UChar *result,
ghb@10550 138 int32_t maxResultSize,
ghb@10550 139 UErrorCode *pErrorCode);
ghb@10550 140
ghb@10550 141 /* names for components of a locale */
ghb@10550 142
ghb@10550 143 /**
ghb@10550 144 * Returns the display name of the provided language code.
ghb@10550 145 * @param ldn the LocaleDisplayNames instance
ghb@10550 146 * @param lang the language code whose display name to return
ghb@10550 147 * @param result receives the display name
ghb@10550 148 * @param maxResultSize the size of the result buffer
ghb@10550 149 * @param pErrorCode the status code
ghb@10550 150 * @return the actual buffer size needed for the display name. If it's
ghb@10550 151 * greater than maxResultSize, the returned name will be truncated.
ghb@10550 152 * @stable ICU 4.4
ghb@10550 153 */
ghb@10550 154 U_STABLE int32_t U_EXPORT2
ghb@10550 155 uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
ghb@10550 156 const char *lang,
ghb@10550 157 UChar *result,
ghb@10550 158 int32_t maxResultSize,
ghb@10550 159 UErrorCode *pErrorCode);
ghb@10550 160
ghb@10550 161 /**
ghb@10550 162 * Returns the display name of the provided script.
ghb@10550 163 * @param ldn the LocaleDisplayNames instance
ghb@10550 164 * @param script the script whose display name to return
ghb@10550 165 * @param result receives the display name
ghb@10550 166 * @param maxResultSize the size of the result buffer
ghb@10550 167 * @param pErrorCode the status code
ghb@10550 168 * @return the actual buffer size needed for the display name. If it's
ghb@10550 169 * greater than maxResultSize, the returned name will be truncated.
ghb@10550 170 * @stable ICU 4.4
ghb@10550 171 */
ghb@10550 172 U_STABLE int32_t U_EXPORT2
ghb@10550 173 uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
ghb@10550 174 const char *script,
ghb@10550 175 UChar *result,
ghb@10550 176 int32_t maxResultSize,
ghb@10550 177 UErrorCode *pErrorCode);
ghb@10550 178
ghb@10550 179 /**
ghb@10550 180 * Returns the display name of the provided script code.
ghb@10550 181 * @param ldn the LocaleDisplayNames instance
ghb@10550 182 * @param scriptCode the script code whose display name to return
ghb@10550 183 * @param result receives the display name
ghb@10550 184 * @param maxResultSize the size of the result buffer
ghb@10550 185 * @param pErrorCode the status code
ghb@10550 186 * @return the actual buffer size needed for the display name. If it's
ghb@10550 187 * greater than maxResultSize, the returned name will be truncated.
ghb@10550 188 * @stable ICU 4.4
ghb@10550 189 */
ghb@10550 190 U_STABLE int32_t U_EXPORT2
ghb@10550 191 uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn,
ghb@10550 192 UScriptCode scriptCode,
ghb@10550 193 UChar *result,
ghb@10550 194 int32_t maxResultSize,
ghb@10550 195 UErrorCode *pErrorCode);
ghb@10550 196
ghb@10550 197 /**
ghb@10550 198 * Returns the display name of the provided region code.
ghb@10550 199 * @param ldn the LocaleDisplayNames instance
ghb@10550 200 * @param region the region code whose display name to return
ghb@10550 201 * @param result receives the display name
ghb@10550 202 * @param maxResultSize the size of the result buffer
ghb@10550 203 * @param pErrorCode the status code
ghb@10550 204 * @return the actual buffer size needed for the display name. If it's
ghb@10550 205 * greater than maxResultSize, the returned name will be truncated.
ghb@10550 206 * @stable ICU 4.4
ghb@10550 207 */
ghb@10550 208 U_STABLE int32_t U_EXPORT2
ghb@10550 209 uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
ghb@10550 210 const char *region,
ghb@10550 211 UChar *result,
ghb@10550 212 int32_t maxResultSize,
ghb@10550 213 UErrorCode *pErrorCode);
ghb@10550 214
ghb@10550 215 /**
ghb@10550 216 * Returns the display name of the provided variant
ghb@10550 217 * @param ldn the LocaleDisplayNames instance
ghb@10550 218 * @param variant the variant whose display name to return
ghb@10550 219 * @param result receives the display name
ghb@10550 220 * @param maxResultSize the size of the result buffer
ghb@10550 221 * @param pErrorCode the status code
ghb@10550 222 * @return the actual buffer size needed for the display name. If it's
ghb@10550 223 * greater than maxResultSize, the returned name will be truncated.
ghb@10550 224 * @stable ICU 4.4
ghb@10550 225 */
ghb@10550 226 U_STABLE int32_t U_EXPORT2
ghb@10550 227 uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
ghb@10550 228 const char *variant,
ghb@10550 229 UChar *result,
ghb@10550 230 int32_t maxResultSize,
ghb@10550 231 UErrorCode *pErrorCode);
ghb@10550 232
ghb@10550 233 /**
ghb@10550 234 * Returns the display name of the provided locale key
ghb@10550 235 * @param ldn the LocaleDisplayNames instance
ghb@10550 236 * @param key the locale key whose display name to return
ghb@10550 237 * @param result receives the display name
ghb@10550 238 * @param maxResultSize the size of the result buffer
ghb@10550 239 * @param pErrorCode the status code
ghb@10550 240 * @return the actual buffer size needed for the display name. If it's
ghb@10550 241 * greater than maxResultSize, the returned name will be truncated.
ghb@10550 242 * @stable ICU 4.4
ghb@10550 243 */
ghb@10550 244 U_STABLE int32_t U_EXPORT2
ghb@10550 245 uldn_keyDisplayName(const ULocaleDisplayNames *ldn,
ghb@10550 246 const char *key,
ghb@10550 247 UChar *result,
ghb@10550 248 int32_t maxResultSize,
ghb@10550 249 UErrorCode *pErrorCode);
ghb@10550 250
ghb@10550 251 /**
ghb@10550 252 * Returns the display name of the provided value (used with the provided key).
ghb@10550 253 * @param ldn the LocaleDisplayNames instance
ghb@10550 254 * @param key the locale key
ghb@10550 255 * @param value the locale key's value
ghb@10550 256 * @param result receives the display name
ghb@10550 257 * @param maxResultSize the size of the result buffer
ghb@10550 258 * @param pErrorCode the status code
ghb@10550 259 * @return the actual buffer size needed for the display name. If it's
ghb@10550 260 * greater than maxResultSize, the returned name will be truncated.
ghb@10550 261 * @stable ICU 4.4
ghb@10550 262 */
ghb@10550 263 U_STABLE int32_t U_EXPORT2
ghb@10550 264 uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
ghb@10550 265 const char *key,
ghb@10550 266 const char *value,
ghb@10550 267 UChar *result,
ghb@10550 268 int32_t maxResultSize,
ghb@10550 269 UErrorCode *pErrorCode);
ghb@10550 270
ghb@10550 271 /**
ghb@10550 272 * Returns an instance of LocaleDisplayNames that returns names formatted
ghb@10550 273 * for the provided locale, using the provided UDisplayContext settings.
ghb@10550 274 *
ghb@10550 275 * @param locale The display locale
ghb@10550 276 * @param contexts List of one or more context settings (e.g. for dialect
ghb@10550 277 * handling, capitalization, etc.
ghb@10550 278 * @param length Number of items in the contexts list
ghb@10550 279 * @param pErrorCode Pointer to UErrorCode input/output status. If at entry this indicates
ghb@10550 280 * a failure status, the function will do nothing; otherwise this will be
ghb@10550 281 * updated with any new status from the function.
ghb@10550 282 * @return a ULocaleDisplayNames instance
arajkumar@11038 283 * @stable ICU 51
ghb@10550 284 */
arajkumar@11038 285 U_STABLE ULocaleDisplayNames * U_EXPORT2
ghb@10550 286 uldn_openForContext(const char * locale, UDisplayContext *contexts,
ghb@10550 287 int32_t length, UErrorCode *pErrorCode);
ghb@10550 288
ghb@10550 289 /**
ghb@10550 290 * Returns the UDisplayContext value for the specified UDisplayContextType.
ghb@10550 291 * @param ldn the ULocaleDisplayNames instance
ghb@10550 292 * @param type the UDisplayContextType whose value to return
ghb@10550 293 * @param pErrorCode Pointer to UErrorCode input/output status. If at entry this indicates
ghb@10550 294 * a failure status, the function will do nothing; otherwise this will be
ghb@10550 295 * updated with any new status from the function.
ghb@10550 296 * @return the UDisplayContextValue for the specified type.
arajkumar@11038 297 * @stable ICU 51
ghb@10550 298 */
arajkumar@11038 299 U_STABLE UDisplayContext U_EXPORT2
ghb@10550 300 uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type,
ghb@10550 301 UErrorCode *pErrorCode);
ghb@10550 302
ghb@10550 303 #endif /* !UCONFIG_NO_FORMATTING */
ghb@10550 304 #endif /* __ULDNAMES_H__ */