QDateTime::Data, QTimeZone: rule-of-five and noexcept
CodeChecker noted that both QDateTime::Data and QTimeZone have incomplete rule-of-five method sets; and two of the former's methods should be noexcept. Marc tells me the copy constructor can be noexcept. Added the missing methods and noexcepts. Change-Id: I8ddaa86207320606a890e90bd2b1593ee82f5a4a Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
02b11e0623
commit
720de98824
@ -2980,7 +2980,7 @@ inline QDateTime::Data::Data(Qt::TimeSpec spec)
|
||||
}
|
||||
}
|
||||
|
||||
inline QDateTime::Data::Data(const Data &other)
|
||||
inline QDateTime::Data::Data(const Data &other) noexcept
|
||||
: d(other.d)
|
||||
{
|
||||
if (!isShort()) {
|
||||
@ -2997,7 +2997,7 @@ inline QDateTime::Data::Data(const Data &other)
|
||||
}
|
||||
}
|
||||
|
||||
inline QDateTime::Data::Data(Data &&other)
|
||||
inline QDateTime::Data::Data(Data &&other) noexcept
|
||||
: d(other.d)
|
||||
{
|
||||
// reset the other to a short state
|
||||
@ -3006,7 +3006,7 @@ inline QDateTime::Data::Data(Data &&other)
|
||||
other.d = dummy.d;
|
||||
}
|
||||
|
||||
inline QDateTime::Data &QDateTime::Data::operator=(const Data &other)
|
||||
inline QDateTime::Data &QDateTime::Data::operator=(const Data &other) noexcept
|
||||
{
|
||||
if (d == other.d)
|
||||
return *this;
|
||||
|
@ -286,9 +286,10 @@ class Q_CORE_EXPORT QDateTime
|
||||
|
||||
Data() noexcept;
|
||||
Data(Qt::TimeSpec);
|
||||
Data(const Data &other);
|
||||
Data(Data &&other);
|
||||
Data &operator=(const Data &other);
|
||||
Data(const Data &other) noexcept;
|
||||
Data(Data &&other) noexcept;
|
||||
Data &operator=(const Data &other) noexcept;
|
||||
Data &operator=(Data &&other) noexcept { swap(other); return *this; }
|
||||
~Data();
|
||||
|
||||
void swap(Data &other) noexcept
|
||||
|
@ -386,6 +386,15 @@ QTimeZone::QTimeZone(const QTimeZone &other)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Move constructor of this from \a other.
|
||||
*/
|
||||
|
||||
QTimeZone::QTimeZone(QTimeZone &&other) noexcept
|
||||
: d(std::move(other.d))
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the time zone.
|
||||
*/
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
const QString &abbreviation, QLocale::Territory territory = QLocale::AnyTerritory,
|
||||
const QString &comment = QString());
|
||||
QTimeZone(const QTimeZone &other);
|
||||
QTimeZone(QTimeZone &&other) noexcept;
|
||||
~QTimeZone();
|
||||
|
||||
QTimeZone &operator=(const QTimeZone &other);
|
||||
|
Loading…
x
Reference in New Issue
Block a user