ICU-4643 Add setters for era names, standalone/narrow months to udat_setSymbols()

X-SVN-Rev: 18673
This commit is contained in:
John Emmons 2005-10-13 03:26:40 +00:00
parent 419ad4f271
commit 583b575748

View File

@ -322,6 +322,10 @@ udat_getSymbols(const UDateFormat *fmt,
res = syms->getEras(count); res = syms->getEras(count);
break; break;
case UDAT_ERA_NAMES:
res = syms->getEraNames(count);
break;
case UDAT_MONTHS: case UDAT_MONTHS:
res = syms->getMonths(count); res = syms->getMonths(count);
break; break;
@ -354,10 +358,6 @@ udat_getSymbols(const UDateFormat *fmt,
return res1.extract(result, resultLength, *status); return res1.extract(result, resultLength, *status);
} }
case UDAT_ERA_NAMES:
res = syms->getEraNames(count);
break;
case UDAT_NARROW_MONTHS: case UDAT_NARROW_MONTHS:
res = syms->getMonths(count, DateFormatSymbols::FORMAT, DateFormatSymbols::NARROW); res = syms->getMonths(count, DateFormatSymbols::FORMAT, DateFormatSymbols::NARROW);
break; break;
@ -434,6 +434,7 @@ udat_countSymbols( const UDateFormat *fmt,
case UDAT_LOCALIZED_CHARS: case UDAT_LOCALIZED_CHARS:
count = 1; count = 1;
break; break;
case UDAT_ERA_NAMES: case UDAT_ERA_NAMES:
syms->getEraNames(count); syms->getEraNames(count);
break; break;
@ -525,6 +526,13 @@ public:
setSymbol(syms->fEras, syms->fErasCount, index, value, valueLength, errorCode); setSymbol(syms->fEras, syms->fErasCount, index, value, valueLength, errorCode);
} }
static void
setEraName(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fEraNames, syms->fEraNamesCount, index, value, valueLength, errorCode);
}
static void static void
setMonth(DateFormatSymbols *syms, int32_t index, setMonth(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode) const UChar *value, int32_t valueLength, UErrorCode &errorCode)
@ -539,6 +547,34 @@ public:
setSymbol(syms->fShortMonths, syms->fShortMonthsCount, index, value, valueLength, errorCode); setSymbol(syms->fShortMonths, syms->fShortMonthsCount, index, value, valueLength, errorCode);
} }
static void
setNarrowMonth(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fNarrowMonths, syms->fNarrowMonthsCount, index, value, valueLength, errorCode);
}
static void
setStandaloneMonth(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fStandaloneMonths, syms->fStandaloneMonthsCount, index, value, valueLength, errorCode);
}
static void
setStandaloneShortMonth(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fStandaloneShortMonths, syms->fStandaloneShortMonthsCount, index, value, valueLength, errorCode);
}
static void
setStandaloneNarrowMonth(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fStandaloneNarrowMonths, syms->fStandaloneNarrowMonthsCount, index, value, valueLength, errorCode);
}
static void static void
setWeekday(DateFormatSymbols *syms, int32_t index, setWeekday(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode) const UChar *value, int32_t valueLength, UErrorCode &errorCode)
@ -553,6 +589,34 @@ public:
setSymbol(syms->fShortWeekdays, syms->fShortWeekdaysCount, index, value, valueLength, errorCode); setSymbol(syms->fShortWeekdays, syms->fShortWeekdaysCount, index, value, valueLength, errorCode);
} }
static void
setNarrowWeekday(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fNarrowWeekdays, syms->fNarrowWeekdaysCount, index, value, valueLength, errorCode);
}
static void
setStandaloneWeekday(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fStandaloneWeekdays, syms->fStandaloneWeekdaysCount, index, value, valueLength, errorCode);
}
static void
setStandaloneShortWeekday(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fStandaloneShortWeekdays, syms->fStandaloneShortWeekdaysCount, index, value, valueLength, errorCode);
}
static void
setStandaloneNarrowWeekday(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode)
{
setSymbol(syms->fStandaloneNarrowWeekdays, syms->fStandaloneNarrowWeekdaysCount, index, value, valueLength, errorCode);
}
static void static void
setAmPm(DateFormatSymbols *syms, int32_t index, setAmPm(DateFormatSymbols *syms, int32_t index,
const UChar *value, int32_t valueLength, UErrorCode &errorCode) const UChar *value, int32_t valueLength, UErrorCode &errorCode)
@ -578,6 +642,7 @@ udat_setSymbols( UDateFormat *format,
int32_t valueLength, int32_t valueLength,
UErrorCode *status) UErrorCode *status)
{ {
if(U_FAILURE(*status)) return; if(U_FAILURE(*status)) return;
DateFormatSymbols *syms = (DateFormatSymbols *)((SimpleDateFormat *)format)->getDateFormatSymbols(); DateFormatSymbols *syms = (DateFormatSymbols *)((SimpleDateFormat *)format)->getDateFormatSymbols();
@ -587,6 +652,10 @@ udat_setSymbols( UDateFormat *format,
DateFormatSymbolsSingleSetter::setEra(syms, index, value, valueLength, *status); DateFormatSymbolsSingleSetter::setEra(syms, index, value, valueLength, *status);
break; break;
case UDAT_ERA_NAMES:
DateFormatSymbolsSingleSetter::setEraName(syms, index, value, valueLength, *status);
break;
case UDAT_MONTHS: case UDAT_MONTHS:
DateFormatSymbolsSingleSetter::setMonth(syms, index, value, valueLength, *status); DateFormatSymbolsSingleSetter::setMonth(syms, index, value, valueLength, *status);
break; break;
@ -595,6 +664,22 @@ udat_setSymbols( UDateFormat *format,
DateFormatSymbolsSingleSetter::setShortMonth(syms, index, value, valueLength, *status); DateFormatSymbolsSingleSetter::setShortMonth(syms, index, value, valueLength, *status);
break; break;
case UDAT_NARROW_MONTHS:
DateFormatSymbolsSingleSetter::setNarrowMonth(syms, index, value, valueLength, *status);
break;
case UDAT_STANDALONE_MONTHS:
DateFormatSymbolsSingleSetter::setStandaloneMonth(syms, index, value, valueLength, *status);
break;
case UDAT_STANDALONE_SHORT_MONTHS:
DateFormatSymbolsSingleSetter::setStandaloneShortMonth(syms, index, value, valueLength, *status);
break;
case UDAT_STANDALONE_NARROW_MONTHS:
DateFormatSymbolsSingleSetter::setStandaloneNarrowMonth(syms, index, value, valueLength, *status);
break;
case UDAT_WEEKDAYS: case UDAT_WEEKDAYS:
DateFormatSymbolsSingleSetter::setWeekday(syms, index, value, valueLength, *status); DateFormatSymbolsSingleSetter::setWeekday(syms, index, value, valueLength, *status);
break; break;
@ -603,6 +688,22 @@ udat_setSymbols( UDateFormat *format,
DateFormatSymbolsSingleSetter::setShortWeekday(syms, index, value, valueLength, *status); DateFormatSymbolsSingleSetter::setShortWeekday(syms, index, value, valueLength, *status);
break; break;
case UDAT_NARROW_WEEKDAYS:
DateFormatSymbolsSingleSetter::setNarrowWeekday(syms, index, value, valueLength, *status);
break;
case UDAT_STANDALONE_WEEKDAYS:
DateFormatSymbolsSingleSetter::setStandaloneWeekday(syms, index, value, valueLength, *status);
break;
case UDAT_STANDALONE_SHORT_WEEKDAYS:
DateFormatSymbolsSingleSetter::setStandaloneShortWeekday(syms, index, value, valueLength, *status);
break;
case UDAT_STANDALONE_NARROW_WEEKDAYS:
DateFormatSymbolsSingleSetter::setStandaloneNarrowWeekday(syms, index, value, valueLength, *status);
break;
case UDAT_AM_PMS: case UDAT_AM_PMS:
DateFormatSymbolsSingleSetter::setAmPm(syms, index, value, valueLength, *status); DateFormatSymbolsSingleSetter::setAmPm(syms, index, value, valueLength, *status);
break; break;
@ -610,6 +711,11 @@ udat_setSymbols( UDateFormat *format,
case UDAT_LOCALIZED_CHARS: case UDAT_LOCALIZED_CHARS:
DateFormatSymbolsSingleSetter::setLocalPatternChars(syms, value, valueLength, *status); DateFormatSymbolsSingleSetter::setLocalPatternChars(syms, value, valueLength, *status);
break; break;
default:
*status = U_UNSUPPORTED_ERROR;
break;
} }
} }