ICU 63.1 63.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"
21 #include "unicode/udisplaycontext.h"
22
27 typedef enum {
33 ULDN_STANDARD_NAMES = 0,
39 ULDN_DIALECT_NAMES
40 } UDialectHandling;
41
46 struct ULocaleDisplayNames;
47
52 typedef struct ULocaleDisplayNames ULocaleDisplayNames;
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
79 uldn_close(ULocaleDisplayNames *ldn);
80
81 #if U_SHOW_CPLUSPLUS_API
82
83 U_NAMESPACE_BEGIN
84
94 U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDisplayNamesPointer, ULocaleDisplayNames, uldn_close);
95
96 U_NAMESPACE_END
97
98 #endif
99
100 /* getters for state */
101
109 U_STABLE const char * U_EXPORT2
110 uldn_getLocale(const ULocaleDisplayNames *ldn);
111
118 U_STABLE UDialectHandling U_EXPORT2
119 uldn_getDialectHandling(const ULocaleDisplayNames *ldn);
120
121 /* names for entire locales */
122
134 U_STABLE int32_t U_EXPORT2
135 uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
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
155 uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
156 const char *lang,
157 UChar *result,
158 int32_t maxResultSize,
159 UErrorCode *pErrorCode);
160
172 U_STABLE int32_t U_EXPORT2
173 uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
174 const char *script,
175 UChar *result,
176 int32_t maxResultSize,
177 UErrorCode *pErrorCode);
178
190 U_STABLE int32_t U_EXPORT2
191 uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn,
192 UScriptCode scriptCode,
193 UChar *result,
194 int32_t maxResultSize,
195 UErrorCode *pErrorCode);
196
208 U_STABLE int32_t U_EXPORT2
209 uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
210 const char *region,
211 UChar *result,
212 int32_t maxResultSize,
213 UErrorCode *pErrorCode);
214
226 U_STABLE int32_t U_EXPORT2
227 uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
228 const char *variant,
229 UChar *result,
230 int32_t maxResultSize,
231 UErrorCode *pErrorCode);
232
244 U_STABLE int32_t U_EXPORT2
245 uldn_keyDisplayName(const ULocaleDisplayNames *ldn,
246 const char *key,
247 UChar *result,
248 int32_t maxResultSize,
249 UErrorCode *pErrorCode);
250
263 U_STABLE int32_t U_EXPORT2
264 uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
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
300 uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type,
301 UErrorCode *pErrorCode);
302
303 #endif /* !UCONFIG_NO_FORMATTING */
304 #endif /* __ULDNAMES_H__ */
uldn_keyDisplayName
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_getDialectHandling
UDialectHandling uldn_getDialectHandling(const ULocaleDisplayNames *ldn)
Returns the dialect handling used in the display names.
uldn_localeDisplayName
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
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
UScriptCode
UScriptCode
Constants for ISO 15924 script codes.
Definition: uscript.h:54
udisplaycontext.h
C API: Display context types (enum values)
uldn_getContext
UDisplayContext uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type, UErrorCode *pErrorCode)
Returns the UDisplayContext value for the specified UDisplayContextType.
uscript.h
C API: Unicode Script Information.
uldn_scriptDisplayName
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.
uldn_regionDisplayName
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.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
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:487
uldn_openForContext
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...
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
uldn_open
ULocaleDisplayNames * uldn_open(const char *locale, UDialectHandling dialectHandling, UErrorCode *pErrorCode)
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale...
uldn_variantDisplayName
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.
ULDN_DIALECT_NAMES
Use dialect names, when generating a locale name, e.g.
Definition: uldnames.h:39
ULocaleDisplayNames
struct ULocaleDisplayNames ULocaleDisplayNames
C typedef for struct ULocaleDisplayNames.
Definition: uldnames.h:52
ULDN_STANDARD_NAMES
Use standard names when generating a locale name, e.g.
Definition: uldnames.h:33
UDialectHandling
UDialectHandling
Enum used in LocaleDisplayNames::createInstance.
Definition: uldnames.h:27
uldn_scriptCodeDisplayName
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.
UChar
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:342
uldn_close
void uldn_close(ULocaleDisplayNames *ldn)
Closes a ULocaleDisplayNames instance obtained from uldn_open().
uldn_languageDisplayName
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.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:138
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:401
uldn_getLocale
const char * uldn_getLocale(const ULocaleDisplayNames *ldn)
Returns the locale used to determine the display names.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
uldn_keyValueDisplayName
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).
LocalULocaleDisplayNamesPointer
"Smart pointer" class, closes a ULocaleDisplayNames via uldn_close().
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111