#include "unicode/bytestream.h"
#include "unicode/utypes.h"
#include "unicode/ures.h"
#include "unicode/localpointer.h"
#include "unicode/putil.h"
#include "unicode/uenum.h"
#include "unicode/uloc.h"
#include "ustr_imp.h"
#include "bytesinkutil.h"
#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
#include "putilimp.h"
#include "uinvchar.h"
#include "ulocimp.h"
#include "uassert.h"
VariantListEntry;
struct AttributeListEntry : public icu::UMemory { … };
struct ExtensionListEntry : public icu::UMemory { … };
#define MAXEXTLANG …
ULanguageTag;
#define MINLEN …
#define SEP …
#define PRIVATEUSE …
#define LDMLEXT …
#define LOCALE_SEP …
#define LOCALE_EXT_SEP …
#define LOCALE_KEYWORD_SEP …
#define LOCALE_KEY_TYPE_SEP …
#define ISALPHA(c) …
#define ISNUMERIC(c) …
static const char EMPTY[] = …;
static const char LANG_UND[] = …;
static const char PRIVATEUSE_KEY[] = …;
static const char _POSIX[] = …;
static const char POSIX_KEY[] = …;
static const char POSIX_VALUE[] = …;
static const char LOCALE_ATTRIBUTE_KEY[] = …;
static const char PRIVUSE_VARIANT_PREFIX[] = …;
static const char LOCALE_TYPE_YES[] = …;
#define LANG_UND_LEN …
static const char* const LEGACY[] = …;
static const char* const REDUNDANT[] = …;
static const char DEPRECATEDLANGS[][4] = …;
static const char DEPRECATEDREGIONS[][3] = …;
static ULanguageTag*
ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* status);
static void
ultag_close(ULanguageTag* langtag);
static const char*
ultag_getLanguage(const ULanguageTag* langtag);
#if 0
static const char*
ultag_getJDKLanguage(const ULanguageTag* langtag);
#endif
static const char*
ultag_getExtlang(const ULanguageTag* langtag, int32_t idx);
static int32_t
ultag_getExtlangSize(const ULanguageTag* langtag);
static const char*
ultag_getScript(const ULanguageTag* langtag);
static const char*
ultag_getRegion(const ULanguageTag* langtag);
static const char*
ultag_getVariant(const ULanguageTag* langtag, int32_t idx);
static int32_t
ultag_getVariantsSize(const ULanguageTag* langtag);
static const char*
ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx);
static const char*
ultag_getExtensionValue(const ULanguageTag* langtag, int32_t idx);
static int32_t
ultag_getExtensionsSize(const ULanguageTag* langtag);
static const char*
ultag_getPrivateUse(const ULanguageTag* langtag);
#if 0
static const char*
ultag_getLegacy(const ULanguageTag* langtag);
#endif
U_NAMESPACE_BEGIN
static UBool
_isAlphaString(const char* s, int32_t len) { … }
static UBool
_isNumericString(const char* s, int32_t len) { … }
static UBool
_isAlphaNumericString(const char* s, int32_t len) { … }
static UBool
_isAlphaNumericStringLimitedLength(const char* s, int32_t len, int32_t min, int32_t max) { … }
U_CFUNC UBool
ultag_isLanguageSubtag(const char* s, int32_t len) { … }
static UBool
_isExtlangSubtag(const char* s, int32_t len) { … }
U_CFUNC UBool
ultag_isScriptSubtag(const char* s, int32_t len) { … }
U_CFUNC UBool
ultag_isRegionSubtag(const char* s, int32_t len) { … }
static UBool
_isVariantSubtag(const char* s, int32_t len) { … }
static UBool
_isSepListOf(UBool (*test)(const char*, int32_t), const char* s, int32_t len) { … }
U_CFUNC UBool
ultag_isVariantSubtags(const char* s, int32_t len) { … }
static UBool
_isPrivateuseVariantSubtag(const char* s, int32_t len) { … }
static UBool
_isExtensionSingleton(const char* s, int32_t len) { … }
static UBool
_isExtensionSubtag(const char* s, int32_t len) { … }
U_CFUNC UBool
ultag_isExtensionSubtags(const char* s, int32_t len) { … }
static UBool
_isPrivateuseValueSubtag(const char* s, int32_t len) { … }
U_CFUNC UBool
ultag_isPrivateuseValueSubtags(const char* s, int32_t len) { … }
U_CFUNC UBool
ultag_isUnicodeLocaleAttribute(const char* s, int32_t len) { … }
U_CFUNC UBool
ultag_isUnicodeLocaleAttributes(const char* s, int32_t len) { … }
U_CFUNC UBool
ultag_isUnicodeLocaleKey(const char* s, int32_t len) { … }
U_CFUNC UBool
_isUnicodeLocaleTypeSubtag(const char*s, int32_t len) { … }
U_CFUNC UBool
ultag_isUnicodeLocaleType(const char*s, int32_t len) { … }
static UBool
_isTKey(const char* s, int32_t len)
{ … }
U_CAPI const char * U_EXPORT2
ultag_getTKeyStart(const char *localeID) { … }
static UBool
_isTValue(const char* s, int32_t len)
{ … }
static UBool
_isTransformedExtensionSubtag(int32_t& state, const char* s, int32_t len)
{ … }
static UBool
_isUnicodeExtensionSubtag(int32_t& state, const char* s, int32_t len)
{ … }
static UBool
_isStatefulSepListOf(UBool (*test)(int32_t&, const char*, int32_t), const char* s, int32_t len)
{ … }
U_CFUNC UBool
ultag_isTransformedExtensionSubtags(const char* s, int32_t len)
{ … }
U_CFUNC UBool
ultag_isUnicodeExtensionSubtags(const char* s, int32_t len) { … }
static UBool
_addVariantToList(VariantListEntry **first, VariantListEntry *var) { … }
static UBool
_addAttributeToList(AttributeListEntry **first, AttributeListEntry *attr) { … }
static UBool
_addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool localeToBCP) { … }
static void
_initializeULanguageTag(ULanguageTag* langtag) { … }
static void
_appendLanguageToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) { … }
static void
_appendScriptToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) { … }
static void
_appendRegionToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UErrorCode* status) { … }
static void _sortVariants(VariantListEntry* first) { … }
static void
_appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool *hadPosix, UErrorCode* status) { … }
static void
_appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool hadPosix, UErrorCode* status) { … }
static void
_appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendTo, icu::MemoryPool<ExtensionListEntry>& extPool, icu::MemoryPool<icu::CharString>& kwdBuf, UBool *posixVariant, UErrorCode *status) { … }
static void
_appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status) { … }
static void
_appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool hadPosix, UErrorCode* status) { … }
#define LANG …
#define EXTL …
#define SCRT …
#define REGN …
#define VART …
#define EXTS …
#define EXTV …
#define PRIV …
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1924)
#pragma optimize( "", off )
#endif
static ULanguageTag*
ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* status) { … }
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1924)
#pragma optimize( "", on )
#endif
static void
ultag_close(ULanguageTag* langtag) { … }
static const char*
ultag_getLanguage(const ULanguageTag* langtag) { … }
#if 0
static const char*
ultag_getJDKLanguage(const ULanguageTag* langtag) {
int32_t i;
for (i = 0; DEPRECATEDLANGS[i] != nullptr; i += 2) {
if (uprv_compareInvCharsAsAscii(DEPRECATEDLANGS[i], langtag->language) == 0) {
return DEPRECATEDLANGS[i + 1];
}
}
return langtag->language;
}
#endif
static const char*
ultag_getExtlang(const ULanguageTag* langtag, int32_t idx) { … }
static int32_t
ultag_getExtlangSize(const ULanguageTag* langtag) { … }
static const char*
ultag_getScript(const ULanguageTag* langtag) { … }
static const char*
ultag_getRegion(const ULanguageTag* langtag) { … }
static const char*
ultag_getVariant(const ULanguageTag* langtag, int32_t idx) { … }
static int32_t
ultag_getVariantsSize(const ULanguageTag* langtag) { … }
static const char*
ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx) { … }
static const char*
ultag_getExtensionValue(const ULanguageTag* langtag, int32_t idx) { … }
static int32_t
ultag_getExtensionsSize(const ULanguageTag* langtag) { … }
static const char*
ultag_getPrivateUse(const ULanguageTag* langtag) { … }
#if 0
static const char*
ultag_getLegacy(const ULanguageTag* langtag) {
return langtag->legacy;
}
#endif
U_CAPI int32_t U_EXPORT2
uloc_toLanguageTag(const char* localeID,
char* langtag,
int32_t langtagCapacity,
UBool strict,
UErrorCode* status) { … }
U_CAPI void U_EXPORT2
ulocimp_toLanguageTag(const char* localeID,
icu::ByteSink& sink,
UBool strict,
UErrorCode* status) { … }
U_CAPI int32_t U_EXPORT2
uloc_forLanguageTag(const char* langtag,
char* localeID,
int32_t localeIDCapacity,
int32_t* parsedLength,
UErrorCode* status) { … }
U_CAPI void U_EXPORT2
ulocimp_forLanguageTag(const char* langtag,
int32_t tagLen,
icu::ByteSink& sink,
int32_t* parsedLength,
UErrorCode* status) { … }