int32_t TaiwanCalendar::handleGetExtendedYear() { // 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; }
int32_t JapaneseCalendar::handleGetExtendedYear() { int32_t year; if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR && newerField(UCAL_EXTENDED_YEAR, UCAL_ERA) == UCAL_EXTENDED_YEAR) { year = internalGet(UCAL_EXTENDED_YEAR, 1); } else { // Subtract one because year starts at 1 year = internalGet(UCAL_YEAR) + kEraInfo[internalGetEra()].year - 1; } return year; }
int32_t JapaneseCalendar::handleGetExtendedYear() { // EXTENDED_YEAR in JapaneseCalendar is a Gregorian year // The default value of EXTENDED_YEAR is 1970 (Showa 45) int32_t year; 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 { // Subtract one because year starts at 1 year = internalGet(UCAL_YEAR) + kEraInfo[internalGetEra()].year - 1; } return year; }
/** * @draft ICU 2.4 */ int32_t IslamicCalendar::handleGetExtendedYear() { int32_t year; if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR) { year = internalGet(UCAL_EXTENDED_YEAR, 1); // Default to year 1 } else { year = internalGet(UCAL_YEAR, 1); // Default to year 1 } return year; }
int32_t BuddhistCalendar::handleGetExtendedYear() { // EXTENDED_YEAR in BuddhistCalendar is a Gregorian year. // The default value of EXTENDED_YEAR is 1970 (Buddhist 2513) int32_t year; if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR) { year = internalGet(UCAL_EXTENDED_YEAR, kGregorianEpoch); } else { // extended year is a gregorian year, where 1 = 1AD, 0 = 1BC, -1 = 2BC, etc year = internalGet(UCAL_YEAR, kGregorianEpoch - kBuddhistEraStart) + kBuddhistEraStart; } return year; }
int32_t CopticCalendar::handleGetExtendedYear() { int32_t eyear; if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR) { eyear = internalGet(UCAL_EXTENDED_YEAR, 1); // Default to year 1 } else { // The year defaults to the epoch start, the era to CE int32_t era = internalGet(UCAL_ERA, CE); if (era == BCE) { eyear = 1 - internalGet(UCAL_YEAR, 1); // Convert to extended year } else { eyear = internalGet(UCAL_YEAR, 1); // Default to year 1 } } return eyear; }
int32_t EthiopicCalendar::handleGetExtendedYear() { // Ethiopic calendar uses EXTENDED_YEAR aligned to // Amelete Hihret year always. int32_t eyear; if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR) { eyear = internalGet(UCAL_EXTENDED_YEAR, 1); // Default to year 1 } else if (isAmeteAlemEra()) { eyear = internalGet(UCAL_YEAR, 1 + AMETE_MIHRET_DELTA) - AMETE_MIHRET_DELTA; // Default to year 1 of Amelete Mihret } else { // The year defaults to the epoch start, the era to AMETE_MIHRET int32_t era = internalGet(UCAL_ERA, AMETE_MIHRET); if (era == AMETE_MIHRET) { eyear = internalGet(UCAL_YEAR, 1); // Default to year 1 } else { eyear = internalGet(UCAL_YEAR, 1) - AMETE_MIHRET_DELTA; } } return eyear; }