ICU-2202 getLocale API for calendar. API placeholder inserted.
X-SVN-Rev: 13727
This commit is contained in:
parent
a4cfa4974e
commit
0fd90f3eb3
@ -2905,6 +2905,39 @@ Calendar::updateTime(UErrorCode& status)
|
||||
}
|
||||
|
||||
|
||||
Locale
|
||||
Calendar::getLocale(ULocDataLocaleType type, UErrorCode &status)
|
||||
{
|
||||
switch(type) {
|
||||
case ULOC_VALID_LOCALE:
|
||||
return validLocale;
|
||||
break;
|
||||
case ULOC_ACTUAL_LOCALE:
|
||||
return actualLocale;
|
||||
break;
|
||||
default:
|
||||
status = U_UNSUPPORTED_ERROR;
|
||||
return Locale("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const char*
|
||||
Calendar::getLocaleInternal(ULocDataLocaleType type, UErrorCode &status)
|
||||
{
|
||||
switch(type) {
|
||||
case ULOC_VALID_LOCALE:
|
||||
return validLocale.getName();
|
||||
break;
|
||||
case ULOC_ACTUAL_LOCALE:
|
||||
return actualLocale.getName();;
|
||||
break;
|
||||
default:
|
||||
status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
|
@ -468,4 +468,10 @@ ucal_getLimit( const UCalendar* cal,
|
||||
return -1;
|
||||
}
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status)
|
||||
{
|
||||
return ((Calendar*)cal)->getLocaleInternal(type, *status);
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
@ -1981,7 +1981,6 @@ private:
|
||||
*/
|
||||
void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status);
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Convert a quasi Julian date to the day of the week. The Julian date used here is
|
||||
@ -1994,6 +1993,9 @@ private:
|
||||
*/
|
||||
static uint8_t julianDayToDayOfWeek(double julian);
|
||||
|
||||
Locale validLocale;
|
||||
Locale actualLocale;
|
||||
|
||||
public:
|
||||
/**
|
||||
* INTERNAL FOR 2.6 -- Registration.
|
||||
@ -2064,6 +2066,22 @@ private:
|
||||
*/
|
||||
virtual int32_t defaultCenturyStartYear() const = 0;
|
||||
|
||||
/** Get the locale for this calendar object. You can choose between valid and actual locale.
|
||||
* @param type type of the locale we're looking for (valid or actual)
|
||||
* @param status error code for the operation
|
||||
* @return the locale
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
virtual Locale getLocale(ULocDataLocaleType type, UErrorCode &status);
|
||||
|
||||
/** Get the locale for this calendar object. You can choose between valid and actual locale.
|
||||
* @param type type of the locale we're looking for (valid or actual)
|
||||
* @param status error code for the operation
|
||||
* @return the locale
|
||||
* @internal
|
||||
*/
|
||||
virtual const char* getLocaleInternal(ULocDataLocaleType type, UErrorCode &status);
|
||||
|
||||
};
|
||||
|
||||
// -------------------------------------
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/uenum.h"
|
||||
#include "unicode/uloc.h"
|
||||
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
|
||||
@ -910,6 +911,15 @@ ucal_getAvailableTZIDs(int32_t rawOffset,
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucal_countAvailableTZIDs(int32_t rawOffset);
|
||||
|
||||
/** Get the locale for this calendar object. You can choose between valid and actual locale.
|
||||
* @param cal The calendar object
|
||||
* @param type type of the locale we're looking for (valid or actual)
|
||||
* @param status error code for the operation
|
||||
* @return the locale name
|
||||
*/
|
||||
U_CAPI const char * U_EXPORT2
|
||||
ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user