Add missing QChronoTimezonePrivate::clone()

Remove QTimeZonePrivate::clone()'s implementation and declare it = 0,
so we force any future backend implementations to define it. Make the
default copy-constructor QCTP needs for its implementation explicit,
so it won't be deleted. Remove the disabling of copy and move. This
leaves move unmentioned, but the other QTZ backends seem to cope
without.

Amends 755733f5917b1389277b61336f8ca5a03873e446.

Task-number: QTBUG-68812
Change-Id: I390576849c8536e4553b8a903ee11159708e579d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Edward Welbourne 2024-11-01 10:09:03 +01:00 committed by Marc Mutz
parent 7499fd0229
commit 152cb77f83
3 changed files with 8 additions and 7 deletions

View File

@ -130,11 +130,6 @@ QTimeZonePrivate::~QTimeZonePrivate()
{ {
} }
QTimeZonePrivate *QTimeZonePrivate::clone() const
{
return new QTimeZonePrivate(*this);
}
bool QTimeZonePrivate::operator==(const QTimeZonePrivate &other) const bool QTimeZonePrivate::operator==(const QTimeZonePrivate &other) const
{ {
// TODO Too simple, but need to solve problem of comparing different derived classes // TODO Too simple, but need to solve problem of comparing different derived classes

View File

@ -59,6 +59,11 @@ QChronoTimeZonePrivate::QChronoTimeZonePrivate(QByteArrayView id)
m_id.assign(m_timeZone->name()); m_id.assign(m_timeZone->name());
} }
QChronoTimeZonePrivate *QChronoTimeZonePrivate::clone() const
{
return new QChronoTimeZonePrivate(*this);
}
QChronoTimeZonePrivate::~QChronoTimeZonePrivate() QChronoTimeZonePrivate::~QChronoTimeZonePrivate()
= default; = default;

View File

@ -76,7 +76,7 @@ public:
QTimeZonePrivate(const QTimeZonePrivate &other); QTimeZonePrivate(const QTimeZonePrivate &other);
virtual ~QTimeZonePrivate(); virtual ~QTimeZonePrivate();
virtual QTimeZonePrivate *clone() const; virtual QTimeZonePrivate *clone() const = 0;
bool operator==(const QTimeZonePrivate &other) const; bool operator==(const QTimeZonePrivate &other) const;
bool operator!=(const QTimeZonePrivate &other) const; bool operator!=(const QTimeZonePrivate &other) const;
@ -236,10 +236,12 @@ private:
#if QT_CONFIG(timezone_tzdb) #if QT_CONFIG(timezone_tzdb)
class QChronoTimeZonePrivate final : public QTimeZonePrivate class QChronoTimeZonePrivate final : public QTimeZonePrivate
{ {
QChronoTimeZonePrivate(const QChronoTimeZonePrivate &) = default;
public: public:
QChronoTimeZonePrivate(); QChronoTimeZonePrivate();
QChronoTimeZonePrivate(QByteArrayView id); QChronoTimeZonePrivate(QByteArrayView id);
~QChronoTimeZonePrivate() override; ~QChronoTimeZonePrivate() override;
QChronoTimeZonePrivate *clone() const override;
QByteArray systemTimeZoneId() const override; QByteArray systemTimeZoneId() const override;
@ -259,7 +261,6 @@ public:
private: private:
const std::chrono::time_zone *const m_timeZone; const std::chrono::time_zone *const m_timeZone;
Q_DISABLE_COPY_MOVE(QChronoTimeZonePrivate)
}; };
#elif defined(Q_OS_DARWIN) #elif defined(Q_OS_DARWIN)
class Q_AUTOTEST_EXPORT QMacTimeZonePrivate final : public QTimeZonePrivate class Q_AUTOTEST_EXPORT QMacTimeZonePrivate final : public QTimeZonePrivate