mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
ICU4C: Update to version 74.1
This commit is contained in:
parent
6afd320984
commit
5e55c6c611
65 changed files with 8399 additions and 6799 deletions
51
thirdparty/icu4c/common/rbbi.cpp
vendored
51
thirdparty/icu4c/common/rbbi.cpp
vendored
|
|
@ -1125,6 +1125,7 @@ static icu::UStack *gLanguageBreakFactories = nullptr;
|
|||
static const icu::UnicodeString *gEmptyString = nullptr;
|
||||
static icu::UInitOnce gLanguageBreakFactoriesInitOnce {};
|
||||
static icu::UInitOnce gRBBIInitOnce {};
|
||||
static icu::ICULanguageBreakFactory *gICULanguageBreakFactory = nullptr;
|
||||
|
||||
/**
|
||||
* Release all static memory held by breakiterator.
|
||||
|
|
@ -1153,37 +1154,41 @@ static void U_CALLCONV rbbiInit() {
|
|||
ucln_common_registerCleanup(UCLN_COMMON_RBBI, rbbi_cleanup);
|
||||
}
|
||||
|
||||
static void U_CALLCONV initLanguageFactories() {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
static void U_CALLCONV initLanguageFactories(UErrorCode& status) {
|
||||
U_ASSERT(gLanguageBreakFactories == nullptr);
|
||||
gLanguageBreakFactories = new UStack(_deleteFactory, nullptr, status);
|
||||
if (gLanguageBreakFactories != nullptr && U_SUCCESS(status)) {
|
||||
ICULanguageBreakFactory *builtIn = new ICULanguageBreakFactory(status);
|
||||
gLanguageBreakFactories->push(builtIn, status);
|
||||
LocalPointer<ICULanguageBreakFactory> factory(new ICULanguageBreakFactory(status), status);
|
||||
if (U_SUCCESS(status)) {
|
||||
gICULanguageBreakFactory = factory.orphan();
|
||||
gLanguageBreakFactories->push(gICULanguageBreakFactory, status);
|
||||
#ifdef U_LOCAL_SERVICE_HOOK
|
||||
LanguageBreakFactory *extra = (LanguageBreakFactory *)uprv_svc_hook("languageBreakFactory", &status);
|
||||
if (extra != nullptr) {
|
||||
gLanguageBreakFactories->push(extra, status);
|
||||
}
|
||||
LanguageBreakFactory *extra = (LanguageBreakFactory *)uprv_svc_hook("languageBreakFactory", &status);
|
||||
if (extra != nullptr) {
|
||||
gLanguageBreakFactories->push(extra, status);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
ucln_common_registerCleanup(UCLN_COMMON_RBBI, rbbi_cleanup);
|
||||
}
|
||||
|
||||
void ensureLanguageFactories(UErrorCode& status) {
|
||||
umtx_initOnce(gLanguageBreakFactoriesInitOnce, &initLanguageFactories, status);
|
||||
}
|
||||
|
||||
static const LanguageBreakEngine*
|
||||
getLanguageBreakEngineFromFactory(UChar32 c)
|
||||
getLanguageBreakEngineFromFactory(UChar32 c, const char* locale)
|
||||
{
|
||||
umtx_initOnce(gLanguageBreakFactoriesInitOnce, &initLanguageFactories);
|
||||
if (gLanguageBreakFactories == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
ensureLanguageFactories(status);
|
||||
if (U_FAILURE(status)) return nullptr;
|
||||
|
||||
int32_t i = gLanguageBreakFactories->size();
|
||||
const LanguageBreakEngine *lbe = nullptr;
|
||||
while (--i >= 0) {
|
||||
LanguageBreakFactory *factory = (LanguageBreakFactory *)(gLanguageBreakFactories->elementAt(i));
|
||||
lbe = factory->getEngineFor(c);
|
||||
lbe = factory->getEngineFor(c, locale);
|
||||
if (lbe != nullptr) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -1199,7 +1204,7 @@ getLanguageBreakEngineFromFactory(UChar32 c)
|
|||
//
|
||||
//-------------------------------------------------------------------------------
|
||||
const LanguageBreakEngine *
|
||||
RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
|
||||
RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c, const char* locale) {
|
||||
const LanguageBreakEngine *lbe = nullptr;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
|
@ -1215,14 +1220,14 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
|
|||
int32_t i = fLanguageBreakEngines->size();
|
||||
while (--i >= 0) {
|
||||
lbe = (const LanguageBreakEngine *)(fLanguageBreakEngines->elementAt(i));
|
||||
if (lbe->handles(c)) {
|
||||
if (lbe->handles(c, locale)) {
|
||||
return lbe;
|
||||
}
|
||||
}
|
||||
|
||||
// No existing dictionary took the character. See if a factory wants to
|
||||
// give us a new LanguageBreakEngine for this character.
|
||||
lbe = getLanguageBreakEngineFromFactory(c);
|
||||
lbe = getLanguageBreakEngineFromFactory(c, locale);
|
||||
|
||||
// If we got one, use it and push it on our stack.
|
||||
if (lbe != nullptr) {
|
||||
|
|
@ -1259,6 +1264,18 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
|
|||
return fUnhandledBreakEngine;
|
||||
}
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
void U_EXPORT2 RuleBasedBreakIterator::registerExternalBreakEngine(
|
||||
ExternalBreakEngine* toAdopt, UErrorCode& status) {
|
||||
LocalPointer<ExternalBreakEngine> engine(toAdopt, status);
|
||||
if (U_FAILURE(status)) return;
|
||||
ensureLanguageFactories(status);
|
||||
if (U_FAILURE(status)) return;
|
||||
gICULanguageBreakFactory->addExternalEngine(engine.orphan(), status);
|
||||
}
|
||||
#endif /* U_HIDE_DRAFT_API */
|
||||
|
||||
|
||||
void RuleBasedBreakIterator::dumpCache() {
|
||||
fBreakCache->dumpCache();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue