QTimeZonePrivate: make clone() const, use covariant return types

There's nothing wrong with cloning a const QTimeZonePrivate, so make
clone() const.

Also, if you're cloning a QTzTimeZonePrivate, you already know that
you get a QTzTimeZonePrivate back. C++ supports covariant return types
for this reason, so use them.

Change-Id: I60e19e89b1b7bad080c552f1baca314ab0a6295e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2017-02-22 20:26:48 +01:00
parent 4cd002402f
commit 4d92712a2c
7 changed files with 14 additions and 14 deletions

View File

@ -136,7 +136,7 @@ QTimeZonePrivate::~QTimeZonePrivate()
{
}
QTimeZonePrivate *QTimeZonePrivate::clone()
QTimeZonePrivate *QTimeZonePrivate::clone() const
{
return new QTimeZonePrivate(*this);
}
@ -784,7 +784,7 @@ QUtcTimeZonePrivate::~QUtcTimeZonePrivate()
{
}
QTimeZonePrivate *QUtcTimeZonePrivate::clone()
QUtcTimeZonePrivate *QUtcTimeZonePrivate::clone() const
{
return new QUtcTimeZonePrivate(*this);
}

View File

@ -88,7 +88,7 @@ void QAndroidTimeZonePrivate::init(const QByteArray &ianaId)
m_id = ianaId;
}
QTimeZonePrivate *QAndroidTimeZonePrivate::clone()
QAndroidTimeZonePrivate *QAndroidTimeZonePrivate::clone() const
{
return new QAndroidTimeZonePrivate(*this);
}

View File

@ -305,7 +305,7 @@ QIcuTimeZonePrivate::~QIcuTimeZonePrivate()
ucal_close(m_ucal);
}
QTimeZonePrivate *QIcuTimeZonePrivate::clone()
QIcuTimeZonePrivate *QIcuTimeZonePrivate::clone() const
{
return new QIcuTimeZonePrivate(*this);
}

View File

@ -82,7 +82,7 @@ QMacTimeZonePrivate::~QMacTimeZonePrivate()
[m_nstz release];
}
QTimeZonePrivate *QMacTimeZonePrivate::clone()
QMacTimeZonePrivate *QMacTimeZonePrivate::clone() const
{
return new QMacTimeZonePrivate(*this);
}

View File

@ -92,7 +92,7 @@ public:
QTimeZonePrivate(const QTimeZonePrivate &other);
virtual ~QTimeZonePrivate();
virtual QTimeZonePrivate *clone();
virtual QTimeZonePrivate *clone() const;
bool operator==(const QTimeZonePrivate &other) const;
bool operator!=(const QTimeZonePrivate &other) const;
@ -187,7 +187,7 @@ public:
QUtcTimeZonePrivate(const QUtcTimeZonePrivate &other);
virtual ~QUtcTimeZonePrivate();
QTimeZonePrivate *clone() Q_DECL_OVERRIDE;
QUtcTimeZonePrivate *clone() const override;
Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE;
@ -234,7 +234,7 @@ public:
QIcuTimeZonePrivate(const QIcuTimeZonePrivate &other);
~QIcuTimeZonePrivate();
QTimeZonePrivate *clone() Q_DECL_OVERRIDE;
QIcuTimeZonePrivate *clone() const override;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
const QLocale &locale) const Q_DECL_OVERRIDE;
@ -295,7 +295,7 @@ public:
QTzTimeZonePrivate(const QByteArray &ianaId);
~QTzTimeZonePrivate();
QTimeZonePrivate *clone() Q_DECL_OVERRIDE;
QTzTimeZonePrivate *clone() const override;
QLocale::Country country() const Q_DECL_OVERRIDE;
QString comment() const Q_DECL_OVERRIDE;
@ -351,7 +351,7 @@ public:
QMacTimeZonePrivate(const QMacTimeZonePrivate &other);
~QMacTimeZonePrivate();
QTimeZonePrivate *clone() Q_DECL_OVERRIDE;
QMacTimeZonePrivate *clone() const override;
QString comment() const Q_DECL_OVERRIDE;
@ -404,7 +404,7 @@ public:
QWinTimeZonePrivate(const QWinTimeZonePrivate &other);
~QWinTimeZonePrivate();
QTimeZonePrivate *clone() Q_DECL_OVERRIDE;
QWinTimeZonePrivate *clone() const override;
QString comment() const Q_DECL_OVERRIDE;
@ -454,7 +454,7 @@ public:
QAndroidTimeZonePrivate(const QAndroidTimeZonePrivate &other);
~QAndroidTimeZonePrivate();
QTimeZonePrivate *clone() Q_DECL_OVERRIDE;
QAndroidTimeZonePrivate *clone() const override;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
const QLocale &locale) const Q_DECL_OVERRIDE;

View File

@ -629,7 +629,7 @@ QTzTimeZonePrivate::~QTzTimeZonePrivate()
{
}
QTimeZonePrivate *QTzTimeZonePrivate::clone()
QTzTimeZonePrivate *QTzTimeZonePrivate::clone() const
{
return new QTzTimeZonePrivate(*this);
}

View File

@ -415,7 +415,7 @@ QWinTimeZonePrivate::~QWinTimeZonePrivate()
{
}
QTimeZonePrivate *QWinTimeZonePrivate::clone()
QWinTimeZonePrivate *QWinTimeZonePrivate::clone() const
{
return new QWinTimeZonePrivate(*this);
}