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