initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
96
thirdparty/icu4c/common/servrbf.cpp
vendored
Normal file
96
thirdparty/icu4c/common/servrbf.cpp
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2014, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if !UCONFIG_NO_SERVICE
|
||||
|
||||
#include "unicode/resbund.h"
|
||||
#include "uresimp.h"
|
||||
#include "cmemory.h"
|
||||
#include "servloc.h"
|
||||
#include "ustrfmt.h"
|
||||
#include "uhash.h"
|
||||
#include "charstr.h"
|
||||
#include "ucln_cmn.h"
|
||||
#include "uassert.h"
|
||||
|
||||
#define UNDERSCORE_CHAR ((char16_t)0x005f)
|
||||
#define AT_SIGN_CHAR ((char16_t)64)
|
||||
#define PERIOD_CHAR ((char16_t)46)
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
ICUResourceBundleFactory::ICUResourceBundleFactory()
|
||||
: LocaleKeyFactory(VISIBLE)
|
||||
, _bundleName()
|
||||
{
|
||||
}
|
||||
|
||||
ICUResourceBundleFactory::ICUResourceBundleFactory(const UnicodeString& bundleName)
|
||||
: LocaleKeyFactory(VISIBLE)
|
||||
, _bundleName(bundleName)
|
||||
{
|
||||
}
|
||||
|
||||
ICUResourceBundleFactory::~ICUResourceBundleFactory() {}
|
||||
|
||||
const Hashtable*
|
||||
ICUResourceBundleFactory::getSupportedIDs(UErrorCode& status) const
|
||||
{
|
||||
if (U_SUCCESS(status)) {
|
||||
return LocaleUtility::getAvailableLocaleNames(_bundleName);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UObject*
|
||||
ICUResourceBundleFactory::handleCreate(const Locale& loc, int32_t /* kind */, const ICUService* /* service */, UErrorCode& status) const
|
||||
{
|
||||
if (U_SUCCESS(status)) {
|
||||
// _bundleName is a package name
|
||||
// and should only contain invariant characters
|
||||
// ??? is it always true that the max length of the bundle name is 19?
|
||||
// who made this change? -- dlf
|
||||
char pkg[20];
|
||||
int32_t length;
|
||||
length = _bundleName.extract(0, INT32_MAX, pkg, static_cast<int32_t>(sizeof(pkg)), US_INV);
|
||||
if (length >= static_cast<int32_t>(sizeof(pkg))) {
|
||||
return nullptr;
|
||||
}
|
||||
return new ResourceBundle(pkg, loc, status);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef SERVICE_DEBUG
|
||||
UnicodeString&
|
||||
ICUResourceBundleFactory::debug(UnicodeString& result) const
|
||||
{
|
||||
LocaleKeyFactory::debug(result);
|
||||
result.append((UnicodeString)", bundle: ");
|
||||
return result.append(_bundleName);
|
||||
}
|
||||
|
||||
UnicodeString&
|
||||
ICUResourceBundleFactory::debugClass(UnicodeString& result) const
|
||||
{
|
||||
return result.append((UnicodeString)"ICUResourceBundleFactory");
|
||||
}
|
||||
#endif
|
||||
|
||||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUResourceBundleFactory)
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
/* !UCONFIG_NO_SERVICE */
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user