ICU 74.2: common/unicode/uldnames.h Source File

ICU 74.2 74.2

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/uscript.h"
20#include "unicode/udisplaycontext.h"
21
22#if U_SHOW_CPLUSPLUS_API
23#include "unicode/localpointer.h"
24#endif // U_SHOW_CPLUSPLUS_API
25
30 typedef enum {
36 ULDN_STANDARD_NAMES = 0,
42 ULDN_DIALECT_NAMES
43} UDialectHandling;
44
49struct ULocaleDisplayNames;
50
55 typedef struct ULocaleDisplayNames ULocaleDisplayNames;
56
57#if !UCONFIG_NO_FORMATTING
58
71 U_CAPI ULocaleDisplayNames * U_EXPORT2
72uldn_open(const char * locale,
73 UDialectHandling dialectHandling,
74 UErrorCode *pErrorCode);
75
81 U_CAPI void U_EXPORT2
82uldn_close(ULocaleDisplayNames *ldn);
83
84#if U_SHOW_CPLUSPLUS_API
85
86U_NAMESPACE_BEGIN
87
97 U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDisplayNamesPointer, ULocaleDisplayNames, uldn_close);
98
99U_NAMESPACE_END
100
101#endif
102
103/* getters for state */
104
112 U_CAPI const char * U_EXPORT2
113uldn_getLocale(const ULocaleDisplayNames *ldn);
114
121 U_CAPI UDialectHandling U_EXPORT2
122uldn_getDialectHandling(const ULocaleDisplayNames *ldn);
123
124/* names for entire locales */
125
137 U_CAPI int32_t U_EXPORT2
138uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
139 const char *locale,
140 UChar *result,
141 int32_t maxResultSize,
142 UErrorCode *pErrorCode);
143
144/* names for components of a locale */
145
157 U_CAPI int32_t U_EXPORT2
158uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
159 const char *lang,
160 UChar *result,
161 int32_t maxResultSize,
162 UErrorCode *pErrorCode);
163
175 U_CAPI int32_t U_EXPORT2
176uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
177 const char *script,
178 UChar *result,
179 int32_t maxResultSize,
180 UErrorCode *pErrorCode);
181
193 U_CAPI int32_t U_EXPORT2
194uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn,
195 UScriptCode scriptCode,
196 UChar *result,
197 int32_t maxResultSize,
198 UErrorCode *pErrorCode);
199
211 U_CAPI int32_t U_EXPORT2
212uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
213 const char *region,
214 UChar *result,
215 int32_t maxResultSize,
216 UErrorCode *pErrorCode);
217
229 U_CAPI int32_t U_EXPORT2
230uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
231 const char *variant,
232 UChar *result,
233 int32_t maxResultSize,
234 UErrorCode *pErrorCode);
235
247 U_CAPI int32_t U_EXPORT2
248uldn_keyDisplayName(const ULocaleDisplayNames *ldn,
249 const char *key,
250 UChar *result,
251 int32_t maxResultSize,
252 UErrorCode *pErrorCode);
253
266 U_CAPI int32_t U_EXPORT2
267uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
268 const char *key,
269 const char *value,
270 UChar *result,
271 int32_t maxResultSize,
272 UErrorCode *pErrorCode);
273
288 U_CAPI ULocaleDisplayNames * U_EXPORT2
289uldn_openForContext(const char * locale, UDisplayContext *contexts,
290 int32_t length, UErrorCode *pErrorCode);
291
302 U_CAPI UDisplayContext U_EXPORT2
303uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type,
304 UErrorCode *pErrorCode);
305
306#endif /* !UCONFIG_NO_FORMATTING */
307#endif /* __ULDNAMES_H__ */
LocalULocaleDisplayNamesPointer
"Smart pointer" class, closes a ULocaleDisplayNames via uldn_close().
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition localpointer.h:550
udisplaycontext.h
C API: Display context types (enum values)
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition udisplaycontext.h:27
UDisplayContext
UDisplayContext
Display context settings.
Definition udisplaycontext.h:64
uldn_scriptDisplayName
U_CAPI 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.
ULocaleDisplayNames
struct ULocaleDisplayNames ULocaleDisplayNames
C typedef for struct ULocaleDisplayNames.
Definition uldnames.h:55
uldn_close
U_CAPI void uldn_close(ULocaleDisplayNames *ldn)
Closes a ULocaleDisplayNames instance obtained from uldn_open().
uldn_languageDisplayName
U_CAPI 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.
uldn_getLocale
U_CAPI const char * uldn_getLocale(const ULocaleDisplayNames *ldn)
Returns the locale used to determine the display names.
uldn_localeDisplayName
U_CAPI 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.
UDialectHandling
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition uldnames.h:30
ULDN_DIALECT_NAMES
@ ULDN_DIALECT_NAMES
Use dialect names, when generating a locale name, e.g.
Definition uldnames.h:42
ULDN_STANDARD_NAMES
@ ULDN_STANDARD_NAMES
Use standard names when generating a locale name, e.g.
Definition uldnames.h:36
uldn_getContext
U_CAPI UDisplayContext uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type, UErrorCode *pErrorCode)
Returns the UDisplayContext value for the specified UDisplayContextType.
uldn_regionDisplayName
U_CAPI 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.
uldn_getDialectHandling
U_CAPI UDialectHandling uldn_getDialectHandling(const ULocaleDisplayNames *ldn)
Returns the dialect handling used in the display names.
uldn_open
U_CAPI ULocaleDisplayNames * uldn_open(const char *locale, UDialectHandling dialectHandling, UErrorCode *pErrorCode)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale,...
uldn_openForContext
U_CAPI 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,...
uldn_keyDisplayName
U_CAPI 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.
uldn_scriptCodeDisplayName
U_CAPI 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.
uldn_keyValueDisplayName
U_CAPI 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).
uldn_variantDisplayName
U_CAPI 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.
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:386
uscript.h
C API: Unicode Script Information.
UScriptCode
UScriptCode
Constants for ISO 15924 script codes.
Definition uscript.h:54
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:415