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/qplacesupplier.cpp | |
parent | e7d9bd86fa81510c5a8f3dcd07d1bd6741173485 (diff) | |
download | qtlocation-fc78a32507ccaa6c101dca2cc7a4d4061acea94f.tar.gz |
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/qplacesupplier.cpp')
-rw-r--r-- | src/location/places/qplacesupplier.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/location/places/qplacesupplier.cpp b/src/location/places/qplacesupplier.cpp index e9273fbe..35d976eb 100644 --- a/src/location/places/qplacesupplier.cpp +++ b/src/location/places/qplacesupplier.cpp @@ -42,6 +42,8 @@ QT_USE_NAMESPACE +QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceSupplierPrivate) + QPlaceSupplierPrivate::QPlaceSupplierPrivate() : QSharedData() { } @@ -106,23 +108,18 @@ QPlaceSupplier::QPlaceSupplier() /*! Constructs a copy of \a other. */ -QPlaceSupplier::QPlaceSupplier(const QPlaceSupplier &other) - :d(other.d) -{ -} +QPlaceSupplier::QPlaceSupplier(const QPlaceSupplier &other) noexcept = default; /*! Destroys the supplier object. */ -QPlaceSupplier::~QPlaceSupplier() -{ -} +QPlaceSupplier::~QPlaceSupplier() = default; /*! Assigns \a other to this supplier and returns a reference to this supplier. */ -QPlaceSupplier &QPlaceSupplier::operator=(const QPlaceSupplier &other) +QPlaceSupplier &QPlaceSupplier::operator=(const QPlaceSupplier &other) noexcept { if (this == &other) return *this; @@ -132,21 +129,22 @@ QPlaceSupplier &QPlaceSupplier::operator=(const QPlaceSupplier &other) } /*! - Returns true if this supplier is equal to \a other, - otherwise returns false. + \fn bool QPlaceSupplier::operator==(const QPlaceSupplier &lhs, const QPlaceSupplier &rhs) noexcept + + Returns true if \a lhs is equal to \a rhs, otherwise returns false. */ -bool QPlaceSupplier::operator==(const QPlaceSupplier &other) const -{ - return (*(d.constData()) == *(other.d.constData())); -} /*! - \fn QPlaceSupplier::operator!=(const QPlaceSupplier &other) const + \fn bool QPlaceSupplier::operator!=(const QPlaceSupplier &lhs, const QPlaceSupplier &rhs) noexcept - Returns true if this supplier is not equal to \a other, - otherwise returns false. + Returns true if \a lhs is not equal to \a rhs, otherwise returns false. */ +bool QPlaceSupplier::isEqual(const QPlaceSupplier &other) const noexcept +{ + return (*(d.constData()) == *(other.d.constData())); +} + /*! Returns the name of the supplier which can be displayed to the user. |