ICU 77.1  77.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 
19 struct ULocaleBuilder;
20 
25 typedef struct ULocaleBuilder ULocaleBuilder;
26 
74 U_CAPI ULocaleBuilder* U_EXPORT2
76 
82 U_CAPI void U_EXPORT2
84 
100 U_CAPI void U_EXPORT2
101 ulocbld_setLocale(ULocaleBuilder* builder, const char* locale, int32_t length);
102 
116 U_CAPI void U_EXPORT2
118 
139 U_CAPI void U_EXPORT2
140 ulocbld_setLanguageTag(ULocaleBuilder* builder, const char* tag, int32_t length);
141 
159 U_CAPI void U_EXPORT2
160 ulocbld_setLanguage(ULocaleBuilder* builder, const char* language, int32_t length);
161 
180 U_CAPI void U_EXPORT2
181 ulocbld_setScript(ULocaleBuilder* builder, const char* script, int32_t length);
182 
204 U_CAPI void U_EXPORT2
205 ulocbld_setRegion(ULocaleBuilder* builder, const char* region, int32_t length);
206 
230 U_CAPI void U_EXPORT2
231 ulocbld_setVariant(ULocaleBuilder* builder, const char* variant, int32_t length);
232 
256 U_CAPI void U_EXPORT2
257 ulocbld_setExtension(ULocaleBuilder* builder, char key, const char* value, int32_t length);
258 
285 U_CAPI void U_EXPORT2
287  const char* key, int32_t keyLength, const char* type, int32_t typeLength);
288 
302 U_CAPI void U_EXPORT2
304  ULocaleBuilder* builder, const char* attribute, int32_t length);
305 
321 U_CAPI void U_EXPORT2
323  ULocaleBuilder* builder, const char* attribute, int32_t length);
324 
332 U_CAPI void U_EXPORT2
334 
342 U_CAPI void U_EXPORT2
344 
361 U_CAPI int32_t U_EXPORT2
362 ulocbld_buildLocaleID(ULocaleBuilder* builder, char* locale,
363  int32_t localeCapacity, UErrorCode* err);
364 
380 U_CAPI ULocale* U_EXPORT2
382 
400 U_CAPI int32_t U_EXPORT2
401 ulocbld_buildLanguageTag(ULocaleBuilder* builder, char* language,
402  int32_t languageCapacity, UErrorCode* err);
403 
415 U_CAPI UBool U_EXPORT2
416 ulocbld_copyErrorTo(const ULocaleBuilder* builder, UErrorCode *outErrorCode);
417 
418 #if U_SHOW_CPLUSPLUS_API
419 
420 U_NAMESPACE_BEGIN
421 
432 
433 U_NAMESPACE_END
434 
435 #endif /* U_SHOW_CPLUSPLUS_API */
436 
437 #endif // __ULOCBUILDER_H__
"Smart pointer" class, closes a ULocaleBuilder via ulocbld_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: Locale ID functionality similar to C++ class Locale.
struct ULocale ULocale
C typedef for struct ULocale.
Definition: ulocale.h:26
U_CAPI void ulocbld_setRegion(ULocaleBuilder *builder, const char *region, int32_t length)
Sets the region.
U_CAPI void ulocbld_adoptULocale(ULocaleBuilder *builder, ULocale *locale)
Resets the ULocaleBuilder to match the provided ULocale.
U_CAPI void ulocbld_setVariant(ULocaleBuilder *builder, const char *variant, int32_t length)
Sets the variant.
U_CAPI void ulocbld_removeUnicodeLocaleAttribute(ULocaleBuilder *builder, const char *attribute, int32_t length)
Removes a unicode locale attribute, if present, otherwise has no effect.
U_CAPI void ulocbld_setExtension(ULocaleBuilder *builder, char key, const char *value, int32_t length)
Sets the extension for the given key.
U_CAPI UBool ulocbld_copyErrorTo(const ULocaleBuilder *builder, UErrorCode *outErrorCode)
Sets the UErrorCode if an error occurred while recording sets.
struct ULocaleBuilder ULocaleBuilder
C typedef for struct ULocaleBuilder.
Definition: ulocbuilder.h:25
U_CAPI void ulocbld_setScript(ULocaleBuilder *builder, const char *script, int32_t length)
Sets the script.
U_CAPI ULocale * ulocbld_buildULocale(ULocaleBuilder *builder, UErrorCode *err)
Build the ULocale object from the fields set on this builder.
U_CAPI ULocaleBuilder * ulocbld_open(void)
ULocaleBuilder is used to build valid locale id string or IETF BCP 47 language tag from values config...
U_CAPI void ulocbld_setLocale(ULocaleBuilder *builder, const char *locale, int32_t length)
Resets the ULocaleBuilder to match the provided locale.
U_CAPI void ulocbld_clear(ULocaleBuilder *builder)
Resets the builder to its initial, empty state.
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.
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.
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.
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.
U_CAPI void ulocbld_close(ULocaleBuilder *builder)
Close the builder and destroy it's internal states.
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.
U_CAPI void ulocbld_setLanguage(ULocaleBuilder *builder, const char *language, int32_t length)
Sets the language.
U_CAPI void ulocbld_clearExtensions(ULocaleBuilder *builder)
Resets the extensions to their initial, empty state.
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:430