diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-05-14 11:41:19 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-05-14 12:38:52 +0300 |
commit | e74fea2864db7f8300da2a0569343b51666ecf4c (patch) | |
tree | 840169dd389ac4918f6be6f3906729a9052c9fcb /thirdparty/icu4c/common/ulocimp.h | |
parent | 557f63d03796db78255f055b6d06cb5f9195ff7e (diff) | |
download | redot-engine-e74fea2864db7f8300da2a0569343b51666ecf4c.tar.gz |
Update ICU to 75.1
Diffstat (limited to 'thirdparty/icu4c/common/ulocimp.h')
-rw-r--r-- | thirdparty/icu4c/common/ulocimp.h | 247 |
1 files changed, 172 insertions, 75 deletions
diff --git a/thirdparty/icu4c/common/ulocimp.h b/thirdparty/icu4c/common/ulocimp.h index efa0fa72e6..7fb6406288 100644 --- a/thirdparty/icu4c/common/ulocimp.h +++ b/thirdparty/icu4c/common/ulocimp.h @@ -10,6 +10,8 @@ #ifndef ULOCIMP_H #define ULOCIMP_H +#include <cstddef> + #include "unicode/bytestream.h" #include "unicode/uloc.h" @@ -40,8 +42,10 @@ uloc_getTableStringWithFallback( int32_t *pLength, UErrorCode *pErrorCode); +namespace { /*returns true if a is an ID separator false otherwise*/ -#define _isIDSeparator(a) (a == '_' || a == '-') +inline bool _isIDSeparator(char a) { return a == '_' || a == '-'; } +} // namespace U_CFUNC const char* uloc_getCurrentCountryID(const char* oldID); @@ -49,53 +53,134 @@ uloc_getCurrentCountryID(const char* oldID); U_CFUNC const char* uloc_getCurrentLanguageID(const char* oldID); -U_CFUNC void -ulocimp_getKeywords(const char *localeID, - char prev, - icu::ByteSink& sink, - UBool valuesToo, - UErrorCode *status); - -icu::CharString U_EXPORT2 -ulocimp_getLanguage(const char *localeID, - const char **pEnd, - UErrorCode &status); - -icu::CharString U_EXPORT2 -ulocimp_getScript(const char *localeID, - const char **pEnd, - UErrorCode &status); - -icu::CharString U_EXPORT2 -ulocimp_getCountry(const char *localeID, - const char **pEnd, - UErrorCode &status); - -U_CAPI void U_EXPORT2 +U_EXPORT icu::CharString +ulocimp_getKeywords(const char* localeID, + char prev, + bool valuesToo, + UErrorCode& status); + +U_EXPORT void +ulocimp_getKeywords(const char* localeID, + char prev, + icu::ByteSink& sink, + bool valuesToo, + UErrorCode& status); + +U_EXPORT icu::CharString +ulocimp_getName(const char* localeID, + UErrorCode& err); + +U_EXPORT void ulocimp_getName(const char* localeID, icu::ByteSink& sink, - UErrorCode* err); + UErrorCode& err); + +U_EXPORT icu::CharString +ulocimp_getBaseName(const char* localeID, + UErrorCode& err); -U_CAPI void U_EXPORT2 +U_EXPORT void ulocimp_getBaseName(const char* localeID, icu::ByteSink& sink, - UErrorCode* err); + UErrorCode& err); + +U_EXPORT icu::CharString +ulocimp_canonicalize(const char* localeID, + UErrorCode& err); -U_CAPI void U_EXPORT2 +U_EXPORT void ulocimp_canonicalize(const char* localeID, icu::ByteSink& sink, - UErrorCode* err); + UErrorCode& err); -U_CAPI void U_EXPORT2 +U_EXPORT icu::CharString +ulocimp_getKeywordValue(const char* localeID, + const char* keywordName, + UErrorCode& status); + +U_EXPORT void ulocimp_getKeywordValue(const char* localeID, const char* keywordName, icu::ByteSink& sink, - UErrorCode* status); + UErrorCode& status); + +U_EXPORT icu::CharString +ulocimp_getLanguage(const char* localeID, UErrorCode& status); + +U_EXPORT icu::CharString +ulocimp_getScript(const char* localeID, UErrorCode& status); + +U_EXPORT icu::CharString +ulocimp_getRegion(const char* localeID, UErrorCode& status); + +U_EXPORT icu::CharString +ulocimp_getVariant(const char* localeID, UErrorCode& status); + +U_EXPORT void +ulocimp_setKeywordValue(const char* keywordName, + const char* keywordValue, + icu::CharString& localeID, + UErrorCode& status); -U_CAPI void U_EXPORT2 +U_EXPORT int32_t +ulocimp_setKeywordValue(const char* keywords, + const char* keywordName, + const char* keywordValue, + icu::ByteSink& sink, + UErrorCode& status); + +U_EXPORT void +ulocimp_getSubtags( + const char* localeID, + icu::CharString* language, + icu::CharString* script, + icu::CharString* region, + icu::CharString* variant, + const char** pEnd, + UErrorCode& status); + +U_EXPORT void +ulocimp_getSubtags( + const char* localeID, + icu::ByteSink* language, + icu::ByteSink* script, + icu::ByteSink* region, + icu::ByteSink* variant, + const char** pEnd, + UErrorCode& status); + +inline void +ulocimp_getSubtags( + const char* localeID, + std::nullptr_t, + std::nullptr_t, + std::nullptr_t, + std::nullptr_t, + const char** pEnd, + UErrorCode& status) { + ulocimp_getSubtags( + localeID, + static_cast<icu::ByteSink*>(nullptr), + static_cast<icu::ByteSink*>(nullptr), + static_cast<icu::ByteSink*>(nullptr), + static_cast<icu::ByteSink*>(nullptr), + pEnd, + status); +} + +U_EXPORT icu::CharString +ulocimp_getParent(const char* localeID, + UErrorCode& err); + +U_EXPORT void ulocimp_getParent(const char* localeID, icu::ByteSink& sink, - UErrorCode* err); + UErrorCode& err); + +U_EXPORT icu::CharString +ulocimp_toLanguageTag(const char* localeID, + bool strict, + UErrorCode& status); /** * Writes a well-formed language tag for this locale ID. @@ -116,11 +201,17 @@ ulocimp_getParent(const char* localeID, * * @internal ICU 64 */ -U_CAPI void U_EXPORT2 +U_EXPORT void ulocimp_toLanguageTag(const char* localeID, icu::ByteSink& sink, - UBool strict, - UErrorCode* err); + bool strict, + UErrorCode& err); + +U_EXPORT icu::CharString +ulocimp_forLanguageTag(const char* langtag, + int32_t tagLen, + int32_t* parsedLength, + UErrorCode& status); /** * Returns a locale ID for the specified BCP47 language tag string. @@ -148,12 +239,12 @@ ulocimp_toLanguageTag(const char* localeID, * failed. * @internal ICU 63 */ -U_CAPI void U_EXPORT2 +U_EXPORT void ulocimp_forLanguageTag(const char* langtag, int32_t tagLen, icu::ByteSink& sink, int32_t* parsedLength, - UErrorCode* err); + UErrorCode& err); /** * Get the region to use for supplemental data lookup. Uses @@ -161,28 +252,27 @@ ulocimp_forLanguageTag(const char* langtag, * (2) any unicode_region_tag in the locale ID; if none then * (3) if inferRegion is true, the region suggested by * getLikelySubtags on the localeID. - * If no region is found, returns length 0. - * + * If no region is found, returns an empty string. + * * @param localeID * The complete locale ID (with keywords) from which * to get the region to use for supplemental data. * @param inferRegion * If true, will try to infer region from localeID if * no other region is found. - * @param region - * Buffer in which to put the region ID found; should - * have a capacity at least ULOC_COUNTRY_CAPACITY. - * @param regionCapacity - * The actual capacity of the region buffer. * @param status * Pointer to in/out UErrorCode value for latest status. * @return - * The length of any region code found, or 0 if none. + * The region code found, empty if none found. * @internal ICU 57 */ -U_CAPI int32_t U_EXPORT2 -ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion, - char *region, int32_t regionCapacity, UErrorCode* status); +U_EXPORT icu::CharString +ulocimp_getRegionForSupplementalData(const char *localeID, bool inferRegion, + UErrorCode& status); + +U_EXPORT icu::CharString +ulocimp_addLikelySubtags(const char* localeID, + UErrorCode& status); /** * Add the likely subtags for a provided locale ID, per the algorithm described @@ -213,10 +303,15 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion, * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. * @internal ICU 64 */ -U_CAPI void U_EXPORT2 +U_EXPORT void ulocimp_addLikelySubtags(const char* localeID, icu::ByteSink& sink, - UErrorCode* err); + UErrorCode& err); + +U_EXPORT icu::CharString +ulocimp_minimizeSubtags(const char* localeID, + bool favorScript, + UErrorCode& status); /** * Minimize the subtags for a provided locale ID, per the algorithm described @@ -248,70 +343,72 @@ ulocimp_addLikelySubtags(const char* localeID, * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. * @internal ICU 64 */ -U_CAPI void U_EXPORT2 +U_EXPORT void ulocimp_minimizeSubtags(const char* localeID, icu::ByteSink& sink, bool favorScript, - UErrorCode* err); + UErrorCode& err); U_CAPI const char * U_EXPORT2 locale_getKeywordsStart(const char *localeID); -U_CFUNC UBool +bool ultag_isExtensionSubtags(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isLanguageSubtag(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isPrivateuseValueSubtags(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isRegionSubtag(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isScriptSubtag(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isTransformedExtensionSubtags(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isUnicodeExtensionSubtags(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isUnicodeLocaleAttribute(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isUnicodeLocaleAttributes(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isUnicodeLocaleKey(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isUnicodeLocaleType(const char* s, int32_t len); -U_CFUNC UBool +bool ultag_isVariantSubtags(const char* s, int32_t len); -U_CAPI const char * U_EXPORT2 -ultag_getTKeyStart(const char *localeID); +const char* +ultag_getTKeyStart(const char* localeID); -U_CFUNC const char* +U_EXPORT const char* ulocimp_toBcpKey(const char* key); -U_CFUNC const char* +U_EXPORT const char* ulocimp_toLegacyKey(const char* key); -U_CFUNC const char* -ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType); +U_EXPORT const char* +ulocimp_toBcpType(const char* key, const char* type, bool* isKnownKey, bool* isSpecialType); -U_CFUNC const char* -ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType); +U_EXPORT const char* +ulocimp_toLegacyType(const char* key, const char* type, bool* isKnownKey, bool* isSpecialType); /* Function for testing purpose */ -U_CAPI const char* const* ulocimp_getKnownCanonicalizedLocaleForTest(int32_t* length); +U_EXPORT const char* const* +ulocimp_getKnownCanonicalizedLocaleForTest(int32_t& length); // Return true if the value is already canonicalized. -U_CAPI bool ulocimp_isCanonicalizedLocaleForTest(const char* localeName); +U_EXPORT bool +ulocimp_isCanonicalizedLocaleForTest(const char* localeName); #endif |