ICU-4741 implement multi-level fallback
X-SVN-Rev: 18486
This commit is contained in:
parent
959dd53756
commit
cebc60a530
@ -297,13 +297,13 @@ DateFormatSymbols::copyData(const DateFormatSymbols& other) {
|
|||||||
fZoneStrings = NULL;
|
fZoneStrings = NULL;
|
||||||
fZoneStringsColCount = 0;
|
fZoneStringsColCount = 0;
|
||||||
fZoneStringsRowCount = 0;
|
fZoneStringsRowCount = 0;
|
||||||
fZoneArrayBundle = NULL;
|
fResourceBundle = NULL;
|
||||||
if(other.fZoneStringsHash!=NULL){
|
if(other.fZoneStringsHash!=NULL){
|
||||||
fZoneStringsHash = createZoneStringsHash(other.fZoneStringsHash);
|
fZoneStringsHash = createZoneStringsHash(other.fZoneStringsHash);
|
||||||
fZoneIDEnumeration = other.fZoneIDEnumeration->clone();
|
fZoneIDEnumeration = other.fZoneIDEnumeration->clone();
|
||||||
}else{
|
}else{
|
||||||
UErrorCode status =U_ZERO_ERROR;
|
UErrorCode status =U_ZERO_ERROR;
|
||||||
fZoneArrayBundle = ures_clone(other.fZoneArrayBundle, &status);
|
fResourceBundle = ures_clone(other.fResourceBundle, &status);
|
||||||
// TODO: what should be done in case of error?
|
// TODO: what should be done in case of error?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +368,8 @@ void DateFormatSymbols::disposeZoneStrings()
|
|||||||
delete fZoneIDEnumeration;
|
delete fZoneIDEnumeration;
|
||||||
fZoneIDEnumeration = NULL;
|
fZoneIDEnumeration = NULL;
|
||||||
}
|
}
|
||||||
ures_close(fZoneArrayBundle);
|
ures_close(fResourceBundle);
|
||||||
fZoneArrayBundle = NULL;
|
fResourceBundle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UBool
|
UBool
|
||||||
@ -429,7 +429,7 @@ DateFormatSymbols::operator==(const DateFormatSymbols& other) const
|
|||||||
|
|
||||||
if(fZoneStringsHash == NULL || other.fZoneStringsHash == NULL){
|
if(fZoneStringsHash == NULL || other.fZoneStringsHash == NULL){
|
||||||
// fZoneStringsHash is not initialized compare the resource bundles
|
// fZoneStringsHash is not initialized compare the resource bundles
|
||||||
if(ures_equal(fZoneArrayBundle, other.fZoneArrayBundle)== FALSE){
|
if(ures_equal(fResourceBundle, other.fResourceBundle)== FALSE){
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -780,8 +780,6 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
|
|||||||
int32_t i;
|
int32_t i;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
const UChar *resStr;
|
const UChar *resStr;
|
||||||
static const UnicodeString colon((UChar)0x003a);
|
|
||||||
static const UnicodeString solidus((UChar)0x002f);
|
|
||||||
/* In case something goes wrong, initialize all of the data to NULL. */
|
/* In case something goes wrong, initialize all of the data to NULL. */
|
||||||
fEras = NULL;
|
fEras = NULL;
|
||||||
fErasCount = 0;
|
fErasCount = 0;
|
||||||
@ -818,7 +816,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
|
|||||||
fZoneStrings = NULL;
|
fZoneStrings = NULL;
|
||||||
fZoneStringsHash = NULL;
|
fZoneStringsHash = NULL;
|
||||||
fZoneIDEnumeration = NULL;
|
fZoneIDEnumeration = NULL;
|
||||||
fZoneArrayBundle = NULL;
|
fResourceBundle = NULL;
|
||||||
|
|
||||||
|
|
||||||
if (U_FAILURE(status)) return;
|
if (U_FAILURE(status)) return;
|
||||||
@ -829,7 +827,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
|
|||||||
* these.
|
* these.
|
||||||
*/
|
*/
|
||||||
CalendarData calData(locale, type, status);
|
CalendarData calData(locale, type, status);
|
||||||
UResourceBundle *nonCalendarData = ures_open((char*)0, locale.getName(), &status);
|
fResourceBundle = ures_open((char*)0, locale.getName(), &status);
|
||||||
|
|
||||||
// load the first data item
|
// load the first data item
|
||||||
UResourceBundle *erasMain = calData.getByKey(gErasTag, status);
|
UResourceBundle *erasMain = calData.getByKey(gErasTag, status);
|
||||||
@ -847,7 +845,6 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
|
|||||||
UResourceBundle *standaloneWeekdaysData = NULL; // Data closed by calData
|
UResourceBundle *standaloneWeekdaysData = NULL; // Data closed by calData
|
||||||
UResourceBundle *standaloneShortWeekdaysData = NULL; // Data closed by calData
|
UResourceBundle *standaloneShortWeekdaysData = NULL; // Data closed by calData
|
||||||
UResourceBundle *standaloneNarrowWeekdaysData = NULL; // Data closed by calData
|
UResourceBundle *standaloneNarrowWeekdaysData = NULL; // Data closed by calData
|
||||||
fZoneArrayBundle = ures_getByKey(nonCalendarData, gZoneStringsTag, NULL, &status);
|
|
||||||
|
|
||||||
U_LOCALE_BASED(locBased, *this);
|
U_LOCALE_BASED(locBased, *this);
|
||||||
if (U_FAILURE(status))
|
if (U_FAILURE(status))
|
||||||
@ -917,7 +914,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
|
|||||||
initField(&fAmPms, fAmPmsCount, calData.getByKey(gAmPmMarkersTag, status), status);
|
initField(&fAmPms, fAmPmsCount, calData.getByKey(gAmPmMarkersTag, status), status);
|
||||||
|
|
||||||
// fastCopyFrom()/setTo() - see assignArray comments
|
// fastCopyFrom()/setTo() - see assignArray comments
|
||||||
resStr = ures_getStringByKey(nonCalendarData, gLocalPatternCharsTag, &len, &status);
|
resStr = ures_getStringByKey(fResourceBundle, gLocalPatternCharsTag, &len, &status);
|
||||||
fLocalPatternChars.setTo(TRUE, resStr, len);
|
fLocalPatternChars.setTo(TRUE, resStr, len);
|
||||||
// If the locale data does not include new pattern chars, use the defaults
|
// If the locale data does not include new pattern chars, use the defaults
|
||||||
// TODO: Consider making this an error, since this may add conflicting characters.
|
// TODO: Consider making this an error, since this may add conflicting characters.
|
||||||
@ -1045,7 +1042,6 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
|
|||||||
cleanup:
|
cleanup:
|
||||||
ures_close(eras);
|
ures_close(eras);
|
||||||
ures_close(eraNames);
|
ures_close(eraNames);
|
||||||
ures_close(nonCalendarData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1197,7 +1193,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeZoneKeysEnumeration);
|
|||||||
void
|
void
|
||||||
DateFormatSymbols::initZoneStringsArray(UErrorCode& status){
|
DateFormatSymbols::initZoneStringsArray(UErrorCode& status){
|
||||||
if(fZoneStringsHash == NULL){
|
if(fZoneStringsHash == NULL){
|
||||||
initZoneStrings(fZoneArrayBundle, (const UChar *)gLastResortZoneStrings, ARRAY_LENGTH(gLastResortZoneStrings), status);
|
initZoneStrings(status);
|
||||||
}
|
}
|
||||||
if(U_FAILURE(status)){
|
if(U_FAILURE(status)){
|
||||||
return;
|
return;
|
||||||
@ -1243,26 +1239,90 @@ DateFormatSymbols::initZoneStringsArray(UErrorCode& status){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DateFormatSymbols::initZoneStrings(UResourceBundle* bundle, const UChar* lastResortStrings,
|
DateFormatSymbols::initZoneStrings(UErrorCode &status){
|
||||||
int32_t length, UErrorCode &status){
|
|
||||||
if(U_FAILURE(status)){
|
if(U_FAILURE(status)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fZoneStringsHash != NULL){
|
if(fZoneStringsHash != NULL){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int32_t i;
|
int32_t i;
|
||||||
if(bundle != NULL){
|
|
||||||
|
if(fResourceBundle != NULL){
|
||||||
static const UnicodeString solidus("/");
|
static const UnicodeString solidus("/");
|
||||||
static const UnicodeString colon(":");
|
static const UnicodeString colon(":");
|
||||||
UResourceBundle zoneItem;
|
UResourceBundle zoneArray,zoneItem;
|
||||||
ures_initStackObject(&zoneItem);
|
ures_initStackObject(&zoneItem);
|
||||||
|
ures_initStackObject(&zoneArray);
|
||||||
fZoneStringsHash = new Hashtable(status);
|
fZoneStringsHash = new Hashtable(status);
|
||||||
if(fZoneStringsHash==NULL){
|
if(fZoneStringsHash==NULL){
|
||||||
status = U_MEMORY_ALLOCATION_ERROR;
|
status = U_MEMORY_ALLOCATION_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TimeZoneKeysEnumeration* keysEnum = new TimeZoneKeysEnumeration(ures_getSize(bundle),status);
|
for(const UResourceBundle* rb = fResourceBundle; rb!=NULL; rb=ures_getParentBundle(rb)){
|
||||||
|
ures_getByKey(rb, gZoneStringsTag, &zoneArray, &status);
|
||||||
|
if(U_FAILURE(status)){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while(ures_hasNext(&zoneArray)){
|
||||||
|
UErrorCode tempStatus = U_ZERO_ERROR;
|
||||||
|
UnicodeString* array = newUnicodeStringArray(UTZ_MAX_DISPLAY_STRINGS_LENGTH);
|
||||||
|
ures_getNextResource(&zoneArray, &zoneItem, &status);
|
||||||
|
UnicodeString key(ures_getKey(&zoneItem));
|
||||||
|
key.findAndReplace(colon, solidus);
|
||||||
|
int32_t len = 0;
|
||||||
|
//fetch the strings with fine grained fallback
|
||||||
|
const UChar* str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_STANDARD, &len, &tempStatus);
|
||||||
|
if(U_SUCCESS(tempStatus)){
|
||||||
|
array[TIMEZONE_SHORT_STANDARD].setTo(str, len);
|
||||||
|
}else{
|
||||||
|
tempStatus = U_ZERO_ERROR;
|
||||||
|
}
|
||||||
|
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_GENERIC, &len, &tempStatus);
|
||||||
|
if(U_SUCCESS(tempStatus)){
|
||||||
|
array[TIMEZONE_SHORT_GENERIC].setTo(str, len);
|
||||||
|
}else{
|
||||||
|
tempStatus = U_ZERO_ERROR;
|
||||||
|
}
|
||||||
|
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_DAYLIGHT, &len, &tempStatus);
|
||||||
|
if(U_SUCCESS(tempStatus)){
|
||||||
|
array[TIMEZONE_SHORT_DAYLIGHT].setTo(str, len);
|
||||||
|
}else{
|
||||||
|
tempStatus = U_ZERO_ERROR;
|
||||||
|
}
|
||||||
|
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_STANDARD, &len, &tempStatus);
|
||||||
|
if(U_SUCCESS(tempStatus)){
|
||||||
|
array[TIMEZONE_LONG_STANDARD].setTo(str, len);
|
||||||
|
}else{
|
||||||
|
tempStatus = U_ZERO_ERROR;
|
||||||
|
}
|
||||||
|
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_GENERIC, &len, &tempStatus);
|
||||||
|
if(U_SUCCESS(tempStatus)){
|
||||||
|
array[TIMEZONE_LONG_GENERIC].setTo(str, len);
|
||||||
|
}else{
|
||||||
|
tempStatus = U_ZERO_ERROR;
|
||||||
|
}
|
||||||
|
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_DAYLIGHT, &len, &tempStatus);
|
||||||
|
if(U_SUCCESS(tempStatus)){
|
||||||
|
array[TIMEZONE_LONG_DAYLIGHT].setTo(str, len);
|
||||||
|
}else{
|
||||||
|
tempStatus = U_ZERO_ERROR;
|
||||||
|
}
|
||||||
|
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_EXEMPLAR_CITY, &len, &tempStatus);
|
||||||
|
if(U_SUCCESS(tempStatus)){
|
||||||
|
array[TIMEZONE_EXEMPLAR_CITY].setTo(str, len);
|
||||||
|
}else{
|
||||||
|
tempStatus = U_ZERO_ERROR;
|
||||||
|
}
|
||||||
|
// store the strings in hash
|
||||||
|
fZoneStringsHash->put(key, array, status);
|
||||||
|
}
|
||||||
|
ures_close(&zoneItem);
|
||||||
|
ures_close(&zoneArray);
|
||||||
|
}
|
||||||
|
int32_t length = fZoneStringsHash->count();
|
||||||
|
TimeZoneKeysEnumeration* keysEnum = new TimeZoneKeysEnumeration(length, status);
|
||||||
fZoneIDEnumeration = keysEnum;
|
fZoneIDEnumeration = keysEnum;
|
||||||
if(fZoneIDEnumeration==NULL){
|
if(fZoneIDEnumeration==NULL){
|
||||||
delete fZoneStringsHash;
|
delete fZoneStringsHash;
|
||||||
@ -1270,61 +1330,14 @@ DateFormatSymbols::initZoneStrings(UResourceBundle* bundle, const UChar* lastRes
|
|||||||
status = U_MEMORY_ALLOCATION_ERROR;
|
status = U_MEMORY_ALLOCATION_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while(ures_hasNext(bundle)){
|
int32_t pos=-1;
|
||||||
UErrorCode tempStatus = U_ZERO_ERROR;
|
const UnicodeString* key;
|
||||||
UnicodeString* array = newUnicodeStringArray(UTZ_MAX_DISPLAY_STRINGS_LENGTH);
|
const UHashElement* elem = NULL;
|
||||||
ures_getNextResource(bundle, &zoneItem, &status);
|
while((elem = fZoneStringsHash->nextElement(pos))!= NULL){
|
||||||
UnicodeString key(ures_getKey(&zoneItem));
|
const UHashTok keyTok = elem->key;
|
||||||
key.findAndReplace(colon, solidus);
|
key = (const UnicodeString*)keyTok.pointer;
|
||||||
keysEnum->put(key, status);
|
keysEnum->put(*key, status);
|
||||||
int32_t len = 0;
|
|
||||||
//fetch the strings with fine grained fallback
|
|
||||||
const UChar* str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_STANDARD, &len, &tempStatus);
|
|
||||||
if(U_SUCCESS(tempStatus)){
|
|
||||||
array[TIMEZONE_SHORT_STANDARD].setTo(str, len);
|
|
||||||
}else{
|
|
||||||
tempStatus = U_ZERO_ERROR;
|
|
||||||
}
|
|
||||||
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_GENERIC, &len, &tempStatus);
|
|
||||||
if(U_SUCCESS(tempStatus)){
|
|
||||||
array[TIMEZONE_SHORT_GENERIC].setTo(str, len);
|
|
||||||
}else{
|
|
||||||
tempStatus = U_ZERO_ERROR;
|
|
||||||
}
|
|
||||||
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_SHORT_DAYLIGHT, &len, &tempStatus);
|
|
||||||
if(U_SUCCESS(tempStatus)){
|
|
||||||
array[TIMEZONE_SHORT_DAYLIGHT].setTo(str, len);
|
|
||||||
}else{
|
|
||||||
tempStatus = U_ZERO_ERROR;
|
|
||||||
}
|
|
||||||
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_STANDARD, &len, &tempStatus);
|
|
||||||
if(U_SUCCESS(tempStatus)){
|
|
||||||
array[TIMEZONE_LONG_STANDARD].setTo(str, len);
|
|
||||||
}else{
|
|
||||||
tempStatus = U_ZERO_ERROR;
|
|
||||||
}
|
|
||||||
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_GENERIC, &len, &tempStatus);
|
|
||||||
if(U_SUCCESS(tempStatus)){
|
|
||||||
array[TIMEZONE_LONG_GENERIC].setTo(str, len);
|
|
||||||
}else{
|
|
||||||
tempStatus = U_ZERO_ERROR;
|
|
||||||
}
|
|
||||||
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_LONG_DAYLIGHT, &len, &tempStatus);
|
|
||||||
if(U_SUCCESS(tempStatus)){
|
|
||||||
array[TIMEZONE_LONG_DAYLIGHT].setTo(str, len);
|
|
||||||
}else{
|
|
||||||
tempStatus = U_ZERO_ERROR;
|
|
||||||
}
|
|
||||||
str = ures_getStringByKeyWithFallback(&zoneItem,UTZ_EXEMPLAR_CITY, &len, &tempStatus);
|
|
||||||
if(U_SUCCESS(tempStatus)){
|
|
||||||
array[TIMEZONE_EXEMPLAR_CITY].setTo(str, len);
|
|
||||||
}else{
|
|
||||||
tempStatus = U_ZERO_ERROR;
|
|
||||||
}
|
|
||||||
// store the strings in hash
|
|
||||||
fZoneStringsHash->put(key, array, status);
|
|
||||||
}
|
}
|
||||||
ures_close(&zoneItem);
|
|
||||||
}else{
|
}else{
|
||||||
//last resort strings
|
//last resort strings
|
||||||
fZoneStringsHash = new Hashtable(status);
|
fZoneStringsHash = new Hashtable(status);
|
||||||
@ -1338,9 +1351,9 @@ DateFormatSymbols::initZoneStrings(UResourceBundle* bundle, const UChar* lastRes
|
|||||||
status = U_MEMORY_ALLOCATION_ERROR;
|
status = U_MEMORY_ALLOCATION_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int32_t length = ARRAY_LENGTH(gLastResortZoneStrings);
|
||||||
UnicodeString key(lastResortStrings[0]);
|
UnicodeString key(gLastResortZoneStrings[0]);
|
||||||
TimeZoneKeysEnumeration* keysEnum = new TimeZoneKeysEnumeration(ures_getSize(bundle),status);
|
TimeZoneKeysEnumeration* keysEnum = new TimeZoneKeysEnumeration(length, status);
|
||||||
fZoneIDEnumeration = keysEnum;
|
fZoneIDEnumeration = keysEnum;
|
||||||
if(fZoneIDEnumeration==NULL){
|
if(fZoneIDEnumeration==NULL){
|
||||||
delete fZoneStringsHash;
|
delete fZoneStringsHash;
|
||||||
@ -1352,7 +1365,7 @@ DateFormatSymbols::initZoneStrings(UResourceBundle* bundle, const UChar* lastRes
|
|||||||
keysEnum->put(key, status);
|
keysEnum->put(key, status);
|
||||||
int32_t j=1;
|
int32_t j=1;
|
||||||
for(i=0; i< length; ){
|
for(i=0; i< length; ){
|
||||||
array[i++].setTo(lastResortStrings[j++]);
|
array[i++].setTo(gLastResortZoneStrings[j++]);
|
||||||
}
|
}
|
||||||
fZoneStringsHash->put(key, array, status);
|
fZoneStringsHash->put(key, array, status);
|
||||||
}
|
}
|
||||||
@ -1442,7 +1455,7 @@ DateFormatSymbols::getZoneString(const UnicodeString &zid, const TimeZoneTransla
|
|||||||
|
|
||||||
if(fZoneStringsHash == NULL){
|
if(fZoneStringsHash == NULL){
|
||||||
//lazy initialization
|
//lazy initialization
|
||||||
initZoneStrings(fZoneArrayBundle, (const UChar *)gLastResortZoneStrings, ARRAY_LENGTH(gLastResortZoneStrings), status);
|
initZoneStrings(status);
|
||||||
}
|
}
|
||||||
if(U_FAILURE(status)){
|
if(U_FAILURE(status)){
|
||||||
return result;
|
return result;
|
||||||
@ -1462,7 +1475,7 @@ DateFormatSymbols::createZoneStringIDs(UErrorCode &status){
|
|||||||
}
|
}
|
||||||
if(fZoneStringsHash == NULL){
|
if(fZoneStringsHash == NULL){
|
||||||
//lazy initialization
|
//lazy initialization
|
||||||
initZoneStrings(fZoneArrayBundle, (const UChar *)gLastResortZoneStrings, ARRAY_LENGTH(gLastResortZoneStrings), status);
|
initZoneStrings(status);
|
||||||
}
|
}
|
||||||
return fZoneIDEnumeration->clone();
|
return fZoneIDEnumeration->clone();
|
||||||
}
|
}
|
||||||
@ -1476,7 +1489,7 @@ DateFormatSymbols::setZoneString(const UnicodeString &zid, const TimeZoneTransla
|
|||||||
const UnicodeString &value, UErrorCode &status){
|
const UnicodeString &value, UErrorCode &status){
|
||||||
if(fZoneStringsHash == NULL){
|
if(fZoneStringsHash == NULL){
|
||||||
//lazy initialization
|
//lazy initialization
|
||||||
initZoneStrings(fZoneArrayBundle, (const UChar *)gLastResortZoneStrings, ARRAY_LENGTH(gLastResortZoneStrings), status);
|
initZoneStrings(status);
|
||||||
}
|
}
|
||||||
if(U_FAILURE(status)){
|
if(U_FAILURE(status)){
|
||||||
return;
|
return;
|
||||||
@ -1605,7 +1618,7 @@ DateFormatSymbols::hashCompare(Hashtable* hash1,
|
|||||||
UnicodeString&
|
UnicodeString&
|
||||||
DateFormatSymbols::getZoneID(const UnicodeString& zid, UnicodeString& result, UErrorCode& status){
|
DateFormatSymbols::getZoneID(const UnicodeString& zid, UnicodeString& result, UErrorCode& status){
|
||||||
if(fZoneStringsHash == NULL){
|
if(fZoneStringsHash == NULL){
|
||||||
initZoneStrings(fZoneArrayBundle, (const UChar*)gLastResortZoneStrings, ARRAY_LENGTH(gLastResortZoneStrings), status);
|
initZoneStrings(status);
|
||||||
}
|
}
|
||||||
if(U_FAILURE(status)){
|
if(U_FAILURE(status)){
|
||||||
return result;
|
return result;
|
||||||
@ -1636,7 +1649,7 @@ void
|
|||||||
DateFormatSymbols::getZoneType(const UnicodeString& zid, const UnicodeString& text, int32_t start,
|
DateFormatSymbols::getZoneType(const UnicodeString& zid, const UnicodeString& text, int32_t start,
|
||||||
TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status){
|
TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status){
|
||||||
if(fZoneStringsHash == NULL){
|
if(fZoneStringsHash == NULL){
|
||||||
initZoneStrings(fZoneArrayBundle, (const UChar*)gLastResortZoneStrings, ARRAY_LENGTH(gLastResortZoneStrings), status);
|
initZoneStrings(status);
|
||||||
}
|
}
|
||||||
if(U_FAILURE(status)){
|
if(U_FAILURE(status)){
|
||||||
return;
|
return;
|
||||||
@ -1657,7 +1670,7 @@ DateFormatSymbols::findZoneIDTypeValue( UnicodeString& zid, const UnicodeString&
|
|||||||
TimeZoneTranslationType& type, UnicodeString& value,
|
TimeZoneTranslationType& type, UnicodeString& value,
|
||||||
UErrorCode& status){
|
UErrorCode& status){
|
||||||
if(fZoneStringsHash == NULL){
|
if(fZoneStringsHash == NULL){
|
||||||
initZoneStrings(fZoneArrayBundle, (const UChar*)gLastResortZoneStrings, ARRAY_LENGTH(gLastResortZoneStrings), status);
|
initZoneStrings(status);
|
||||||
}
|
}
|
||||||
if(U_FAILURE(status)){
|
if(U_FAILURE(status)){
|
||||||
return;
|
return;
|
||||||
|
@ -550,12 +550,8 @@ private:
|
|||||||
int32_t fZoneStringsColCount;
|
int32_t fZoneStringsColCount;
|
||||||
StringEnumeration* fZoneIDEnumeration;
|
StringEnumeration* fZoneIDEnumeration;
|
||||||
Hashtable* fZoneStringsHash;
|
Hashtable* fZoneStringsHash;
|
||||||
UResourceBundle* fZoneArrayBundle;
|
UResourceBundle* fResourceBundle;
|
||||||
struct VectorItem{
|
|
||||||
UnicodeString value;
|
|
||||||
TimeZoneTranslationType type;
|
|
||||||
VectorItem* next;
|
|
||||||
};
|
|
||||||
/**
|
/**
|
||||||
* Localized date-time pattern characters. For example: use 'u' as 'y'.
|
* Localized date-time pattern characters. For example: use 'u' as 'y'.
|
||||||
*/
|
*/
|
||||||
@ -648,7 +644,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Initializes the zoneStrings hash and keys StringEnumeration after reading the zoneStrings resource
|
* Initializes the zoneStrings hash and keys StringEnumeration after reading the zoneStrings resource
|
||||||
*/
|
*/
|
||||||
void initZoneStrings(UResourceBundle* bundle, const UChar* lastResortStrings, int32_t length, UErrorCode &status);
|
void initZoneStrings(UErrorCode &status);
|
||||||
/**
|
/**
|
||||||
* initialzes the zoneStrings has and keys enumeration after reading the strings[][]. Required for backwards
|
* initialzes the zoneStrings has and keys enumeration after reading the strings[][]. Required for backwards
|
||||||
* compatibility of setZoneStrings method
|
* compatibility of setZoneStrings method
|
||||||
|
Loading…
Reference in New Issue
Block a user