Logo Search packages:      
Sourcecode: icu version File versions  Download package

int32_t TaiwanCalendar::handleGetExtendedYear (  )  [protected, virtual]

Return the extended year defined by the current fields. This will use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such as UCAL_ERA) specific to the calendar system, depending on which set of fields is newer.

Returns:
the extended year

For internal use only.

Reimplemented from GregorianCalendar.

Definition at line 64 of file taiwncal.cpp.

References Calendar::internalGet(), Calendar::newerField(), UCAL_ERA, UCAL_EXTENDED_YEAR, and UCAL_YEAR.

{
    // EXTENDED_YEAR in TaiwanCalendar is a Gregorian year
    // The default value of EXTENDED_YEAR is 1970 (Minguo 59)
    int32_t year = kGregorianEpoch;

    if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR
        && newerField(UCAL_EXTENDED_YEAR, UCAL_ERA) == UCAL_EXTENDED_YEAR) {
        year = internalGet(UCAL_EXTENDED_YEAR, kGregorianEpoch);
    } else {
        int32_t era = internalGet(UCAL_ERA, MINGUO);
        if(era == MINGUO) {
            year =     internalGet(UCAL_YEAR, 1) + kTaiwanEraStart;
        } else if(era == BEFORE_MINGUO) {
            year = 1 - internalGet(UCAL_YEAR, 1) + kTaiwanEraStart;
        }
    }
    return year;
}


Generated by  Doxygen 1.6.0   Back to index