ulocale.h
Go to the documentation of this file.
// © 2023 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#ifndef ULOCALE_H
#define ULOCALE_H
#include "unicode/localpointer.h"
#include "unicode/uenum.h"
#include "unicode/utypes.h"
#ifndef U_HIDE_DRAFT_API
struct ULocale;
typedef struct ULocale ULocale;
U_CAPI ULocale* U_EXPORT2
ulocale_openForLocaleID(const char* localeID, int32_t length, UErrorCode* err);
U_CAPI ULocale* U_EXPORT2
ulocale_openForLanguageTag(const char* tag, int32_t length, UErrorCode* err);
U_CAPI void U_EXPORT2
ulocale_close(ULocale* locale);
U_CAPI const char* U_EXPORT2
ulocale_getLanguage(const ULocale* locale);
U_CAPI const char* U_EXPORT2
ulocale_getScript(const ULocale* locale);
U_CAPI const char* U_EXPORT2
ulocale_getRegion(const ULocale* locale);
U_CAPI const char* U_EXPORT2
ulocale_getVariant(const ULocale* locale);
U_CAPI const char* U_EXPORT2
ulocale_getLocaleID(const ULocale* locale);
U_CAPI const char* U_EXPORT2
ulocale_getBaseName(const ULocale* locale);
U_CAPI bool U_EXPORT2
ulocale_isBogus(const ULocale* locale);
U_CAPI UEnumeration* U_EXPORT2
ulocale_getKeywords(const ULocale* locale, UErrorCode *err);
U_CAPI UEnumeration* U_EXPORT2
ulocale_getUnicodeKeywords(const ULocale* locale, UErrorCode *err);
U_CAPI int32_t U_EXPORT2
ulocale_getKeywordValue(
const ULocale* locale, const char* keyword, int32_t keywordLength,
char* valueBuffer, int32_t valueBufferCapacity, UErrorCode *err);
U_CAPI int32_t U_EXPORT2
ulocale_getUnicodeKeywordValue(
const ULocale* locale, const char* keyword, int32_t keywordLength,
char* valueBuffer, int32_t valueBufferCapacity, UErrorCode *err);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
U_DEFINE_LOCAL_OPEN_POINTER(LocalULocalePointer, ULocale, ulocale_close);
U_NAMESPACE_END
#endif /* U_SHOW_CPLUSPLUS_API */
#endif /* U_HIDE_DRAFT_API */
#endif /*_ULOCALE */
LocalULocalePointer
"Smart pointer" class, closes a ULocale via ulocale_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
uenum.h
C API: String Enumeration.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:44
ulocale_openForLocaleID
U_CAPI ULocale * ulocale_openForLocaleID(const char *localeID, int32_t length, UErrorCode *err)
Constructs an ULocale from the locale ID.
ulocale_getKeywords
U_CAPI UEnumeration * ulocale_getKeywords(const ULocale *locale, UErrorCode *err)
Gets the list of keywords for the specified locale.
ulocale_getScript
U_CAPI const char * ulocale_getScript(const ULocale *locale)
Returns the locale's ISO-15924 abbreviation script code.
ulocale_openForLanguageTag
U_CAPI ULocale * ulocale_openForLanguageTag(const char *tag, int32_t length, UErrorCode *err)
Constructs an ULocale from the provided IETF BCP 47 language tag.
ulocale_getRegion
U_CAPI const char * ulocale_getRegion(const ULocale *locale)
Returns the locale's ISO-3166 region code.
ulocale_getUnicodeKeywords
U_CAPI UEnumeration * ulocale_getUnicodeKeywords(const ULocale *locale, UErrorCode *err)
Gets the list of unicode keywords for the specified locale.
ulocale_getBaseName
U_CAPI const char * ulocale_getBaseName(const ULocale *locale)
Returns the programmatic name of the entire locale as ulocale_getLocaleID() would return,...
ULocale
struct ULocale ULocale
C typedef for struct ULocale.
Definition: ulocale.h:27
ulocale_getVariant
U_CAPI const char * ulocale_getVariant(const ULocale *locale)
Returns the locale's variant code.
ulocale_getUnicodeKeywordValue
U_CAPI int32_t ulocale_getUnicodeKeywordValue(const ULocale *locale, const char *keyword, int32_t keywordLength, char *valueBuffer, int32_t valueBufferCapacity, UErrorCode *err)
Gets the Unicode value for a Unicode keyword.
ulocale_getLanguage
U_CAPI const char * ulocale_getLanguage(const ULocale *locale)
Returns the locale's ISO-639 language code.
ulocale_getLocaleID
U_CAPI const char * ulocale_getLocaleID(const ULocale *locale)
Returns the programmatic name of the entire locale, with the language, country and variant separated ...
ulocale_isBogus
U_CAPI bool ulocale_isBogus(const ULocale *locale)
Gets the bogus state.
ulocale_close
U_CAPI void ulocale_close(ULocale *locale)
Close the locale and destroy it's internal states.
ulocale_getKeywordValue
U_CAPI int32_t ulocale_getKeywordValue(const ULocale *locale, const char *keyword, int32_t keywordLength, char *valueBuffer, int32_t valueBufferCapacity, UErrorCode *err)
Gets the value for a keyword.
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
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