diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-07-26 23:10:48 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-07-28 16:53:15 +0200 |
commit | fc78a32507ccaa6c101dca2cc7a4d4061acea94f (patch) | |
tree | bac95a2296bdb8fafde8c28fb811ca97b79bf3de /src/location/places/qplacecontactdetail.cpp | |
parent | e7d9bd86fa81510c5a8f3dcd07d1bd6741173485 (diff) |
Modernize Places value types
Add move semantics, turn comparison operators into hidden friends, add
noexcept. Remove empty special member functions, or set them to default
where they need to be provided.
Pick-to: 6.2
Task-number: QTBUG-105206
Change-Id: I2f6c537a9c840a205a0dd693317ad81221b721a6
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'src/location/places/qplacecontactdetail.cpp')
-rw-r--r-- | src/location/places/qplacecontactdetail.cpp | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/location/places/qplacecontactdetail.cpp b/src/location/places/qplacecontactdetail.cpp index 1c8c2621..7aab34d1 100644 --- a/src/location/places/qplacecontactdetail.cpp +++ b/src/location/places/qplacecontactdetail.cpp @@ -42,12 +42,7 @@ QT_USE_NAMESPACE -QPlaceContactDetailPrivate::QPlaceContactDetailPrivate(const QPlaceContactDetailPrivate &other) - : QSharedData(other), - label(other.label), - value(other.value) -{ -} +QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceContactDetailPrivate) bool QPlaceContactDetailPrivate::operator== (const QPlaceContactDetailPrivate &other) const { @@ -123,23 +118,18 @@ QPlaceContactDetail::QPlaceContactDetail() /*! Destroys the contact detail. */ -QPlaceContactDetail::~QPlaceContactDetail() -{ -} +QPlaceContactDetail::~QPlaceContactDetail() = default; /*! Creates a copy of \a other. */ -QPlaceContactDetail::QPlaceContactDetail(const QPlaceContactDetail &other) - :d_ptr(other.d_ptr) -{ -} +QPlaceContactDetail::QPlaceContactDetail(const QPlaceContactDetail &other) noexcept = default; /*! Assigns \a other to this contact detail and returns a reference to this contact detail. */ -QPlaceContactDetail &QPlaceContactDetail::operator=(const QPlaceContactDetail &other) +QPlaceContactDetail &QPlaceContactDetail::operator=(const QPlaceContactDetail &other) noexcept { if (this == &other) return *this; @@ -149,10 +139,12 @@ QPlaceContactDetail &QPlaceContactDetail::operator=(const QPlaceContactDetail &o } /*! - Returns true if \a other is equal to this contact detail, otherwise - returns false. + \fn bool QPlaceContactDetail::operator==(const QPlaceContactDetail &lhs, const QPlaceContactDetail &rhs) noexcept + + Returns true if the contact detail \a lhs is equal to \a rhs, + otherwise returns false. */ -bool QPlaceContactDetail::operator== (const QPlaceContactDetail &other) const +bool QPlaceContactDetail::isEqual(const QPlaceContactDetail &other) const noexcept { if (d_ptr == other.d_ptr) return true; @@ -160,13 +152,11 @@ bool QPlaceContactDetail::operator== (const QPlaceContactDetail &other) const } /*! - Returns true if \a other is not equal to this contact detail, + \fn bool QPlaceContactDetail::operator!=(const QPlaceContactDetail &lhs, const QPlaceContactDetail &rhs) noexcept + + Returns true if the contact detail \a lhs is not equal to \a rhs, otherwise returns false. */ -bool QPlaceContactDetail::operator!= (const QPlaceContactDetail &other) const -{ - return (!this->operator ==(other)); -} /*! Returns a label describing the contact detail. |