mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-16 18:25:57 +00:00
ICU-4078 Further separate the default converter from the rest of the API
X-SVN-Rev: 16331
This commit is contained in:
parent
1ca3116228
commit
8c9aab5002
7 changed files with 17 additions and 14 deletions
|
@ -182,7 +182,7 @@ protected:
|
|||
return FALSE;
|
||||
}
|
||||
for(int32_t i=0;gBasicCalendars[i] != NULL;i++) {
|
||||
UnicodeString ourId(gBasicCalendars[i],"");
|
||||
UnicodeString ourId(gBasicCalendars[i],-1, US_INV);
|
||||
if(ourId == id) {
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ protected:
|
|||
{
|
||||
if (U_SUCCESS(status)) {
|
||||
for(int32_t i=0;gBasicCalendars[i] != NULL;i++) {
|
||||
UnicodeString id(gBasicCalendars[i],"");
|
||||
UnicodeString id(gBasicCalendars[i], -1, US_INV);
|
||||
result.put(id, (void*)this, status);
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ protected:
|
|||
if(len > actLen) {
|
||||
len = actLen;
|
||||
}
|
||||
str.extract(0,len,tmp);
|
||||
str.extract(0,len,tmp, sizeof(tmp), US_INV);
|
||||
tmp[len]=0;
|
||||
|
||||
#ifdef U_DEBUG_CALSVC
|
||||
|
@ -296,7 +296,7 @@ class DefaultCalendarFactory : public ICUResourceBundleFactory {
|
|||
class CalendarService : public ICULocaleService {
|
||||
public:
|
||||
CalendarService()
|
||||
: ICULocaleService("Calendar")
|
||||
: ICULocaleService(UNICODE_STRING_SIMPLE("Calendar"))
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
registerFactory(new DefaultCalendarFactory(), status);
|
||||
|
@ -655,7 +655,7 @@ Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& succ
|
|||
if(len > actLen) {
|
||||
len = actLen;
|
||||
}
|
||||
str.extract(0,len,tmp);
|
||||
str.extract(0,len,tmp,sizeof(tmp),US_INV);
|
||||
tmp[len]=0;
|
||||
|
||||
#ifdef U_DEBUG_CALSVC
|
||||
|
|
|
@ -195,7 +195,7 @@ ChoiceFormat::stod(const UnicodeString& string)
|
|||
char source[256];
|
||||
char* end;
|
||||
|
||||
string.extract(0, string.length(), source, sizeof(source), ""); /* invariant codepage */
|
||||
string.extract(0, string.length(), source, sizeof(source), US_INV); /* invariant codepage */
|
||||
return uprv_strtod(source,&end);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ ChoiceFormat::dtos(double value,
|
|||
char temp[256];
|
||||
|
||||
uprv_dtostr(value, temp, 3, TRUE);
|
||||
string = UnicodeString(temp, ""); /* invariant codepage */
|
||||
string = UnicodeString(temp, -1, US_INV); /* invariant codepage */
|
||||
return string;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ NFRuleSet::NFRuleSet(UnicodeString* descriptions, int32_t index, UErrorCode& sta
|
|||
description.remove(0, pos);
|
||||
}
|
||||
} else {
|
||||
name.setTo("%default");
|
||||
name.setTo(UNICODE_STRING_SIMPLE("%default"));
|
||||
}
|
||||
|
||||
if (description.length() == 0) {
|
||||
|
|
|
@ -175,9 +175,10 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
|
|||
// 3, 1, -1, 7200, 0, 9, -31, -1, 7200, 0, 3600
|
||||
data = ures_getIntVector(r, &len, &ec);
|
||||
if (U_SUCCESS(ec) && len == 11) {
|
||||
UnicodeString emptyStr;
|
||||
U_DEBUG_TZ_MSG(("zone%s, rule%s: {%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d}", zKey, ures_getKey(r),
|
||||
data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10]));
|
||||
finalZone = new SimpleTimeZone(rawOffset, "",
|
||||
finalZone = new SimpleTimeZone(rawOffset, emptyStr,
|
||||
(int8_t)data[0], (int8_t)data[1], (int8_t)data[2],
|
||||
data[3] * U_MILLIS_PER_SECOND,
|
||||
(SimpleTimeZone::TimeMode) data[4],
|
||||
|
|
|
@ -416,7 +416,7 @@ RuleBasedNumberFormat::setDefaultRuleSet(const UnicodeString& ruleSetName, UErro
|
|||
if (U_SUCCESS(status)) {
|
||||
if (ruleSetName.isEmpty()) {
|
||||
initDefaultRuleSet();
|
||||
} else if (ruleSetName.startsWith("%%")) {
|
||||
} else if (ruleSetName.startsWith(UNICODE_STRING_SIMPLE("%%"))) {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
} else {
|
||||
NFRuleSet* result = findRuleSet(ruleSetName, status);
|
||||
|
|
|
@ -1397,7 +1397,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
|
|||
// a little more permissive than RFC 822. It will try to do
|
||||
// its best with numbers that aren't strictly 4 digits long.
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
DecimalFormat fmt("+####;-####", status);
|
||||
DecimalFormat fmt(UNICODE_STRING_SIMPLE("+####;-####"), status);
|
||||
if(U_FAILURE(status))
|
||||
return -start;
|
||||
fmt.setParseIntegerOnly(TRUE);
|
||||
|
|
|
@ -90,6 +90,8 @@ static char gStrBuf[256];
|
|||
// Static data and constants
|
||||
|
||||
static const UChar GMT_ID[] = {0x47, 0x4D, 0x54, 0x00}; /* "GMT" */
|
||||
static const UChar Z_STR[] = {0x7A, 0x00}; /* "z" */
|
||||
static const UChar ZZZZ_STR[] = {0x7A, 0x7A, 0x7A, 0x7A, 0x00}; /* "zzzz" */
|
||||
static const int32_t GMT_ID_LENGTH = 3;
|
||||
static const UChar CUSTOM_ID[] =
|
||||
{
|
||||
|
@ -252,7 +254,7 @@ static UResourceBundle* getZoneByName(const UResourceBundle* top, const UnicodeS
|
|||
|
||||
UResourceBundle* TimeZone::loadRule(const UResourceBundle* top, const UnicodeString& ruleid, UResourceBundle* oldbundle, UErrorCode& status) {
|
||||
char key[64];
|
||||
ruleid.extract(0, sizeof(key)-1, key, sizeof(key)-1, "");
|
||||
ruleid.extract(0, sizeof(key)-1, key, sizeof(key)-1, US_INV);
|
||||
U_DEBUG_TZ_MSG(("loadRule(%s)\n", key));
|
||||
UResourceBundle *r = ures_getByKey(top, kRULES, oldbundle, &status);
|
||||
U_DEBUG_TZ_MSG(("loadRule(%s) -> kRULES [%s]\n", key, u_errorName(status)));
|
||||
|
@ -1080,7 +1082,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
|
|||
char buf[128];
|
||||
fID.extract(0, sizeof(buf)-1, buf, sizeof(buf), "");
|
||||
#endif
|
||||
SimpleDateFormat format(style == LONG ? "zzzz" : "z",locale,status);
|
||||
SimpleDateFormat format(style == LONG ? ZZZZ_STR : Z_STR,locale,status);
|
||||
U_DEBUG_TZ_MSG(("getDisplayName(%s)\n", buf));
|
||||
if(!U_SUCCESS(status))
|
||||
{
|
||||
|
@ -1105,7 +1107,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
|
|||
UCAL_DECEMBER , 31, 0, U_MILLIS_PER_DAY, status) :
|
||||
new SimpleTimeZone(getRawOffset(), getID(tempID));
|
||||
|
||||
format.applyPattern(style == LONG ? "zzzz" : "z");
|
||||
format.applyPattern(style == LONG ? ZZZZ_STR : Z_STR);
|
||||
Calendar *myCalendar = (Calendar*)format.getCalendar();
|
||||
myCalendar->setTimeZone(*tz); // copy
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue