ICU-4084 Improve the Calendar instantiation.

Converters/service registration aren't needed by default anymore.

X-SVN-Rev: 16526
This commit is contained in:
George Rhoten 2004-10-17 19:46:59 +00:00
parent 07b125019f
commit 01783a7d6a

View file

@ -342,6 +342,14 @@ public:
// -------------------------------------
static inline UBool
isCalendarServiceUsed() {
Mutex mutex;
return (UBool)(gService != NULL);
}
// -------------------------------------
static ICULocaleService*
getCalendarService(UErrorCode &status)
{
@ -620,7 +628,12 @@ Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& succ
{
Locale actualLoc;
UObject* u;
#if UCONFIG_NO_SERVICE
#if !UCONFIG_NO_SERVICE
if (isCalendarServiceUsed()) {
u = getCalendarService(success)->get(aLocale, LocaleKey::KIND_ANY, &actualLoc, success);
}
else
#endif
{
char calLocaleType[ULOC_FULLNAME_CAPACITY] = {"@calendar="};
int32_t calLocaleTypeLen = uprv_strlen(calLocaleType);
@ -648,9 +661,6 @@ Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& succ
#endif
u = createStandardCalendar(calLocaleType, aLocale, success);
}
#else
u = getCalendarService(success)->get(aLocale, LocaleKey::KIND_ANY, &actualLoc, success);
#endif
Calendar* c = NULL;
if(U_FAILURE(success) || !u) {