summaryrefslogtreecommitdiff
path: root/src/location
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-26 23:10:48 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-28 16:53:15 +0200
commitfc78a32507ccaa6c101dca2cc7a4d4061acea94f (patch)
treebac95a2296bdb8fafde8c28fb811ca97b79bf3de /src/location
parente7d9bd86fa81510c5a8f3dcd07d1bd6741173485 (diff)
downloadqtlocation-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')
-rw-r--r--src/location/places/qplace.cpp39
-rw-r--r--src/location/places/qplace.h19
-rw-r--r--src/location/places/qplaceattribute.cpp35
-rw-r--r--src/location/places/qplaceattribute.h21
-rw-r--r--src/location/places/qplacecategory.cpp55
-rw-r--r--src/location/places/qplacecategory.h21
-rw-r--r--src/location/places/qplacecategory_p.h7
-rw-r--r--src/location/places/qplacecontactdetail.cpp34
-rw-r--r--src/location/places/qplacecontactdetail.h19
-rw-r--r--src/location/places/qplacecontactdetail_p.h4
-rw-r--r--src/location/places/qplacecontentrequest.cpp31
-rw-r--r--src/location/places/qplacecontentrequest.h19
-rw-r--r--src/location/places/qplaceicon.cpp31
-rw-r--r--src/location/places/qplaceicon.h22
-rw-r--r--src/location/places/qplacematchrequest.cpp34
-rw-r--r--src/location/places/qplacematchrequest.h19
-rw-r--r--src/location/places/qplaceratings.cpp32
-rw-r--r--src/location/places/qplaceratings.h20
-rw-r--r--src/location/places/qplacesearchrequest.cpp33
-rw-r--r--src/location/places/qplacesearchrequest.h22
-rw-r--r--src/location/places/qplacesupplier.cpp32
-rw-r--r--src/location/places/qplacesupplier.h21
-rw-r--r--src/location/places/qplaceuser.cpp26
-rw-r--r--src/location/places/qplaceuser.h19
24 files changed, 316 insertions, 299 deletions
diff --git a/src/location/places/qplace.cpp b/src/location/places/qplace.cpp
index c1776506..1991639d 100644
--- a/src/location/places/qplace.cpp
+++ b/src/location/places/qplace.cpp
@@ -56,6 +56,8 @@ QPlacePrivate *QSharedDataPointer<QPlacePrivate>::clone()
return d->clone();
}
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlacePrivate)
+
/*!
\class QPlace
\inmodule QtLocation
@@ -138,34 +140,22 @@ QPlace::QPlace(const QSharedDataPointer<QPlacePrivate> &dd): d_ptr(dd)
{
}
-/*!
- Returns the d-pointer.
-*/
-QSharedDataPointer<QPlacePrivate> &QPlace::d()
-{
- return d_ptr;
-}
/*!
Constructs a copy of \a other.
*/
-QPlace::QPlace(const QPlace &other)
- : d_ptr(other.d_ptr)
-{
-}
+QPlace::QPlace(const QPlace &other) noexcept = default;
/*!
Destroys this place.
*/
-QPlace::~QPlace()
-{
-}
+QPlace::~QPlace() = default;
/*!
Assigns \a other to this place and returns a reference
to this place.
*/
-QPlace &QPlace::operator= (const QPlace & other)
+QPlace &QPlace::operator= (const QPlace & other) noexcept
{
if (this == &other)
return *this;
@@ -185,22 +175,23 @@ inline const QPlacePrivate *QPlace::d_func() const
}
/*!
- Returns true if \a other is equal to this place,
+ \fn bool QPlace::operator==(const QPlace &lhs, const QPlace &rhs) noexcept
+
+ Returns true if \a lhs is equal to \a rhs,
otherwise returns false.
*/
-bool QPlace::operator== (const QPlace &other) const
-{
- return ( (d_ptr.constData() == other.d_ptr.constData())
- || (*d_ptr) == (*other.d_ptr));
-}
/*!
- Returns true if \a other is not equal to this place,
+ \fn bool QPlace::operator!=(const QPlace &lhs, const QPlace &rhs) noexcept
+
+ Returns true if \a lhs is not equal to \a rhs,
otherwise returns false.
*/
-bool QPlace::operator!= (const QPlace &other) const
+
+bool QPlace::isEqual(const QPlace &other) const noexcept
{
- return !(operator==(other));
+ return ( (d_ptr.constData() == other.d_ptr.constData())
+ || (*d_ptr) == (*other.d_ptr));
}
/*!
diff --git a/src/location/places/qplace.h b/src/location/places/qplace.h
index 60eb825f..9d59d25c 100644
--- a/src/location/places/qplace.h
+++ b/src/location/places/qplace.h
@@ -55,17 +55,25 @@ class QPlaceIcon;
class QPlacePrivate;
class QPlaceRatings;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlacePrivate, Q_LOCATION_EXPORT)
+
class Q_LOCATION_EXPORT QPlace
{
public:
QPlace();
- QPlace(const QPlace &other);
+ QPlace(const QPlace &other) noexcept;
+ QPlace(QPlace &&other) noexcept = default;
~QPlace();
- QPlace &operator=(const QPlace &other);
+ QPlace &operator=(const QPlace &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlace)
+
+ void swap(QPlace &other) noexcept { d_ptr.swap(other.d_ptr); }
- bool operator==(const QPlace &other) const;
- bool operator!=(const QPlace &other) const;
+ friend bool operator==(const QPlace &lhs, const QPlace &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend bool operator!=(const QPlace &lhs, const QPlace &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QList<QPlaceCategory> categories() const;
void setCategory(const QPlaceCategory &category);
@@ -121,11 +129,12 @@ public:
protected:
QPlace(const QSharedDataPointer<QPlacePrivate> &dd);
- QSharedDataPointer<QPlacePrivate> &d();
private:
QSharedDataPointer<QPlacePrivate> d_ptr;
+ bool isEqual(const QPlace &other) const noexcept;
+
inline QPlacePrivate *d_func();
inline const QPlacePrivate *d_func() const;
friend class QDeclarativePlace;
diff --git a/src/location/places/qplaceattribute.cpp b/src/location/places/qplaceattribute.cpp
index 4c9d4dbf..495fcd1c 100644
--- a/src/location/places/qplaceattribute.cpp
+++ b/src/location/places/qplaceattribute.cpp
@@ -42,6 +42,8 @@
QT_USE_NAMESPACE
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceAttributePrivate)
+
template<> QPlaceAttributePrivate *QSharedDataPointer<QPlaceAttributePrivate>::clone()
{
return d->clone();
@@ -148,23 +150,18 @@ QPlaceAttribute::QPlaceAttribute()
/*!
Destroys the attribute.
*/
-QPlaceAttribute::~QPlaceAttribute()
-{
-}
+QPlaceAttribute::~QPlaceAttribute() = default;
/*!
Creates a copy of \a other.
*/
-QPlaceAttribute::QPlaceAttribute(const QPlaceAttribute &other)
- :d_ptr(other.d_ptr)
-{
-}
+QPlaceAttribute::QPlaceAttribute(const QPlaceAttribute &other) noexcept = default;
/*!
Assigns \a other to this attribute and returns a reference to this
attribute.
*/
-QPlaceAttribute &QPlaceAttribute::operator=(const QPlaceAttribute &other)
+QPlaceAttribute &QPlaceAttribute::operator=(const QPlaceAttribute &other) noexcept
{
if (this == &other)
return *this;
@@ -174,25 +171,27 @@ QPlaceAttribute &QPlaceAttribute::operator=(const QPlaceAttribute &other)
}
/*!
- Returns true if \a other is equal to this attribute, otherwise
+ \fn bool QPlaceAttribute::operator==(const QPlaceAttribute &lhs, const QPlaceAttribute &rhs) noexcept
+
+ Returns true if \a lhs is equal to \a rhs, otherwise
returns false.
*/
-bool QPlaceAttribute::operator== (const QPlaceAttribute &other) const
-{
- if (d_ptr == other.d_ptr)
- return true;
- return ( *(d_ptr.constData()) == *(other.d_ptr.constData()));
-}
/*!
- Returns true if \a other is not equal to this attribute,
+ \fn bool QPlaceAttribute::operator!=(const QPlaceAttribute &lhs, const QPlaceAttribute &rhs) noexcept
+
+ Returns true if \a lhs is not equal to \a rhs,
otherwise returns false.
*/
-bool QPlaceAttribute::operator!= (const QPlaceAttribute &other) const
+
+bool QPlaceAttribute::isEqual(const QPlaceAttribute &other) const noexcept
{
- return (!this->operator ==(other));
+ if (d_ptr == other.d_ptr)
+ return true;
+ return ( *(d_ptr.constData()) == *(other.d_ptr.constData()));
}
+
/*!
Returns a localized label describing the attribute.
*/
diff --git a/src/location/places/qplaceattribute.h b/src/location/places/qplaceattribute.h
index d6f68ed2..4c5e2c97 100644
--- a/src/location/places/qplaceattribute.h
+++ b/src/location/places/qplaceattribute.h
@@ -49,6 +49,8 @@
QT_BEGIN_NAMESPACE
class QPlaceAttributePrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceAttributePrivate, Q_LOCATION_EXPORT)
+
class Q_LOCATION_EXPORT QPlaceAttribute
{
public:
@@ -57,13 +59,19 @@ public:
static const QString Provider;
QPlaceAttribute();
- QPlaceAttribute(const QPlaceAttribute &other);
- virtual ~QPlaceAttribute();
+ QPlaceAttribute(const QPlaceAttribute &other) noexcept;
+ QPlaceAttribute(QPlaceAttribute &&other) noexcept = default;
+ ~QPlaceAttribute();
+
+ QPlaceAttribute &operator=(const QPlaceAttribute &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceAttribute)
- QPlaceAttribute &operator=(const QPlaceAttribute &other);
+ void swap(QPlaceAttribute &other) noexcept { d_ptr.swap(other.d_ptr); }
- bool operator==(const QPlaceAttribute &other) const;
- bool operator!=(const QPlaceAttribute &other) const;
+ friend inline bool operator==(const QPlaceAttribute &lhs, const QPlaceAttribute &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceAttribute &lhs, const QPlaceAttribute &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QString label() const;
void setLabel(const QString &label);
@@ -73,8 +81,9 @@ public:
bool isEmpty() const;
-protected:
+private:
QSharedDataPointer<QPlaceAttributePrivate> d_ptr;
+ bool isEqual(const QPlaceAttribute &other) const noexcept;
};
QT_END_NAMESPACE
diff --git a/src/location/places/qplacecategory.cpp b/src/location/places/qplacecategory.cpp
index 0e6100dc..16a8afc7 100644
--- a/src/location/places/qplacecategory.cpp
+++ b/src/location/places/qplacecategory.cpp
@@ -42,31 +42,8 @@
QT_BEGIN_NAMESPACE
-QPlaceCategoryPrivate::QPlaceCategoryPrivate()
-: visibility(QLocation::UnspecifiedVisibility)
-{
-}
-
-QPlaceCategoryPrivate::QPlaceCategoryPrivate(const QPlaceCategoryPrivate &other)
-: QSharedData(other), categoryId(other.categoryId), name(other.name), visibility(other.visibility),
- icon(other.icon)
-{
-}
-
-QPlaceCategoryPrivate::~QPlaceCategoryPrivate()
-{
-}
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceCategoryPrivate)
-QPlaceCategoryPrivate &QPlaceCategoryPrivate::operator=(const QPlaceCategoryPrivate &other)
-{
- if (this == &other)
- return *this;
-
- categoryId = other.categoryId;
- name = other.name;
- icon = other.icon;
- return *this;
-}
bool QPlaceCategoryPrivate::isEmpty() const
{
@@ -95,12 +72,6 @@ bool QPlaceCategoryPrivate::isEmpty() const
*/
/*!
- \fn bool QPlaceCategory::operator!=(const QPlaceCategory &other) const
-
- Returns true if \a other is not equal to this category; otherwise returns false.
-*/
-
-/*!
Constructs a category.
*/
QPlaceCategory::QPlaceCategory()
@@ -111,22 +82,17 @@ QPlaceCategory::QPlaceCategory()
/*!
Constructs a category which is a copy of \a other.
*/
-QPlaceCategory::QPlaceCategory(const QPlaceCategory &other)
- :d(other.d)
-{
-}
+QPlaceCategory::QPlaceCategory(const QPlaceCategory &other) noexcept = default;
/*!
Destroys the category.
*/
-QPlaceCategory::~QPlaceCategory()
-{
-}
+QPlaceCategory::~QPlaceCategory() = default;
/*!
Assigns \a other to this category and returns a reference to this category.
*/
-QPlaceCategory &QPlaceCategory::operator =(const QPlaceCategory &other)
+QPlaceCategory &QPlaceCategory::operator=(const QPlaceCategory &other) noexcept
{
if (this == &other)
return *this;
@@ -136,9 +102,18 @@ QPlaceCategory &QPlaceCategory::operator =(const QPlaceCategory &other)
}
/*!
- Returns true if \a other is equal to this category; otherwise returns false.
+ \fn bool QPlaceCategory::operator==(const QPlaceCategory &lhs, const QPlaceCategory &rhs) noexcept
+
+ Returns true if \a lhs is equal to \a rhs; otherwise returns false.
*/
-bool QPlaceCategory::operator==(const QPlaceCategory &other) const
+
+/*!
+ \fn bool QPlaceCategory::operator!=(const QPlaceCategory &lhs, const QPlaceCategory &rhs) noexcept
+
+ Returns true if \a lhs is not equal to \a rhs; otherwise returns false.
+*/
+
+bool QPlaceCategory::isEqual(const QPlaceCategory &other) const noexcept
{
return d->categoryId == other.d->categoryId &&
d->name == other.d->name &&
diff --git a/src/location/places/qplacecategory.h b/src/location/places/qplacecategory.h
index 780b20c8..78e4482b 100644
--- a/src/location/places/qplacecategory.h
+++ b/src/location/places/qplacecategory.h
@@ -52,20 +52,25 @@ QT_BEGIN_NAMESPACE
class QPlaceIcon;
class QPlaceCategoryPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceCategoryPrivate, Q_LOCATION_EXPORT)
+
class Q_LOCATION_EXPORT QPlaceCategory
{
public:
QPlaceCategory();
- QPlaceCategory(const QPlaceCategory &other);
+ QPlaceCategory(const QPlaceCategory &other) noexcept;
+ QPlaceCategory(QPlaceCategory &&other) noexcept = default;
+ ~QPlaceCategory();
- virtual ~QPlaceCategory();
+ QPlaceCategory &operator=(const QPlaceCategory &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceCategory)
- QPlaceCategory &operator=(const QPlaceCategory &other);
+ void swap(QPlaceCategory &other) noexcept { d.swap(other.d); }
- bool operator==(const QPlaceCategory &other) const;
- bool operator!=(const QPlaceCategory &other) const {
- return !(other == *this);
- }
+ friend inline bool operator==(const QPlaceCategory &lhs, const QPlaceCategory &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceCategory &lhs, const QPlaceCategory &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QString categoryId() const;
void setCategoryId(const QString &identifier);
@@ -83,6 +88,8 @@ public:
private:
QSharedDataPointer<QPlaceCategoryPrivate> d;
+
+ bool isEqual(const QPlaceCategory &other) const noexcept;
};
Q_DECLARE_TYPEINFO(QPlaceCategory, Q_RELOCATABLE_TYPE);
diff --git a/src/location/places/qplacecategory_p.h b/src/location/places/qplacecategory_p.h
index f5cee9f8..d7388846 100644
--- a/src/location/places/qplacecategory_p.h
+++ b/src/location/places/qplacecategory_p.h
@@ -63,17 +63,12 @@ QT_BEGIN_NAMESPACE
class QPlaceCategoryPrivate : public QSharedData
{
public:
- QPlaceCategoryPrivate();
- QPlaceCategoryPrivate(const QPlaceCategoryPrivate &other);
-
- ~QPlaceCategoryPrivate();
- QPlaceCategoryPrivate &operator= (const QPlaceCategoryPrivate &other);
bool operator==(const QPlaceCategoryPrivate &other) const;
bool isEmpty() const;
QString categoryId;
QString name;
- QLocation::Visibility visibility;
+ QLocation::Visibility visibility = QLocation::UnspecifiedVisibility;
QPlaceIcon icon;
};
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.
diff --git a/src/location/places/qplacecontactdetail.h b/src/location/places/qplacecontactdetail.h
index 52603aff..62d8f95e 100644
--- a/src/location/places/qplacecontactdetail.h
+++ b/src/location/places/qplacecontactdetail.h
@@ -49,6 +49,8 @@
QT_BEGIN_NAMESPACE
class QPlaceContactDetailPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceContactDetailPrivate, Q_LOCATION_EXPORT)
+
class Q_LOCATION_EXPORT QPlaceContactDetail
{
public:
@@ -58,13 +60,19 @@ public:
static const QString Fax;
QPlaceContactDetail();
- QPlaceContactDetail(const QPlaceContactDetail &other);
- virtual ~QPlaceContactDetail();
+ QPlaceContactDetail(const QPlaceContactDetail &other) noexcept;
+ QPlaceContactDetail(QPlaceContactDetail &&other) noexcept = default;
+ ~QPlaceContactDetail();
+
+ QPlaceContactDetail &operator=(const QPlaceContactDetail &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceContactDetail)
- QPlaceContactDetail &operator=(const QPlaceContactDetail &other);
+ void swap(QPlaceContactDetail &other) noexcept { d_ptr.swap(other.d_ptr); }
- bool operator==(const QPlaceContactDetail &other) const;
- bool operator!=(const QPlaceContactDetail &other) const;
+ friend inline bool operator==(const QPlaceContactDetail &lhs, const QPlaceContactDetail &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceContactDetail &lhs, const QPlaceContactDetail &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QString label() const;
void setLabel(const QString &label);
@@ -77,6 +85,7 @@ public:
private:
QSharedDataPointer<QPlaceContactDetailPrivate> d_ptr;
+ bool isEqual(const QPlaceContactDetail &other) const noexcept;
};
QT_END_NAMESPACE
diff --git a/src/location/places/qplacecontactdetail_p.h b/src/location/places/qplacecontactdetail_p.h
index 5e9aa786..cdb93bb0 100644
--- a/src/location/places/qplacecontactdetail_p.h
+++ b/src/location/places/qplacecontactdetail_p.h
@@ -61,10 +61,6 @@ QT_BEGIN_NAMESPACE
class QPlaceContactDetailPrivate : public QSharedData
{
public:
- QPlaceContactDetailPrivate(){}
- QPlaceContactDetailPrivate(const QPlaceContactDetailPrivate &other);
- virtual ~QPlaceContactDetailPrivate(){}
-
bool operator== (const QPlaceContactDetailPrivate &other) const;
QString label;
diff --git a/src/location/places/qplacecontentrequest.cpp b/src/location/places/qplacecontentrequest.cpp
index 15282b35..d0ce72a5 100644
--- a/src/location/places/qplacecontentrequest.cpp
+++ b/src/location/places/qplacecontentrequest.cpp
@@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceContentRequestPrivate)
+
QPlaceContentRequestPrivate::QPlaceContentRequestPrivate()
: QSharedData(), contentType(QPlaceContent::NoType), limit(-1)
{
@@ -102,23 +104,18 @@ QPlaceContentRequest::QPlaceContentRequest()
/*!
Constructs a copy of \a other.
*/
-QPlaceContentRequest::QPlaceContentRequest(const QPlaceContentRequest &other)
- : d_ptr(other.d_ptr)
-{
-}
+QPlaceContentRequest::QPlaceContentRequest(const QPlaceContentRequest &other) noexcept = default;
/*!
Destroys the request object
*/
-QPlaceContentRequest::~QPlaceContentRequest()
-{
-}
+QPlaceContentRequest::~QPlaceContentRequest() = default;
/*!
Assigns \a other to this content request and returns a reference
to this content request.
*/
-QPlaceContentRequest &QPlaceContentRequest::operator= (const QPlaceContentRequest & other)
+QPlaceContentRequest &QPlaceContentRequest::operator=(const QPlaceContentRequest & other) noexcept
{
if (this == &other)
return *this;
@@ -128,23 +125,19 @@ QPlaceContentRequest &QPlaceContentRequest::operator= (const QPlaceContentReques
}
/*!
- Returns true if \a other is equal to this content request,
- otherwise returns false.
+ \fn bool QPlaceContentRequest::operator==(const QPlaceContentRequest &lhs, const QPlaceContentRequest &rhs) noexcept
+ Returns true if \a lhs is equal to \a rhs, otherwise returns false.
*/
-bool QPlaceContentRequest::operator== (const QPlaceContentRequest &other) const
-{
- Q_D(const QPlaceContentRequest);
- return *d == *other.d_func();
-}
/*!
- Returns true if \a other is not equal to this content request,
- otherwise returns false.
+ \fn bool QPlaceContentRequest::operator!=(const QPlaceContentRequest &lhs, const QPlaceContentRequest &rhs) noexcept
+ Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
*/
-bool QPlaceContentRequest::operator!= (const QPlaceContentRequest &other) const
+
+bool QPlaceContentRequest::isEqual(const QPlaceContentRequest &other) const noexcept
{
Q_D(const QPlaceContentRequest);
- return !(*d == *other.d_func());
+ return *d == *other.d_func();
}
/*!
diff --git a/src/location/places/qplacecontentrequest.h b/src/location/places/qplacecontentrequest.h
index 028ca04d..2afb2665 100644
--- a/src/location/places/qplacecontentrequest.h
+++ b/src/location/places/qplacecontentrequest.h
@@ -47,18 +47,27 @@
QT_BEGIN_NAMESPACE
class QPlaceContentRequestPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceContentRequestPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QPlaceContentRequest
{
public:
QPlaceContentRequest();
- QPlaceContentRequest(const QPlaceContentRequest &other);
+ QPlaceContentRequest(const QPlaceContentRequest &other) noexcept;
+ QPlaceContentRequest(QPlaceContentRequest &&other) noexcept = default;
~QPlaceContentRequest();
- QPlaceContentRequest &operator=(const QPlaceContentRequest &other);
+ QPlaceContentRequest &operator=(const QPlaceContentRequest &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceContentRequest)
- bool operator==(const QPlaceContentRequest &other) const;
- bool operator!=(const QPlaceContentRequest &other) const;
+ void swap(QPlaceContentRequest &other) noexcept { d_ptr.swap(other.d_ptr); }
+
+ friend inline bool operator==(const QPlaceContentRequest &lhs,
+ const QPlaceContentRequest &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceContentRequest &lhs,
+ const QPlaceContentRequest &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QPlaceContent::Type contentType() const;
void setContentType(QPlaceContent::Type type);
@@ -76,6 +85,8 @@ public:
private:
QSharedDataPointer<QPlaceContentRequestPrivate> d_ptr;
+ bool isEqual(const QPlaceContentRequest &other) const noexcept;
+
inline QPlaceContentRequestPrivate *d_func();
inline const QPlaceContentRequestPrivate *d_func() const;
};
diff --git a/src/location/places/qplaceicon.cpp b/src/location/places/qplaceicon.cpp
index 755d2521..e58b6d7c 100644
--- a/src/location/places/qplaceicon.cpp
+++ b/src/location/places/qplaceicon.cpp
@@ -46,6 +46,8 @@
QT_USE_NAMESPACE
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceIconPrivate)
+
QPlaceIconPrivate::QPlaceIconPrivate()
: QSharedData(), manager(0)
{
@@ -127,22 +129,17 @@ QPlaceIcon::QPlaceIcon()
/*!
Constructs a copy of \a other.
*/
-QPlaceIcon::QPlaceIcon(const QPlaceIcon &other)
- : d(other.d)
-{
-}
+QPlaceIcon::QPlaceIcon(const QPlaceIcon &other) noexcept = default;
/*!
Destroys the icon.
*/
-QPlaceIcon::~QPlaceIcon()
-{
-}
+QPlaceIcon::~QPlaceIcon() = default;
/*!
Assigns \a other to this icon and returns a reference to this icon.
*/
-QPlaceIcon &QPlaceIcon::operator=(const QPlaceIcon &other)
+QPlaceIcon &QPlaceIcon::operator=(const QPlaceIcon &other) noexcept
{
if (this == &other)
return *this;
@@ -152,19 +149,23 @@ QPlaceIcon &QPlaceIcon::operator=(const QPlaceIcon &other)
}
/*!
- Returns true if this icon is equal to \a other, otherwise returns false.
+ \fn bool QPlaceIcon::operator==(const QPlaceIcon &lhs, const QPlaceIcon &rhs) noexcept
+
+ Returns true if \a lhs is equal to \a rhs, otherwise returns false.
*/
-bool QPlaceIcon::operator==(const QPlaceIcon &other) const
-{
- return *d == *(other.d);
-}
/*!
- \fn QPlaceIcon::operator!=(const QPlaceIcon &other) const
+ \fn bool QPlaceIcon::operator!=(const QPlaceIcon &lhs, const QPlaceIcon &rhs) noexcept
- Returns true if \a other is not equal to this icon, otherwise returns false.
+ Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
*/
+bool QPlaceIcon::isEqual(const QPlaceIcon &other) const noexcept
+{
+ return *d == *(other.d);
+}
+
+
/*!
Returns an icon URL according to the given \a size.
diff --git a/src/location/places/qplaceicon.h b/src/location/places/qplaceicon.h
index c9fe152b..cacd4d19 100644
--- a/src/location/places/qplaceicon.h
+++ b/src/location/places/qplaceicon.h
@@ -51,21 +51,27 @@ QT_BEGIN_NAMESPACE
class QUrl;
class QPlaceManager;
class QPlaceIconPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceIconPrivate, Q_LOCATION_EXPORT)
+
class Q_LOCATION_EXPORT QPlaceIcon
{
public:
static const QString SingleUrl;
QPlaceIcon();
- QPlaceIcon(const QPlaceIcon &other);
-
+ QPlaceIcon(const QPlaceIcon &other) noexcept;
+ QPlaceIcon(QPlaceIcon &&other) noexcept = default;
~QPlaceIcon();
- QPlaceIcon &operator=(const QPlaceIcon &other);
- bool operator == (const QPlaceIcon &other) const;
- bool operator != (const QPlaceIcon &other) const {
- return !(*this == other);
- }
+ QPlaceIcon &operator=(const QPlaceIcon &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceIcon)
+
+ void swap(QPlaceIcon &other) noexcept { d.swap(other.d); }
+
+ friend inline bool operator==(const QPlaceIcon &lhs, const QPlaceIcon &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceIcon &lhs, const QPlaceIcon &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QUrl url(const QSize &size = QSize()) const;
@@ -79,6 +85,8 @@ public:
private:
QSharedDataPointer<QPlaceIconPrivate> d;
+
+ bool isEqual(const QPlaceIcon &other) const noexcept;
};
QT_END_NAMESPACE
diff --git a/src/location/places/qplacematchrequest.cpp b/src/location/places/qplacematchrequest.cpp
index 5b2811b2..486ff16b 100644
--- a/src/location/places/qplacematchrequest.cpp
+++ b/src/location/places/qplacematchrequest.cpp
@@ -62,6 +62,8 @@ public:
QVariantMap parameters;
};
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceMatchRequestPrivate)
+
QPlaceMatchRequestPrivate::QPlaceMatchRequestPrivate()
: QSharedData()
{
@@ -138,23 +140,18 @@ QPlaceMatchRequest::QPlaceMatchRequest()
/*!
Constructs a copy of \a other.
*/
-QPlaceMatchRequest::QPlaceMatchRequest(const QPlaceMatchRequest &other)
- : d_ptr(other.d_ptr)
-{
-}
+QPlaceMatchRequest::QPlaceMatchRequest(const QPlaceMatchRequest &other) noexcept = default;
/*!
Destroys the request object.
*/
-QPlaceMatchRequest::~QPlaceMatchRequest()
-{
-}
+QPlaceMatchRequest::~QPlaceMatchRequest() = default;
/*!
Assigns \a other to this search request and returns a reference
to this match request.
*/
-QPlaceMatchRequest &QPlaceMatchRequest::operator= (const QPlaceMatchRequest & other)
+QPlaceMatchRequest &QPlaceMatchRequest::operator=(const QPlaceMatchRequest & other) noexcept
{
if (this == &other)
return *this;
@@ -163,26 +160,25 @@ QPlaceMatchRequest &QPlaceMatchRequest::operator= (const QPlaceMatchRequest & ot
}
/*!
- Returns true if \a other is equal to this match request,
- otherwise returns false.
+ \fn bool QPlaceMatchRequest::operator==(const QPlaceMatchRequest &lhs, const QPlaceMatchRequest &rhs) noexcept
+
+ Returns true if \a lhs is equal to \a rhs, otherwise returns false.
*/
-bool QPlaceMatchRequest::operator== (const QPlaceMatchRequest &other) const
-{
- Q_D(const QPlaceMatchRequest);
- return *d == *other.d_func();
-}
/*!
- Returns true if \a other is not equal to this match request,
- otherwise returns false.
+ \fn bool QPlaceMatchRequest::operator!=(const QPlaceMatchRequest &lhs, const QPlaceMatchRequest &rhs) noexcept
+
+ Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
*/
-bool QPlaceMatchRequest::operator!= (const QPlaceMatchRequest &other) const
+
+bool QPlaceMatchRequest::isEqual(const QPlaceMatchRequest &other) const noexcept
{
Q_D(const QPlaceMatchRequest);
- return !(*d == *other.d_func());
+ return *d == *other.d_func();
}
+
/*!
Returns a list of places which are to be matched.
*/
diff --git a/src/location/places/qplacematchrequest.h b/src/location/places/qplacematchrequest.h
index 42e6a78f..91aaaadd 100644
--- a/src/location/places/qplacematchrequest.h
+++ b/src/location/places/qplacematchrequest.h
@@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
class QPlace;
class QPlaceSearchResult;
class QPlaceMatchRequestPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceMatchRequestPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QPlaceMatchRequest
{
@@ -55,15 +56,19 @@ public:
static const QString AlternativeId;
QPlaceMatchRequest();
- QPlaceMatchRequest(const QPlaceMatchRequest &other);
-
+ QPlaceMatchRequest(const QPlaceMatchRequest &other) noexcept;
+ QPlaceMatchRequest(QPlaceMatchRequest &&other) noexcept = default;
+ ~QPlaceMatchRequest();
- QPlaceMatchRequest &operator=(const QPlaceMatchRequest &other);
+ QPlaceMatchRequest &operator=(const QPlaceMatchRequest &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceMatchRequest)
- bool operator==(const QPlaceMatchRequest &other) const;
- bool operator!=(const QPlaceMatchRequest &other) const;
+ void swap(QPlaceMatchRequest &other) noexcept { d_ptr.swap(other.d_ptr); }
- ~QPlaceMatchRequest();
+ friend inline bool operator==(const QPlaceMatchRequest &lhs, const QPlaceMatchRequest &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceMatchRequest &lhs, const QPlaceMatchRequest &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QList<QPlace> places() const;
void setPlaces(const QList<QPlace> places);
@@ -77,6 +82,8 @@ public:
private:
QSharedDataPointer<QPlaceMatchRequestPrivate> d_ptr;
+
+ bool isEqual(const QPlaceMatchRequest &other) const noexcept;
inline QPlaceMatchRequestPrivate *d_func();
inline const QPlaceMatchRequestPrivate *d_func() const;
};
diff --git a/src/location/places/qplaceratings.cpp b/src/location/places/qplaceratings.cpp
index f30928d3..b47b19c1 100644
--- a/src/location/places/qplaceratings.cpp
+++ b/src/location/places/qplaceratings.cpp
@@ -42,6 +42,8 @@
QT_USE_NAMESPACE
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceRatingsPrivate)
+
QPlaceRatingsPrivate::QPlaceRatingsPrivate()
: QSharedData(), average(0), maximum(0), count(0)
{
@@ -94,23 +96,18 @@ QPlaceRatings::QPlaceRatings()
/*!
Constructs a copy of \a other.
*/
-QPlaceRatings::QPlaceRatings(const QPlaceRatings &other)
- :d(other.d)
-{
-}
+QPlaceRatings::QPlaceRatings(const QPlaceRatings &other) noexcept = default;
/*!
Destroys the ratings object.
*/
-QPlaceRatings::~QPlaceRatings()
-{
-}
+QPlaceRatings::~QPlaceRatings() = default;
/*!
Assigns \a other to this ratings object and returns
a reference to this ratings object.
*/
-QPlaceRatings &QPlaceRatings::operator=(const QPlaceRatings &other)
+QPlaceRatings &QPlaceRatings::operator=(const QPlaceRatings &other) noexcept
{
if (this == &other)
return *this;
@@ -120,21 +117,22 @@ QPlaceRatings &QPlaceRatings::operator=(const QPlaceRatings &other)
}
/*!
- Returns true if \a other is equal to this ratings object,
- otherwise returns false.
+ \fn bool QPlaceRatings::operator==(const QPlaceRatings &lhs, const QPlaceRatings &rhs) noexcept
+
+ Returns true if \a lhs is equal to \a rhs, otherwise returns false.
*/
-bool QPlaceRatings::operator==(const QPlaceRatings &other) const
-{
- return (*(d.constData()) == *(other.d.constData()));
-}
/*!
- \fn bool QPlaceRatings::operator!=(const QPlaceRatings &other) const
+ \fn bool QPlaceRatings::operator!=(const QPlaceRatings &lhs, const QPlaceRatings &rhs) noexcept
- Returns true if \a other is not equal to this ratings object,
- otherwise returns false.
+ Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
*/
+bool QPlaceRatings::isEqual(const QPlaceRatings &other) const noexcept
+{
+ return (*(d.constData()) == *(other.d.constData()));
+}
+
/*!
Returns the average value of individual ratings.
*/
diff --git a/src/location/places/qplaceratings.h b/src/location/places/qplaceratings.h
index c52e91a0..d506aa20 100644
--- a/src/location/places/qplaceratings.h
+++ b/src/location/places/qplaceratings.h
@@ -47,21 +47,25 @@
QT_BEGIN_NAMESPACE
class QPlaceRatingsPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceRatingsPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QPlaceRatings
{
public:
QPlaceRatings();
- QPlaceRatings(const QPlaceRatings &other);
-
+ QPlaceRatings(const QPlaceRatings &other) noexcept;
+ QPlaceRatings(QPlaceRatings &&other) noexcept = default;
~QPlaceRatings();
- QPlaceRatings &operator=(const QPlaceRatings &other);
+ QPlaceRatings &operator=(const QPlaceRatings &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceRatings)
+
+ void swap(QPlaceRatings &other) noexcept { d.swap(other.d); }
- bool operator==(const QPlaceRatings &other) const;
- bool operator!=(const QPlaceRatings &other) const {
- return !(other == *this);
- }
+ friend inline bool operator==(const QPlaceRatings &lhs, const QPlaceRatings &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceRatings &lhs, const QPlaceRatings &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
qreal average() const;
void setAverage(qreal average);
@@ -76,6 +80,8 @@ public:
private:
QSharedDataPointer<QPlaceRatingsPrivate> d;
+
+ bool isEqual(const QPlaceRatings &other) const noexcept;
};
QT_END_NAMESPACE
diff --git a/src/location/places/qplacesearchrequest.cpp b/src/location/places/qplacesearchrequest.cpp
index 324fa6e9..06d7268e 100644
--- a/src/location/places/qplacesearchrequest.cpp
+++ b/src/location/places/qplacesearchrequest.cpp
@@ -51,6 +51,8 @@
QT_BEGIN_NAMESPACE
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceSearchRequestPrivate)
+
QPlaceSearchRequestPrivate::QPlaceSearchRequestPrivate()
: QSharedData(),
visibilityScope(QLocation::UnspecifiedVisibility),
@@ -188,23 +190,18 @@ QPlaceSearchRequest::QPlaceSearchRequest()
/*!
Constructs a copy of \a other.
*/
-QPlaceSearchRequest::QPlaceSearchRequest(const QPlaceSearchRequest &other)
- : d_ptr(other.d_ptr)
-{
-}
+QPlaceSearchRequest::QPlaceSearchRequest(const QPlaceSearchRequest &other) noexcept = default;
/*!
Destroys the request object.
*/
-QPlaceSearchRequest::~QPlaceSearchRequest()
-{
-}
+QPlaceSearchRequest::~QPlaceSearchRequest() = default;
/*!
Assigns \a other to this search request and returns a reference
to this search request.
*/
-QPlaceSearchRequest &QPlaceSearchRequest::operator= (const QPlaceSearchRequest & other)
+QPlaceSearchRequest &QPlaceSearchRequest::operator=(const QPlaceSearchRequest & other) noexcept
{
if (this == &other)
return *this;
@@ -214,23 +211,21 @@ QPlaceSearchRequest &QPlaceSearchRequest::operator= (const QPlaceSearchRequest &
}
/*!
- Returns true if \a other is equal to this search request,
- otherwise returns false.
+ \fn bool QPlaceSearchRequest::operator==(const QPlaceSearchRequest &lhs, const QPlaceSearchRequest &rhs) noexcept
+
+ Returns true if \a lhs is equal to \a rhs, otherwise returns false.
*/
-bool QPlaceSearchRequest::operator== (const QPlaceSearchRequest &other) const
-{
- Q_D(const QPlaceSearchRequest);
- return *d == *other.d_func();
-}
/*!
- Returns true if \a other is not equal to this search request,
- otherwise returns false.
+ \fn bool QPlaceSearchRequest::operator!=(const QPlaceSearchRequest &lhs, const QPlaceSearchRequest &rhs) noexcept
+
+ Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
*/
-bool QPlaceSearchRequest::operator!= (const QPlaceSearchRequest &other) const
+
+bool QPlaceSearchRequest::isEqual(const QPlaceSearchRequest &other) const noexcept
{
Q_D(const QPlaceSearchRequest);
- return !(*d == *other.d_func());
+ return *d == *other.d_func();
}
/*!
diff --git a/src/location/places/qplacesearchrequest.h b/src/location/places/qplacesearchrequest.h
index 4370d5ed..04505e18 100644
--- a/src/location/places/qplacesearchrequest.h
+++ b/src/location/places/qplacesearchrequest.h
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
class QGeoShape;
class QPlaceCategory;
class QPlaceSearchRequestPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceSearchRequestPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QPlaceSearchRequest
{
@@ -60,15 +61,21 @@ public:
};
QPlaceSearchRequest();
- QPlaceSearchRequest(const QPlaceSearchRequest &other);
-
+ QPlaceSearchRequest(const QPlaceSearchRequest &other) noexcept;
+ QPlaceSearchRequest(QPlaceSearchRequest &&other) noexcept = default;
+ ~QPlaceSearchRequest();
- QPlaceSearchRequest &operator=(const QPlaceSearchRequest &other);
+ QPlaceSearchRequest &operator=(const QPlaceSearchRequest &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceSearchRequest)
- bool operator==(const QPlaceSearchRequest &other) const;
- bool operator!=(const QPlaceSearchRequest &other) const;
+ void swap(QPlaceSearchRequest &other) noexcept { d_ptr.swap(other.d_ptr); }
- ~QPlaceSearchRequest();
+ friend inline bool operator==(const QPlaceSearchRequest &lhs,
+ const QPlaceSearchRequest &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceSearchRequest &lhs,
+ const QPlaceSearchRequest &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QString searchTerm() const;
void setSearchTerm(const QString &term);
@@ -99,6 +106,9 @@ public:
private:
QSharedDataPointer<QPlaceSearchRequestPrivate> d_ptr;
+
+ bool isEqual(const QPlaceSearchRequest &other) const noexcept;
+
inline QPlaceSearchRequestPrivate *d_func();
inline const QPlaceSearchRequestPrivate *d_func() const;
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.
diff --git a/src/location/places/qplacesupplier.h b/src/location/places/qplacesupplier.h
index eff7ee1c..70a6143a 100644
--- a/src/location/places/qplacesupplier.h
+++ b/src/location/places/qplacesupplier.h
@@ -49,20 +49,27 @@ QT_BEGIN_NAMESPACE
class QUrl;
class QPlaceIcon;
class QPlaceSupplierPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceSupplierPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QPlaceSupplier
{
public:
QPlaceSupplier();
- QPlaceSupplier(const QPlaceSupplier &other);
+ QPlaceSupplier(const QPlaceSupplier &other) noexcept;
+ QPlaceSupplier(QPlaceSupplier &&other) noexcept = default;
~QPlaceSupplier();
- QPlaceSupplier &operator=(const QPlaceSupplier &other);
+ QPlaceSupplier &operator=(const QPlaceSupplier &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceSupplier)
- bool operator==(const QPlaceSupplier &other) const;
- bool operator!=(const QPlaceSupplier &other) const {
- return !(other == *this);
- }
+ void swap(QPlaceSupplier &other) noexcept { d.swap(other.d); }
+
+ friend inline bool operator==(const QPlaceSupplier &lhs,
+ const QPlaceSupplier &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceSupplier &lhs,
+ const QPlaceSupplier &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QString name() const;
void setName(const QString &data);
@@ -80,6 +87,8 @@ public:
private:
QSharedDataPointer<QPlaceSupplierPrivate> d;
+
+ bool isEqual(const QPlaceSupplier &other) const noexcept;
};
QT_END_NAMESPACE
diff --git a/src/location/places/qplaceuser.cpp b/src/location/places/qplaceuser.cpp
index 11684f8f..de2e82a6 100644
--- a/src/location/places/qplaceuser.cpp
+++ b/src/location/places/qplaceuser.cpp
@@ -42,6 +42,8 @@
QT_USE_NAMESPACE
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceUserPrivate)
+
QPlaceUserPrivate::QPlaceUserPrivate()
: QSharedData()
{
@@ -82,22 +84,17 @@ QPlaceUser::QPlaceUser()
/*!
Constructs a copy of \a other.
*/
-QPlaceUser::QPlaceUser(const QPlaceUser &other)
- :d(other.d)
-{
-}
+QPlaceUser::QPlaceUser(const QPlaceUser &other) noexcept = default;
/*!
Destroys the user object.
*/
-QPlaceUser::~QPlaceUser()
-{
-}
+QPlaceUser::~QPlaceUser() = default;
/*!
Assigns \a other to this user and returns a reference to this user.
*/
-QPlaceUser &QPlaceUser::operator=(const QPlaceUser &other)
+QPlaceUser &QPlaceUser::operator=(const QPlaceUser &other) noexcept
{
if (this == &other)
return *this;
@@ -107,17 +104,18 @@ QPlaceUser &QPlaceUser::operator=(const QPlaceUser &other)
}
/*!
- \fn bool QPlaceUser::operator!=(const QPlaceUser &other) const
+ \fn bool QPlaceUser::operator==(const QPlaceUser &lhs, const QPlaceUser &rhs) noexcept
- Returns true if \a other is not equal to this user,
- otherwise returns false.
+ Returns true if \a lhs is equal to \a rhs, otherwise returns false.
*/
/*!
- Returns true if this user is equal to \a other.
- Otherwise returns false.
+ \fn bool QPlaceUser::operator!=(const QPlaceUser &lhs, const QPlaceUser &rhs) noexcept
+
+ Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
*/
-bool QPlaceUser::operator==(const QPlaceUser &other) const
+
+bool QPlaceUser::isEqual(const QPlaceUser &other) const noexcept
{
return (*d) == *(other.d);
}
diff --git a/src/location/places/qplaceuser.h b/src/location/places/qplaceuser.h
index 319bb738..e5d333a1 100644
--- a/src/location/places/qplaceuser.h
+++ b/src/location/places/qplaceuser.h
@@ -47,20 +47,25 @@
QT_BEGIN_NAMESPACE
class QPlaceUserPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceUserPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QPlaceUser
{
public:
QPlaceUser();
- QPlaceUser(const QPlaceUser &other);
+ QPlaceUser(const QPlaceUser &other) noexcept;
+ QPlaceUser(QPlaceUser &&other) noexcept = default;
~QPlaceUser();
- QPlaceUser &operator=(const QPlaceUser &other);
+ QPlaceUser &operator=(const QPlaceUser &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceUser)
- bool operator==(const QPlaceUser &other) const;
- bool operator!=(const QPlaceUser &other) const {
- return !(other == *this);
- }
+ void swap(QPlaceUser &other) noexcept { d.swap(other.d); }
+
+ friend inline bool operator==(const QPlaceUser &lhs, const QPlaceUser &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QPlaceUser &lhs, const QPlaceUser &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
QString userId() const;
void setUserId(const QString &identifier);
@@ -70,6 +75,8 @@ public:
private:
QSharedDataPointer<QPlaceUserPrivate> d;
+
+ bool isEqual(const QPlaceUser &other) const noexcept;
};
QT_END_NAMESPACE