Beispiel #1
0
/*
Function:
GetCalendarInfo

Gets a single string of calendar information by filling the result parameter with the requested value.
*/
extern "C" CalendarDataResult GetCalendarInfo(const UChar* localeName, CalendarId calendarId, CalendarDataType dataType, UChar* result, int32_t resultCapacity)
{
	Locale locale = GetLocale(localeName);
	if (locale.isBogus())
		return UnknownError;

	switch (dataType)
	{
		case NativeName:
			return GetNativeCalendarName(locale, calendarId, result, resultCapacity);
		case MonthDay:
			return GetMonthDayPattern(locale, result, resultCapacity);
		default:
			assert(false);
			return UnknownError;
	}
}
/*
Function:
GetCalendarInfo

Gets a single string of calendar information by filling the result parameter
with the requested value.
*/
ResultCode GlobalizationNative_GetCalendarInfo(
    const UChar* localeName, CalendarId calendarId, CalendarDataType dataType, UChar* result, int32_t resultCapacity)
{
    UErrorCode err = U_ZERO_ERROR;
    char locale[ULOC_FULLNAME_CAPACITY];
    GetLocale(localeName, locale, ULOC_FULLNAME_CAPACITY, FALSE, &err);

    if (U_FAILURE(err))
        return UnknownError;

    switch (dataType)
    {
        case CalendarData_NativeName:
            return GetNativeCalendarName(locale, calendarId, result, resultCapacity);
        case CalendarData_MonthDay:
            return GetMonthDayPattern(locale, result, resultCapacity);
        default:
            assert(FALSE);
            return UnknownError;
    }
}