ICU-22991 Remove unnecessary overload in Calendar

This commit is contained in:
Frank Tang 2024-12-20 16:43:51 -08:00 committed by Frank Yung-Fong Tang
parent ff31805f56
commit e515c84645
14 changed files with 10 additions and 99 deletions

View file

@ -36,7 +36,6 @@ static const int32_t kGregorianEpoch = 1970; // used as the default value of
BuddhistCalendar::BuddhistCalendar(const Locale& aLocale, UErrorCode& success)
: GregorianCalendar(aLocale, success)
{
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}
BuddhistCalendar::~BuddhistCalendar()
@ -48,12 +47,6 @@ BuddhistCalendar::BuddhistCalendar(const BuddhistCalendar& source)
{
}
BuddhistCalendar& BuddhistCalendar::operator= ( const BuddhistCalendar& right)
{
GregorianCalendar::operator=(right);
return *this;
}
BuddhistCalendar* BuddhistCalendar::clone() const
{
return new BuddhistCalendar(*this);

View file

@ -82,13 +82,6 @@ public:
*/
BuddhistCalendar(const BuddhistCalendar& source);
/**
* Default assignment operator
* @param right the object to be copied.
* @internal
*/
BuddhistCalendar& operator=(const BuddhistCalendar& right);
/**
* Create and return a polymorphic copy of this calendar.
* @return return a polymorphic copy of this calendar.

View file

@ -53,7 +53,6 @@ static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = {
CECalendar::CECalendar(const Locale& aLocale, UErrorCode& success)
: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success)
{
setTimeInMillis(getNow(), success);
}
CECalendar::CECalendar (const CECalendar& other)
@ -65,13 +64,6 @@ CECalendar::~CECalendar()
{
}
CECalendar&
CECalendar::operator=(const CECalendar& right)
{
Calendar::operator=(right);
return *this;
}
//-------------------------------------------------------------------------
// Calendar framework
//-------------------------------------------------------------------------

View file

@ -82,13 +82,6 @@ protected:
*/
virtual ~CECalendar();
/**
* Default assignment operator
* @param right Calendar object to be copied
* @internal
*/
CECalendar& operator=(const CECalendar& right);
protected:
//-------------------------------------------------------------------------
// Calendar framework

View file

@ -130,7 +130,6 @@ ChineseCalendar::ChineseCalendar(const Locale& aLocale, UErrorCode& success)
: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success),
hasLeapMonthBetweenWinterSolstices(false)
{
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}
ChineseCalendar::ChineseCalendar(const ChineseCalendar& other) : Calendar(other) {

View file

@ -147,6 +147,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GregorianCalendar)
// in Java, -12219292800000L
//const UDate GregorianCalendar::kPapalCutover = -12219292800000L;
static const uint32_t kCutoverJulianDay = 2299161;
static const int32_t kDefaultCutoverYear = 1582;
static const UDate kPapalCutover = (2299161.0 - kEpochStartAsJulianDay) * U_MILLIS_PER_DAY;
//static const UDate kPapalCutoverJulian = (2299161.0 - kEpochStartAsJulianDay);
@ -155,7 +156,7 @@ static const UDate kPapalCutover = (2299161.0 - kEpochStartAsJulianDay) * U_MILL
GregorianCalendar::GregorianCalendar(UErrorCode& status)
: Calendar(status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(kDefaultCutoverYear),
fIsGregorian(true), fInvertGregorian(false)
{
setTimeInMillis(getNow(), status);
@ -164,34 +165,22 @@ fIsGregorian(true), fInvertGregorian(false)
// -------------------------------------
GregorianCalendar::GregorianCalendar(TimeZone* zone, UErrorCode& status)
: Calendar(zone, Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(true), fInvertGregorian(false)
: GregorianCalendar(zone, Locale::getDefault(), status)
{
setTimeInMillis(getNow(), status);
}
// -------------------------------------
GregorianCalendar::GregorianCalendar(const TimeZone& zone, UErrorCode& status)
: Calendar(zone, Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(true), fInvertGregorian(false)
: GregorianCalendar(zone, Locale::getDefault(), status)
{
setTimeInMillis(getNow(), status);
}
// -------------------------------------
GregorianCalendar::GregorianCalendar(const Locale& aLocale, UErrorCode& status)
: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(true), fInvertGregorian(false)
: GregorianCalendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, status)
{
setTimeInMillis(getNow(), status);
}
// -------------------------------------
@ -200,7 +189,7 @@ GregorianCalendar::GregorianCalendar(TimeZone* zone, const Locale& aLocale,
UErrorCode& status)
: Calendar(zone, aLocale, status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(kDefaultCutoverYear),
fIsGregorian(true), fInvertGregorian(false)
{
setTimeInMillis(getNow(), status);
@ -212,7 +201,7 @@ GregorianCalendar::GregorianCalendar(const TimeZone& zone, const Locale& aLocale
UErrorCode& status)
: Calendar(zone, aLocale, status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(kDefaultCutoverYear),
fIsGregorian(true), fInvertGregorian(false)
{
setTimeInMillis(getNow(), status);
@ -224,7 +213,7 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
UErrorCode& status)
: Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(kDefaultCutoverYear),
fIsGregorian(true), fInvertGregorian(false)
{
set(UCAL_ERA, AD);
@ -237,15 +226,8 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
int32_t hour, int32_t minute, UErrorCode& status)
: Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(true), fInvertGregorian(false)
: GregorianCalendar(year, month, date, status)
{
set(UCAL_ERA, AD);
set(UCAL_YEAR, year);
set(UCAL_MONTH, month);
set(UCAL_DATE, date);
set(UCAL_HOUR_OF_DAY, hour);
set(UCAL_MINUTE, minute);
}
@ -255,17 +237,8 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
int32_t hour, int32_t minute, int32_t second,
UErrorCode& status)
: Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
fGregorianCutover(kPapalCutover),
fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
fIsGregorian(true), fInvertGregorian(false)
: GregorianCalendar(year, month, date, hour, minute, status)
{
set(UCAL_ERA, AD);
set(UCAL_YEAR, year);
set(UCAL_MONTH, month);
set(UCAL_DATE, date);
set(UCAL_HOUR_OF_DAY, hour);
set(UCAL_MINUTE, minute);
set(UCAL_SECOND, second);
}

View file

@ -164,7 +164,6 @@ HebrewCalendar::HebrewCalendar(const Locale& aLocale, UErrorCode& success)
: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success)
{
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}

View file

@ -41,7 +41,6 @@ IndianCalendar* IndianCalendar::clone() const {
IndianCalendar::IndianCalendar(const Locale& aLocale, UErrorCode& success)
: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success)
{
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}
IndianCalendar::IndianCalendar(const IndianCalendar& other) : Calendar(other) {

View file

@ -202,7 +202,6 @@ IslamicCalendar* IslamicCalendar::clone() const {
IslamicCalendar::IslamicCalendar(const Locale& aLocale, UErrorCode& success)
: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success)
{
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}
IslamicCalendar::~IslamicCalendar()

View file

@ -115,7 +115,6 @@ JapaneseCalendar::JapaneseCalendar(const Locale& aLocale, UErrorCode& success)
: GregorianCalendar(aLocale, success)
{
init(success);
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}
JapaneseCalendar::~JapaneseCalendar()
@ -130,12 +129,6 @@ JapaneseCalendar::JapaneseCalendar(const JapaneseCalendar& source)
U_ASSERT(U_SUCCESS(status));
}
JapaneseCalendar& JapaneseCalendar::operator= ( const JapaneseCalendar& right)
{
GregorianCalendar::operator=(right);
return *this;
}
JapaneseCalendar* JapaneseCalendar::clone() const
{
return new JapaneseCalendar(*this);

View file

@ -104,13 +104,6 @@ public:
*/
JapaneseCalendar(const JapaneseCalendar& source);
/**
* Default assignment operator
* @param right the object to be copied.
* @internal
*/
JapaneseCalendar& operator=(const JapaneseCalendar& right);
/**
* Create and return a polymorphic copy of this calendar.
* @return return a polymorphic copy of this calendar.

View file

@ -125,7 +125,6 @@ PersianCalendar* PersianCalendar::clone() const {
PersianCalendar::PersianCalendar(const Locale& aLocale, UErrorCode& success)
: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success)
{
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}
PersianCalendar::PersianCalendar(const PersianCalendar& other) : Calendar(other) {

View file

@ -36,7 +36,6 @@ static const int32_t kGregorianEpoch = 1970;
TaiwanCalendar::TaiwanCalendar(const Locale& aLocale, UErrorCode& success)
: GregorianCalendar(aLocale, success)
{
setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
}
TaiwanCalendar::~TaiwanCalendar()
@ -48,12 +47,6 @@ TaiwanCalendar::TaiwanCalendar(const TaiwanCalendar& source)
{
}
TaiwanCalendar& TaiwanCalendar::operator= ( const TaiwanCalendar& right)
{
GregorianCalendar::operator=(right);
return *this;
}
TaiwanCalendar* TaiwanCalendar::clone() const
{
return new TaiwanCalendar(*this);

View file

@ -79,13 +79,6 @@ public:
*/
TaiwanCalendar(const TaiwanCalendar& source);
/**
* Default assignment operator
* @param right the object to be copied.
* @internal
*/
TaiwanCalendar& operator=(const TaiwanCalendar& right);
/**
* Create and return a polymorphic copy of this calendar.
* @return return a polymorphic copy of this calendar.