uldnames.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2010-2016, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
#ifndef __ULDNAMES_H__
#define __ULDNAMES_H__
#include "unicode/utypes.h"
#include "unicode/uscript.h"
#include "unicode/udisplaycontext.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/localpointer.h"
#endif // U_SHOW_CPLUSPLUS_API
typedef enum {
ULDN_STANDARD_NAMES = 0,
ULDN_DIALECT_NAMES
} UDialectHandling;
struct ULocaleDisplayNames;
typedef struct ULocaleDisplayNames ULocaleDisplayNames;
#if !UCONFIG_NO_FORMATTING
U_CAPI ULocaleDisplayNames * U_EXPORT2
uldn_open(const char * locale,
UDialectHandling dialectHandling,
UErrorCode *pErrorCode);
U_CAPI void U_EXPORT2
uldn_close(ULocaleDisplayNames *ldn);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDisplayNamesPointer, ULocaleDisplayNames, uldn_close);
U_NAMESPACE_END
#endif
/* getters for state */
U_CAPI const char * U_EXPORT2
uldn_getLocale(const ULocaleDisplayNames *ldn);
U_CAPI UDialectHandling U_EXPORT2
uldn_getDialectHandling(const ULocaleDisplayNames *ldn);
/* names for entire locales */
U_CAPI int32_t U_EXPORT2
uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
const char *locale,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
/* names for components of a locale */
U_CAPI int32_t U_EXPORT2
uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
const char *lang,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
U_CAPI int32_t U_EXPORT2
uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
const char *script,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
U_CAPI int32_t U_EXPORT2
uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn,
UScriptCode scriptCode,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
U_CAPI int32_t U_EXPORT2
uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
const char *region,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
U_CAPI int32_t U_EXPORT2
uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
const char *variant,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
U_CAPI int32_t U_EXPORT2
uldn_keyDisplayName(const ULocaleDisplayNames *ldn,
const char *key,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
U_CAPI int32_t U_EXPORT2
uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
const char *key,
const char *value,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
U_CAPI ULocaleDisplayNames * U_EXPORT2
uldn_openForContext(const char * locale, UDisplayContext *contexts,
int32_t length, UErrorCode *pErrorCode);
U_CAPI UDisplayContext U_EXPORT2
uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type,
UErrorCode *pErrorCode);
#endif /* !UCONFIG_NO_FORMATTING */
#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_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_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_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