ICU 66.0.1  66.0.1
uldnames.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (C) 2010-2016, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 *******************************************************************************
8 */
9 
10 #ifndef __ULDNAMES_H__
11 #define __ULDNAMES_H__
12 
18 #include "unicode/utypes.h"
19 #include "unicode/localpointer.h"
20 #include "unicode/uscript.h"
22 
27 typedef enum {
41 
46 struct ULocaleDisplayNames;
47 
53 
54 #if !UCONFIG_NO_FORMATTING
55 
68 U_STABLE ULocaleDisplayNames * U_EXPORT2
69 uldn_open(const char * locale,
70  UDialectHandling dialectHandling,
71  UErrorCode *pErrorCode);
72 
78 U_STABLE void U_EXPORT2
80 
81 #if U_SHOW_CPLUSPLUS_API
82 
83 U_NAMESPACE_BEGIN
84 
95 
96 U_NAMESPACE_END
97 
98 #endif
99 
100 /* getters for state */
101 
109 U_STABLE const char * U_EXPORT2
111 
118 U_STABLE UDialectHandling U_EXPORT2
120 
121 /* names for entire locales */
122 
134 U_STABLE int32_t U_EXPORT2
136  const char *locale,
137  UChar *result,
138  int32_t maxResultSize,
139  UErrorCode *pErrorCode);
140 
141 /* names for components of a locale */
142 
154 U_STABLE int32_t U_EXPORT2
156  const char *lang,
157  UChar *result,
158  int32_t maxResultSize,
159  UErrorCode *pErrorCode);
160 
172 U_STABLE int32_t U_EXPORT2
174  const char *script,
175  UChar *result,
176  int32_t maxResultSize,
177  UErrorCode *pErrorCode);
178 
190 U_STABLE int32_t U_EXPORT2
192  UScriptCode scriptCode,
193  UChar *result,
194  int32_t maxResultSize,
195  UErrorCode *pErrorCode);
196 
208 U_STABLE int32_t U_EXPORT2
210  const char *region,
211  UChar *result,
212  int32_t maxResultSize,
213  UErrorCode *pErrorCode);
214 
226 U_STABLE int32_t U_EXPORT2
228  const char *variant,
229  UChar *result,
230  int32_t maxResultSize,
231  UErrorCode *pErrorCode);
232 
244 U_STABLE int32_t U_EXPORT2
246  const char *key,
247  UChar *result,
248  int32_t maxResultSize,
249  UErrorCode *pErrorCode);
250 
263 U_STABLE int32_t U_EXPORT2
265  const char *key,
266  const char *value,
267  UChar *result,
268  int32_t maxResultSize,
269  UErrorCode *pErrorCode);
270 
285 U_STABLE ULocaleDisplayNames * U_EXPORT2
286 uldn_openForContext(const char * locale, UDisplayContext *contexts,
287  int32_t length, UErrorCode *pErrorCode);
288 
299 U_STABLE UDisplayContext U_EXPORT2
301  UErrorCode *pErrorCode);
302 
303 #endif /* !UCONFIG_NO_FORMATTING */
304 #endif /* __ULDNAMES_H__ */
int32_t uldn_keyDisplayName(const ULocaleDisplayNames *ldn, const char *key, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
Returns the display name of the provided locale key.
UDialectHandling uldn_getDialectHandling(const ULocaleDisplayNames *ldn)
Returns the dialect handling used in the display names.
int32_t uldn_localeDisplayName(const ULocaleDisplayNames *ldn, const char *locale, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
Returns the display name of the provided locale.
UDisplayContext
Display context settings.
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:54
C API: Display context types (enum values)
UDisplayContext uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type, UErrorCode *pErrorCode)
Returns the UDisplayContext value for the specified UDisplayContextType.
C API: Unicode Script Information.
int32_t uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, const char *script, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
Returns the display name of the provided script.
int32_t uldn_regionDisplayName(const ULocaleDisplayNames *ldn, const char *region, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
Returns the display name of the provided region code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:562
ULocaleDisplayNames * uldn_openForContext(const char *locale, UDisplayContext *contexts, int32_t length, UErrorCode *pErrorCode)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale...
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
ULocaleDisplayNames * uldn_open(const char *locale, UDialectHandling dialectHandling, UErrorCode *pErrorCode)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale...
int32_t uldn_variantDisplayName(const ULocaleDisplayNames *ldn, const char *variant, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
Returns the display name of the provided variant.
Use dialect names, when generating a locale name, e.g.
Definition: uldnames.h:39
struct ULocaleDisplayNames ULocaleDisplayNames
C typedef for struct ULocaleDisplayNames.
Definition: uldnames.h:52
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:33
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:27
int32_t uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, UScriptCode scriptCode, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
Returns the display name of the provided script code.
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:378
void uldn_close(ULocaleDisplayNames *ldn)
Closes a ULocaleDisplayNames instance obtained from uldn_open().
int32_t uldn_languageDisplayName(const ULocaleDisplayNames *ldn, const char *lang, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
Returns the display name of the provided language code.
UDisplayContextType
Display context types, for getting values of a particular setting.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
const char * uldn_getLocale(const ULocaleDisplayNames *ldn)
Returns the locale used to determine the display names.
Basic definitions for ICU, for both C and C++ APIs.
int32_t uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn, const char *key, const char *value, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
Returns the display name of the provided value (used with the provided key).
"Smart pointer" class, closes a ULocaleDisplayNames via uldn_close().
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111