ICU 74.1 74.1

ulocbuilder.h
Go to the documentation of this file.
1 // © 2023 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 #ifndef __ULOCBUILDER_H__
4 #define __ULOCBUILDER_H__
5
6 #include "unicode/localpointer.h"
7 #include "unicode/ulocale.h"
8 #include "unicode/utypes.h"
9
15 #ifndef U_HIDE_DRAFT_API
16
21 struct ULocaleBuilder;
22
27 typedef struct ULocaleBuilder ULocaleBuilder;
28
76 U_CAPI ULocaleBuilder* U_EXPORT2
77 ulocbld_open();
78
84 U_CAPI void U_EXPORT2
85 ulocbld_close(ULocaleBuilder* builder);
86
102 U_CAPI void U_EXPORT2
103 ulocbld_setLocale(ULocaleBuilder* builder, const char* locale, int32_t length);
104
118 U_CAPI void U_EXPORT2
119 ulocbld_adoptULocale(ULocaleBuilder* builder, ULocale* locale);
120
141 U_CAPI void U_EXPORT2
142 ulocbld_setLanguageTag(ULocaleBuilder* builder, const char* tag, int32_t length);
143
161 U_CAPI void U_EXPORT2
162 ulocbld_setLanguage(ULocaleBuilder* builder, const char* language, int32_t length);
163
182 U_CAPI void U_EXPORT2
183 ulocbld_setScript(ULocaleBuilder* builder, const char* script, int32_t length);
184
206 U_CAPI void U_EXPORT2
207 ulocbld_setRegion(ULocaleBuilder* builder, const char* region, int32_t length);
208
232 U_CAPI void U_EXPORT2
233 ulocbld_setVariant(ULocaleBuilder* builder, const char* variant, int32_t length);
234
258 U_CAPI void U_EXPORT2
259 ulocbld_setExtension(ULocaleBuilder* builder, char key, const char* value, int32_t length);
260
287 U_CAPI void U_EXPORT2
288 ulocbld_setUnicodeLocaleKeyword(ULocaleBuilder* builder,
289 const char* key, int32_t keyLength, const char* type, int32_t typeLength);
290
304 U_CAPI void U_EXPORT2
305 ulocbld_addUnicodeLocaleAttribute(
306 ULocaleBuilder* builder, const char* attribute, int32_t length);
307
323 U_CAPI void U_EXPORT2
324 ulocbld_removeUnicodeLocaleAttribute(
325 ULocaleBuilder* builder, const char* attribute, int32_t length);
326
334 U_CAPI void U_EXPORT2
335 ulocbld_clear(ULocaleBuilder* builder);
336
344 U_CAPI void U_EXPORT2
345 ulocbld_clearExtensions(ULocaleBuilder* builder);
346
363 U_CAPI int32_t U_EXPORT2
364 ulocbld_buildLocaleID(ULocaleBuilder* builder, char* locale,
365 int32_t localeCapacity, UErrorCode* err);
366
382 U_CAPI ULocale* U_EXPORT2
383 ulocbld_buildULocale(ULocaleBuilder* builder, UErrorCode* err);
384
402 U_CAPI int32_t U_EXPORT2
403 ulocbld_buildLanguageTag(ULocaleBuilder* builder, char* language,
404 int32_t languageCapacity, UErrorCode* err);
405
417 U_CAPI UBool U_EXPORT2
418 ulocbld_copyErrorTo(const ULocaleBuilder* builder, UErrorCode *outErrorCode);
419
420 #if U_SHOW_CPLUSPLUS_API
421
422 U_NAMESPACE_BEGIN
423
433 U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleBuilderPointer, ULocaleBuilder, ulocbld_close);
434
435 U_NAMESPACE_END
436
437 #endif /* U_SHOW_CPLUSPLUS_API */
438
439 #endif /* U_HIDE_DRAFT_API */
440
441 #endif // __ULOCBUILDER_H__
LocalULocaleBuilderPointer
"Smart pointer" class, closes a ULocaleBuilder via ulocbld_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
ulocale.h
C API: Locale ID functionality similar to C++ class Locale.
ULocale
struct ULocale ULocale
C typedef for struct ULocale.
Definition: ulocale.h:27
ulocbld_setRegion
U_CAPI void ulocbld_setRegion(ULocaleBuilder *builder, const char *region, int32_t length)
Sets the region.
ulocbld_open
U_CAPI ULocaleBuilder * ulocbld_open()
ULocaleBuilder is used to build valid locale id string or IETF BCP 47 language tag from values config...
ulocbld_adoptULocale
U_CAPI void ulocbld_adoptULocale(ULocaleBuilder *builder, ULocale *locale)
Resets the ULocaleBuilder to match the provided ULocale.
ulocbld_setVariant
U_CAPI void ulocbld_setVariant(ULocaleBuilder *builder, const char *variant, int32_t length)
Sets the variant.
ulocbld_removeUnicodeLocaleAttribute
U_CAPI void ulocbld_removeUnicodeLocaleAttribute(ULocaleBuilder *builder, const char *attribute, int32_t length)
Removes a unicode locale attribute, if present, otherwise has no effect.
ulocbld_setExtension
U_CAPI void ulocbld_setExtension(ULocaleBuilder *builder, char key, const char *value, int32_t length)
Sets the extension for the given key.
ulocbld_copyErrorTo
U_CAPI UBool ulocbld_copyErrorTo(const ULocaleBuilder *builder, UErrorCode *outErrorCode)
Sets the UErrorCode if an error occurred while recording sets.
ULocaleBuilder
struct ULocaleBuilder ULocaleBuilder
C typedef for struct ULocaleBuilder.
Definition: ulocbuilder.h:27
ulocbld_setScript
U_CAPI void ulocbld_setScript(ULocaleBuilder *builder, const char *script, int32_t length)
Sets the script.
ulocbld_buildULocale
U_CAPI ULocale * ulocbld_buildULocale(ULocaleBuilder *builder, UErrorCode *err)
Build the ULocale object from the fields set on this builder.
ulocbld_setLocale
U_CAPI void ulocbld_setLocale(ULocaleBuilder *builder, const char *locale, int32_t length)
Resets the ULocaleBuilder to match the provided locale.
ulocbld_clear
U_CAPI void ulocbld_clear(ULocaleBuilder *builder)
Resets the builder to its initial, empty state.
ulocbld_setLanguageTag
U_CAPI void ulocbld_setLanguageTag(ULocaleBuilder *builder, const char *tag, int32_t length)
Resets the ULocaleBuilder to match the provided IETF BCP 47 language tag.
ulocbld_setUnicodeLocaleKeyword
U_CAPI void ulocbld_setUnicodeLocaleKeyword(ULocaleBuilder *builder, const char *key, int32_t keyLength, const char *type, int32_t typeLength)
Sets the Unicode locale keyword type for the given key.
ulocbld_addUnicodeLocaleAttribute
U_CAPI void ulocbld_addUnicodeLocaleAttribute(ULocaleBuilder *builder, const char *attribute, int32_t length)
Adds a unicode locale attribute, if not already present, otherwise has no effect.
ulocbld_buildLocaleID
U_CAPI int32_t ulocbld_buildLocaleID(ULocaleBuilder *builder, char *locale, int32_t localeCapacity, UErrorCode *err)
Build the LocaleID string from the fields set on this builder.
ulocbld_close
U_CAPI void ulocbld_close(ULocaleBuilder *builder)
Close the builder and destroy it's internal states.
ulocbld_buildLanguageTag
U_CAPI int32_t ulocbld_buildLanguageTag(ULocaleBuilder *builder, char *language, int32_t languageCapacity, UErrorCode *err)
Build the IETF BCP 47 language tag string from the fields set on this builder.
ulocbld_setLanguage
U_CAPI void ulocbld_setLanguage(ULocaleBuilder *builder, const char *language, int32_t length)
Sets the language.
ulocbld_clearExtensions
U_CAPI void ulocbld_clearExtensions(ULocaleBuilder *builder)
Resets the extensions to their initial, empty state.
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
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