Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22991 Remove unnecessary overload in Calendar #3317

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions icu4c/source/i18n/buddhcal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions icu4c/source/i18n/buddhcal.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ class BuddhistCalendar : public GregorianCalendar {
*/
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.
Expand Down
8 changes: 0 additions & 8 deletions icu4c/source/i18n/cecal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -65,13 +64,6 @@ CECalendar::~CECalendar()
{
}

CECalendar&
CECalendar::operator=(const CECalendar& right)
{
Calendar::operator=(right);
return *this;
}

//-------------------------------------------------------------------------
// Calendar framework
//-------------------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions icu4c/source/i18n/cecal.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ class U_I18N_API CECalendar : public Calendar {
*/
virtual ~CECalendar();

/**
* Default assignment operator
* @param right Calendar object to be copied
* @internal
*/
CECalendar& operator=(const CECalendar& right);

protected:
//-------------------------------------------------------------------------
// Calendar framework
Expand Down
1 change: 0 additions & 1 deletion icu4c/source/i18n/chnsecal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
47 changes: 10 additions & 37 deletions icu4c/source/i18n/gregocal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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);
}

// -------------------------------------
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
}
Expand All @@ -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);
}

Expand Down
1 change: 0 additions & 1 deletion icu4c/source/i18n/hebrwcal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}


Expand Down
1 change: 0 additions & 1 deletion icu4c/source/i18n/indiancal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion icu4c/source/i18n/islamcal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 0 additions & 7 deletions icu4c/source/i18n/japancal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions icu4c/source/i18n/japancal.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@ class JapaneseCalendar : public GregorianCalendar {
*/
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.
Expand Down
1 change: 0 additions & 1 deletion icu4c/source/i18n/persncal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 0 additions & 7 deletions icu4c/source/i18n/taiwncal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions icu4c/source/i18n/taiwncal.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ class TaiwanCalendar : public GregorianCalendar {
*/
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.
Expand Down