summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-26 22:11:13 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-28 16:25:49 +0200
commita40268324505a812b36f6d65880a96c7cb85ee24 (patch)
treeee5a83123126e8b594f17f0ef9c9d1dae4219511
parent56554b27a441b40554afdc8e4ec1f3e0c3b06b9b (diff)
downloadqtlocation-a40268324505a812b36f6d65880a96c7cb85ee24.tar.gz
Modernize Maps 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. Task-number: QTBUG-105206 Change-Id: I7601f6ed5aeeceb13a15094d3fb0620a2f623817 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit d861d509ec2b87bd5d85bffb21d2bb0c6a151ce7) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/location/maps/qabstractgeotilecache.cpp7
-rw-r--r--src/location/maps/qabstractgeotilecache_p.h9
-rw-r--r--src/location/maps/qgeocameracapabilities.cpp18
-rw-r--r--src/location/maps/qgeocameracapabilities_p.h23
-rw-r--r--src/location/maps/qgeocameradata.cpp20
-rw-r--r--src/location/maps/qgeocameradata_p.h17
-rw-r--r--src/location/maps/qgeomaneuver.cpp26
-rw-r--r--src/location/maps/qgeomaneuver.h16
-rw-r--r--src/location/maps/qgeomaptype.cpp16
-rw-r--r--src/location/maps/qgeomaptype_p.h17
-rw-r--r--src/location/maps/qgeorouterequest.cpp28
-rw-r--r--src/location/maps/qgeorouterequest.h23
-rw-r--r--src/location/maps/qgeoroutesegment.cpp37
-rw-r--r--src/location/maps/qgeoroutesegment.h23
-rw-r--r--src/location/maps/qgeotiledmap_p.h2
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine_p.h2
-rw-r--r--src/location/maps/qgeotiledmapscene_p.h2
-rw-r--r--src/location/maps/qgeotilerequestmanager_p.h2
-rw-r--r--src/location/maps/qgeotilespec.cpp14
-rw-r--r--src/location/maps/qgeotilespec_p.h20
20 files changed, 183 insertions, 139 deletions
diff --git a/src/location/maps/qabstractgeotilecache.cpp b/src/location/maps/qabstractgeotilecache.cpp
index 4553ce33..30ec8f57 100644
--- a/src/location/maps/qabstractgeotilecache.cpp
+++ b/src/location/maps/qabstractgeotilecache.cpp
@@ -53,13 +53,6 @@ Q_DECLARE_METATYPE(QSet<QGeoTileSpec>)
QT_BEGIN_NAMESPACE
-QGeoTileTexture::QGeoTileTexture()
- : textureBound(false) {}
-
-QGeoTileTexture::~QGeoTileTexture()
-{
-}
-
QAbstractGeoTileCache::QAbstractGeoTileCache(QObject *parent)
: QObject(parent)
{
diff --git a/src/location/maps/qabstractgeotilecache_p.h b/src/location/maps/qabstractgeotilecache_p.h
index c24bdd04..89199cb2 100644
--- a/src/location/maps/qabstractgeotilecache_p.h
+++ b/src/location/maps/qabstractgeotilecache_p.h
@@ -74,16 +74,11 @@ class QAbstractGeoTileCache;
class QThread;
/* This is also used in the mapgeometry */
-class Q_LOCATION_PRIVATE_EXPORT QGeoTileTexture
+struct QGeoTileTexture
{
-public:
-
- QGeoTileTexture();
- ~QGeoTileTexture();
-
QGeoTileSpec spec;
QImage image;
- bool textureBound;
+ bool textureBound = false;
};
class Q_LOCATION_PRIVATE_EXPORT QAbstractGeoTileCache : public QObject
diff --git a/src/location/maps/qgeocameracapabilities.cpp b/src/location/maps/qgeocameracapabilities.cpp
index 6a0981e1..aeeb5bd9 100644
--- a/src/location/maps/qgeocameracapabilities.cpp
+++ b/src/location/maps/qgeocameracapabilities.cpp
@@ -80,6 +80,8 @@ public:
bool overzoomEnabled_;
};
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoCameraCapabilitiesPrivate)
+
QGeoCameraCapabilitiesPrivate::QGeoCameraCapabilitiesPrivate()
: supportsBearing_(false),
supportsRolling_(false),
@@ -175,19 +177,18 @@ QGeoCameraCapabilities::QGeoCameraCapabilities()
/*!
Constructs a camera capabilities object from the contents of \a other.
*/
-QGeoCameraCapabilities::QGeoCameraCapabilities(const QGeoCameraCapabilities &other)
- : d(other.d) {}
+QGeoCameraCapabilities::QGeoCameraCapabilities(const QGeoCameraCapabilities &other) noexcept = default;
/*!
Destroys this camera capabilities object.
*/
-QGeoCameraCapabilities::~QGeoCameraCapabilities() {}
+QGeoCameraCapabilities::~QGeoCameraCapabilities() = default;
/*!
Assigns the contents of \a other to this camera capabilities object and
returns a reference to this camera capabilities object.
*/
-QGeoCameraCapabilities &QGeoCameraCapabilities::operator = (const QGeoCameraCapabilities &other)
+QGeoCameraCapabilities &QGeoCameraCapabilities::operator=(const QGeoCameraCapabilities &other) noexcept
{
if (this == &other)
return *this;
@@ -196,14 +197,9 @@ QGeoCameraCapabilities &QGeoCameraCapabilities::operator = (const QGeoCameraCapa
return *this;
}
-bool QGeoCameraCapabilities::operator == (const QGeoCameraCapabilities &rhs) const
-{
- return (*(d.constData()) == *(rhs.d.constData()));
-}
-
-bool QGeoCameraCapabilities::operator != (const QGeoCameraCapabilities &other) const
+bool QGeoCameraCapabilities::isEqual(const QGeoCameraCapabilities &other) const
{
- return !(operator==(other));
+ return (*(d.constData()) == *(other.d.constData()));
}
void QGeoCameraCapabilities::setTileSize(int tileSize)
diff --git a/src/location/maps/qgeocameracapabilities_p.h b/src/location/maps/qgeocameracapabilities_p.h
index e8ce5b02..d2dbac30 100644
--- a/src/location/maps/qgeocameracapabilities_p.h
+++ b/src/location/maps/qgeocameracapabilities_p.h
@@ -58,18 +58,31 @@
QT_BEGIN_NAMESPACE
class QGeoCameraCapabilitiesPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoCameraCapabilitiesPrivate, Q_LOCATION_PRIVATE_EXPORT)
class Q_LOCATION_PRIVATE_EXPORT QGeoCameraCapabilities
{
public:
QGeoCameraCapabilities();
- QGeoCameraCapabilities(const QGeoCameraCapabilities &other);
+ QGeoCameraCapabilities(const QGeoCameraCapabilities &other) noexcept;
+ QGeoCameraCapabilities(QGeoCameraCapabilities &&other) noexcept = default;
~QGeoCameraCapabilities();
- QGeoCameraCapabilities &operator = (const QGeoCameraCapabilities &other);
+ QGeoCameraCapabilities &operator=(const QGeoCameraCapabilities &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoCameraCapabilities)
- bool operator == (const QGeoCameraCapabilities &other) const;
- bool operator != (const QGeoCameraCapabilities &other) const;
+ void swap(QGeoCameraCapabilities &other) noexcept { d.swap(other.d); }
+
+ friend inline bool operator==(const QGeoCameraCapabilities &lhs,
+ const QGeoCameraCapabilities &rhs) noexcept
+ {
+ return lhs.isEqual(rhs);
+ }
+ friend inline bool operator!=(const QGeoCameraCapabilities &lhs,
+ const QGeoCameraCapabilities &rhs) noexcept
+ {
+ return !lhs.isEqual(rhs);
+ }
void setTileSize(int tileSize);
int tileSize() const;
@@ -110,6 +123,8 @@ public:
private:
QSharedDataPointer<QGeoCameraCapabilitiesPrivate> d;
+
+ bool isEqual(const QGeoCameraCapabilities &other) const;
};
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeocameradata.cpp b/src/location/maps/qgeocameradata.cpp
index 25aa7a26..18ee95cc 100644
--- a/src/location/maps/qgeocameradata.cpp
+++ b/src/location/maps/qgeocameradata.cpp
@@ -62,6 +62,8 @@ public:
double m_zoomLevel;
};
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoCameraDataPrivate)
+
QGeoCameraDataPrivate::QGeoCameraDataPrivate()
: QSharedData(),
m_center(0, 0),
@@ -144,14 +146,11 @@ QGeoCameraData::QGeoCameraData()
qRegisterAnimationInterpolator<QGeoCameraData>(cameraInterpolator);
}
-QGeoCameraData::QGeoCameraData(const QGeoCameraData &other)
- : d(other.d) {}
+QGeoCameraData::QGeoCameraData(const QGeoCameraData &other) noexcept = default;
-QGeoCameraData::~QGeoCameraData()
-{
-}
+QGeoCameraData::~QGeoCameraData() = default;
-QGeoCameraData &QGeoCameraData::operator = (const QGeoCameraData &other)
+QGeoCameraData &QGeoCameraData::operator=(const QGeoCameraData &other) noexcept
{
if (this == &other)
return *this;
@@ -160,14 +159,9 @@ QGeoCameraData &QGeoCameraData::operator = (const QGeoCameraData &other)
return *this;
}
-bool QGeoCameraData::operator == (const QGeoCameraData &rhs) const
-{
- return (*(d.constData()) == *(rhs.d.constData()));
-}
-
-bool QGeoCameraData::operator != (const QGeoCameraData &other) const
+bool QGeoCameraData::isEqual(const QGeoCameraData &other) const
{
- return !(operator==(other));
+ return (*(d.constData()) == *(other.d.constData()));
}
void QGeoCameraData::setCenter(const QGeoCoordinate &center)
diff --git a/src/location/maps/qgeocameradata_p.h b/src/location/maps/qgeocameradata_p.h
index 9ca10f39..0703e15b 100644
--- a/src/location/maps/qgeocameradata_p.h
+++ b/src/location/maps/qgeocameradata_p.h
@@ -60,18 +60,25 @@
QT_BEGIN_NAMESPACE
class QGeoCameraDataPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoCameraDataPrivate, Q_LOCATION_PRIVATE_EXPORT)
class Q_LOCATION_PRIVATE_EXPORT QGeoCameraData
{
public:
QGeoCameraData();
- QGeoCameraData(const QGeoCameraData &other);
+ QGeoCameraData(const QGeoCameraData &other) noexcept;
+ QGeoCameraData(QGeoCameraData &&other) noexcept = default;
~QGeoCameraData();
- QGeoCameraData &operator = (const QGeoCameraData &other);
+ QGeoCameraData &operator = (const QGeoCameraData &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoCameraData)
- bool operator == (const QGeoCameraData &other) const;
- bool operator != (const QGeoCameraData &other) const;
+ void swap(QGeoCameraData &other) noexcept { d.swap(other.d); }
+
+ friend inline bool operator==(const QGeoCameraData &lhs, const QGeoCameraData &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QGeoCameraData &lhs, const QGeoCameraData &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
void setCenter(const QGeoCoordinate &coordinate);
QGeoCoordinate center() const;
@@ -95,6 +102,8 @@ public:
private:
QSharedDataPointer<QGeoCameraDataPrivate> d;
+
+ bool isEqual(const QGeoCameraData &other) const;
};
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomaneuver.cpp b/src/location/maps/qgeomaneuver.cpp
index ee579a52..f52fbfed 100644
--- a/src/location/maps/qgeomaneuver.cpp
+++ b/src/location/maps/qgeomaneuver.cpp
@@ -50,6 +50,8 @@ QGeoManeuverPrivate *QSharedDataPointer<QGeoManeuverPrivate>::clone()
return d->clone();
}
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoManeuverPrivate)
+
/*!
\class QGeoManeuver
\inmodule QtLocation
@@ -129,13 +131,12 @@ QGeoManeuver::QGeoManeuver()
/*!
Constructs a maneuver object from the contents of \a other.
*/
-QGeoManeuver::QGeoManeuver(const QGeoManeuver &other)
- : d_ptr(other.d_ptr) {}
+QGeoManeuver::QGeoManeuver(const QGeoManeuver &other) noexcept = default;
/*!
Destroys this maneuver object.
*/
-QGeoManeuver::~QGeoManeuver() {}
+QGeoManeuver::~QGeoManeuver() = default;
/*!
Assigns \a other to this maneuver object and then returns
@@ -151,20 +152,21 @@ QGeoManeuver &QGeoManeuver::operator= (const QGeoManeuver & other)
}
/*!
- Returns whether this maneuver is equal to \a other.
+ \fn bool QGeoManeuver::operator==(const QGeoManeuver &lhs, const QGeoManeuver &rhs) noexcept
+
+ Returns whether the \a lhs maneuver is equal to \a rhs.
*/
-bool QGeoManeuver::operator== (const QGeoManeuver &other) const
-{
- return ( (d_ptr.constData() == other.d_ptr.constData())
- || (*(d_ptr.constData()) == *(other.d_ptr.constData())) );
-}
/*!
- Returns whether this maneuver is not equal to \a other.
+ \fn bool QGeoManeuver::operator!= (const QGeoManeuver &lhs, const QGeoManeuver &rhs) noexcept
+
+ Returns whether the \a lhs maneuver is not equal to \a rhs.
*/
-bool QGeoManeuver::operator!= (const QGeoManeuver &other) const
+
+bool QGeoManeuver::isEqual(const QGeoManeuver &other) const
{
- return !(operator==(other));
+ return ( (d_ptr.constData() == other.d_ptr.constData())
+ || (*(d_ptr.constData()) == *(other.d_ptr.constData())) );
}
/*!
diff --git a/src/location/maps/qgeomaneuver.h b/src/location/maps/qgeomaneuver.h
index f9989e55..49fff9b2 100644
--- a/src/location/maps/qgeomaneuver.h
+++ b/src/location/maps/qgeomaneuver.h
@@ -50,10 +50,10 @@ class QString;
class QGeoCoordinate;
class QGeoManeuverPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoManeuverPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QGeoManeuver
{
-
public:
enum InstructionDirection {
NoDirection,
@@ -71,13 +71,19 @@ public:
};
QGeoManeuver();
- QGeoManeuver(const QGeoManeuver &other);
+ QGeoManeuver(const QGeoManeuver &other) noexcept;
+ QGeoManeuver(QGeoManeuver &&other) noexcept = default;
~QGeoManeuver();
QGeoManeuver &operator= (const QGeoManeuver &other);
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoManeuver)
+
+ void swap(QGeoManeuver &other) noexcept { d_ptr.swap(other.d_ptr); }
- bool operator== (const QGeoManeuver &other) const;
- bool operator!= (const QGeoManeuver &other) const;
+ friend inline bool operator==(const QGeoManeuver &lhs, const QGeoManeuver &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QGeoManeuver &lhs, const QGeoManeuver &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
bool isValid() const;
@@ -107,6 +113,8 @@ protected:
private:
QSharedDataPointer<QGeoManeuverPrivate> d_ptr;
+
+ bool isEqual(const QGeoManeuver &other) const;
};
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomaptype.cpp b/src/location/maps/qgeomaptype.cpp
index 4a1fcffc..adece18a 100644
--- a/src/location/maps/qgeomaptype.cpp
+++ b/src/location/maps/qgeomaptype.cpp
@@ -42,11 +42,12 @@
QT_BEGIN_NAMESPACE
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoMapTypePrivate)
+
QGeoMapType::QGeoMapType()
: d_ptr(new QGeoMapTypePrivate()) {}
-QGeoMapType::QGeoMapType(const QGeoMapType &other)
- : d_ptr(other.d_ptr) {}
+QGeoMapType::QGeoMapType(const QGeoMapType &other) noexcept = default;
QGeoMapType::QGeoMapType(QGeoMapType::MapStyle style, const QString &name,
const QString &description, bool mobile, bool night, int mapId,
@@ -57,9 +58,9 @@ QGeoMapType::QGeoMapType(QGeoMapType::MapStyle style, const QString &name,
{
}
-QGeoMapType::~QGeoMapType() {}
+QGeoMapType::~QGeoMapType() = default;
-QGeoMapType &QGeoMapType::operator = (const QGeoMapType &other)
+QGeoMapType &QGeoMapType::operator=(const QGeoMapType &other) noexcept
{
if (this == &other)
return *this;
@@ -68,16 +69,11 @@ QGeoMapType &QGeoMapType::operator = (const QGeoMapType &other)
return *this;
}
-bool QGeoMapType::operator == (const QGeoMapType &other) const
+bool QGeoMapType::isEqual(const QGeoMapType &other) const noexcept
{
return (*d_ptr.constData() == *other.d_ptr.constData());
}
-bool QGeoMapType::operator != (const QGeoMapType &other) const
-{
- return !(operator ==(other));
-}
-
QGeoMapType::MapStyle QGeoMapType::style() const
{
return d_ptr->style_;
diff --git a/src/location/maps/qgeomaptype_p.h b/src/location/maps/qgeomaptype_p.h
index ed37e734..5a2ef638 100644
--- a/src/location/maps/qgeomaptype_p.h
+++ b/src/location/maps/qgeomaptype_p.h
@@ -60,6 +60,7 @@
QT_BEGIN_NAMESPACE
class QGeoMapTypePrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoMapTypePrivate, Q_LOCATION_PRIVATE_EXPORT)
class Q_LOCATION_PRIVATE_EXPORT QGeoMapType
{
@@ -80,17 +81,23 @@ public:
};
QGeoMapType();
- QGeoMapType(const QGeoMapType &other);
+ QGeoMapType(const QGeoMapType &other) noexcept;
+ QGeoMapType(QGeoMapType &&other) noexcept = default;
QGeoMapType(MapStyle style, const QString &name, const QString &description, bool mobile,
bool night, int mapId, const QByteArray &pluginName,
const QGeoCameraCapabilities &cameraCapabilities,
const QVariantMap &metadata = QVariantMap());
~QGeoMapType();
- QGeoMapType &operator = (const QGeoMapType &other);
+ QGeoMapType &operator=(const QGeoMapType &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoMapType)
- bool operator == (const QGeoMapType &other) const;
- bool operator != (const QGeoMapType &other) const;
+ void swap(QGeoMapType &other) noexcept { d_ptr.swap(other.d_ptr); }
+
+ friend inline bool operator==(const QGeoMapType &lhs, const QGeoMapType &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QGeoMapType &lhs, const QGeoMapType &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
MapStyle style() const;
QString name() const;
@@ -104,6 +111,8 @@ public:
private:
QSharedDataPointer<QGeoMapTypePrivate> d_ptr;
+
+ bool isEqual(const QGeoMapType &other) const noexcept;
};
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeorouterequest.cpp b/src/location/maps/qgeorouterequest.cpp
index e9ceafa4..2c455125 100644
--- a/src/location/maps/qgeorouterequest.cpp
+++ b/src/location/maps/qgeorouterequest.cpp
@@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QGeoRouteRequestPrivate)
+
/*!
\class QGeoRouteRequest
\inmodule QtLocation
@@ -240,19 +242,18 @@ QGeoRouteRequest::QGeoRouteRequest(const QGeoCoordinate &origin, const QGeoCoord
/*!
Constructs a route request object from the contents of \a other.
*/
-QGeoRouteRequest::QGeoRouteRequest(const QGeoRouteRequest &other)
- : d_ptr(other.d_ptr) {}
+QGeoRouteRequest::QGeoRouteRequest(const QGeoRouteRequest &other) noexcept = default;
/*!
Destroys the request.
*/
-QGeoRouteRequest::~QGeoRouteRequest() {}
+QGeoRouteRequest::~QGeoRouteRequest() = default;
/*!
Assigns \a other to this route request object and then returns a reference
to this route request object.
*/
-QGeoRouteRequest &QGeoRouteRequest::operator= (const QGeoRouteRequest & other)
+QGeoRouteRequest &QGeoRouteRequest::operator=(const QGeoRouteRequest & other) noexcept
{
if (this == &other)
return *this;
@@ -262,20 +263,21 @@ QGeoRouteRequest &QGeoRouteRequest::operator= (const QGeoRouteRequest & other)
}
/*!
- Returns whether this route request and \a other are equal.
+ \fn bool QGeoRouteRequest::operator==(const QGeoRouteRequest &lhs, const QGeoRouteRequest &rhs) noexcept
+
+ Returns whether the route requests \a lhs and \a rhs are equal.
*/
-bool QGeoRouteRequest::operator ==(const QGeoRouteRequest &other) const
-{
- return ( (d_ptr.constData() == other.d_ptr.constData())
- || (*d_ptr) == (*other.d_ptr));
-}
/*!
- Returns whether this route request and \a other are equal.
+ \fn bool QGeoRouteRequest::operator!=(const QGeoRouteRequest &lhs, const QGeoRouteRequest &rhs) noexcept
+
+ Returns whether the route requests \a lhs and \a rhs are not equal.
*/
-bool QGeoRouteRequest::operator !=(const QGeoRouteRequest &other) const
+
+bool QGeoRouteRequest::isEqual(const QGeoRouteRequest &other) const noexcept
{
- return !(operator==(other));
+ return ((d_ptr.constData() == other.d_ptr.constData())
+ || (*d_ptr) == (*other.d_ptr));
}
/*!
diff --git a/src/location/maps/qgeorouterequest.h b/src/location/maps/qgeorouterequest.h
index 285b7b88..058504c4 100644
--- a/src/location/maps/qgeorouterequest.h
+++ b/src/location/maps/qgeorouterequest.h
@@ -51,6 +51,7 @@
QT_BEGIN_NAMESPACE
class QGeoRouteRequestPrivate;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoRouteRequestPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QGeoRouteRequest
{
@@ -110,14 +111,26 @@ public:
explicit QGeoRouteRequest(const QList<QGeoCoordinate> &waypoints = QList<QGeoCoordinate>());
QGeoRouteRequest(const QGeoCoordinate &origin,
const QGeoCoordinate &destination);
- QGeoRouteRequest(const QGeoRouteRequest &other);
+ QGeoRouteRequest(const QGeoRouteRequest &other) noexcept;
+ QGeoRouteRequest(QGeoRouteRequest &&other) noexcept = default;
~QGeoRouteRequest();
- QGeoRouteRequest &operator= (const QGeoRouteRequest &other);
+ QGeoRouteRequest &operator= (const QGeoRouteRequest &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoRouteRequest)
- bool operator == (const QGeoRouteRequest &other) const;
- bool operator != (const QGeoRouteRequest &other) const;
+ void swap(QGeoRouteRequest &other) noexcept { d_ptr.swap(other.d_ptr); }
+
+ friend inline bool operator==(const QGeoRouteRequest &lhs,
+ const QGeoRouteRequest &rhs) noexcept
+ {
+ return lhs.isEqual(rhs);
+ }
+ friend inline bool operator!=(const QGeoRouteRequest &lhs,
+ const QGeoRouteRequest &rhs) noexcept
+ {
+ return !lhs.isEqual(rhs);
+ }
void setWaypoints(const QList<QGeoCoordinate> &waypoints);
QList<QGeoCoordinate> waypoints() const;
@@ -161,6 +174,8 @@ public:
private:
QExplicitlySharedDataPointer<QGeoRouteRequestPrivate> d_ptr;
+
+ bool isEqual(const QGeoRouteRequest &other) const noexcept;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoRouteRequest::TravelModes)
diff --git a/src/location/maps/qgeoroutesegment.cpp b/src/location/maps/qgeoroutesegment.cpp
index 957bb64a..d65400bc 100644
--- a/src/location/maps/qgeoroutesegment.cpp
+++ b/src/location/maps/qgeoroutesegment.cpp
@@ -51,6 +51,8 @@ QGeoRouteSegmentPrivate *QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate>::
return d->clone();
}
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QGeoRouteSegmentPrivate)
+
/*!
\class QGeoRouteSegment
\inmodule QtLocation
@@ -81,34 +83,25 @@ QGeoRouteSegment::QGeoRouteSegment()
/*!
Constructs a route segment object from the contents of \a other.
*/
-QGeoRouteSegment::QGeoRouteSegment(const QGeoRouteSegment &other)
- : d_ptr(other.d_ptr) {}
+QGeoRouteSegment::QGeoRouteSegment(const QGeoRouteSegment &other) noexcept = default;
/*!
\internal
*/
-QGeoRouteSegment::QGeoRouteSegment(const QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &dd)
+QGeoRouteSegment::QGeoRouteSegment(QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &&dd)
: d_ptr(dd) {}
/*!
- Returns the private implementation.
-*/
-QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &QGeoRouteSegment::d()
-{
- return d_ptr;
-}
-
-/*!
Destroys this route segment object.
*/
-QGeoRouteSegment::~QGeoRouteSegment() {}
+QGeoRouteSegment::~QGeoRouteSegment() = default;
/*!
Assigns \a other to this route segment object and then returns a
reference to this route segment object.
*/
-QGeoRouteSegment &QGeoRouteSegment::operator= (const QGeoRouteSegment & other)
+QGeoRouteSegment &QGeoRouteSegment::operator=(const QGeoRouteSegment & other) noexcept
{
if (this == &other)
return *this;
@@ -118,24 +111,24 @@ QGeoRouteSegment &QGeoRouteSegment::operator= (const QGeoRouteSegment & other)
}
/*!
- Returns whether this route segment and \a other are equal.
+ \fn bool QGeoRouteSegment::operator==(const QGeoRouteSegment &lhs, const QGeoRouteSegment &rhs) noexcept
+ Returns whether the route segments \a lhs and \a rhs are equal.
The value of nextRouteSegment() is not considered in the comparison.
*/
-bool QGeoRouteSegment::operator ==(const QGeoRouteSegment &other) const
-{
- return ( (d_ptr.constData() == other.d_ptr.constData())
- || (*d_ptr) == (*other.d_ptr));
-}
/*!
- Returns whether this route segment and \a other are not equal.
+ \fn bool QGeoRouteSegment::operator!=(const QGeoRouteSegment &lhs, const QGeoRouteSegment &rhs) noexcept
+
+ Returns whether the route segments \a lhs and \a rhs are not equal.
The value of nextRouteSegment() is not considered in the comparison.
*/
-bool QGeoRouteSegment::operator !=(const QGeoRouteSegment &other) const
+
+bool QGeoRouteSegment::isEqual(const QGeoRouteSegment &other) const noexcept
{
- return !(operator==(other));
+ return ( (d_ptr.constData() == other.d_ptr.constData())
+ || (*d_ptr) == (*other.d_ptr));
}
/*!
diff --git a/src/location/maps/qgeoroutesegment.h b/src/location/maps/qgeoroutesegment.h
index 52d7e06a..2d9d046d 100644
--- a/src/location/maps/qgeoroutesegment.h
+++ b/src/location/maps/qgeoroutesegment.h
@@ -50,18 +50,24 @@ class QGeoCoordinate;
class QGeoManeuver;
class QGeoRouteSegmentPrivate;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoRouteSegmentPrivate, Q_LOCATION_EXPORT)
class Q_LOCATION_EXPORT QGeoRouteSegment
{
-
public:
QGeoRouteSegment();
- QGeoRouteSegment(const QGeoRouteSegment &other);
+ QGeoRouteSegment(const QGeoRouteSegment &other) noexcept;
+ QGeoRouteSegment(QGeoRouteSegment &&other) noexcept = default;
~QGeoRouteSegment();
- QGeoRouteSegment &operator= (const QGeoRouteSegment &other);
+ QGeoRouteSegment &operator=(const QGeoRouteSegment &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoRouteSegment)
+
+ void swap(QGeoRouteSegment &other) noexcept { d_ptr.swap(other.d_ptr); }
- bool operator ==(const QGeoRouteSegment &other) const;
- bool operator !=(const QGeoRouteSegment &other) const;
+ friend inline bool operator ==(const QGeoRouteSegment &lhs, const QGeoRouteSegment &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator !=(const QGeoRouteSegment &lhs, const QGeoRouteSegment &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
bool isValid() const;
bool isLegLastSegment() const;
@@ -81,12 +87,11 @@ public:
void setManeuver(const QGeoManeuver &maneuver);
QGeoManeuver maneuver() const;
-protected:
- QGeoRouteSegment(const QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &dd);
- QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &d();
-
private:
QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> d_ptr;
+ QGeoRouteSegment(QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &&dd);
+
+ bool isEqual(const QGeoRouteSegment &other) const noexcept;
friend class QGeoRouteSegmentPrivate;
};
diff --git a/src/location/maps/qgeotiledmap_p.h b/src/location/maps/qgeotiledmap_p.h
index 0f53ff1f..423dc6dd 100644
--- a/src/location/maps/qgeotiledmap_p.h
+++ b/src/location/maps/qgeotiledmap_p.h
@@ -62,7 +62,7 @@
QT_BEGIN_NAMESPACE
class QGeoTileSpec;
-class QGeoTileTexture;
+struct QGeoTileTexture;
class QAbstractGeoTileCache;
class QGeoTiledMapPrivate;
class QGeoTiledMappingManagerEngine;
diff --git a/src/location/maps/qgeotiledmappingmanagerengine_p.h b/src/location/maps/qgeotiledmappingmanagerengine_p.h
index ac28523f..cb6d4972 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine_p.h
+++ b/src/location/maps/qgeotiledmappingmanagerengine_p.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
class QGeoTiledMappingManagerEnginePrivate;
class QGeoTileFetcher;
-class QGeoTileTexture;
+struct QGeoTileTexture;
class QGeoTileSpec;
class QGeoTiledMap;
diff --git a/src/location/maps/qgeotiledmapscene_p.h b/src/location/maps/qgeotiledmapscene_p.h
index ad44522b..290fccda 100644
--- a/src/location/maps/qgeotiledmapscene_p.h
+++ b/src/location/maps/qgeotiledmapscene_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class QGeoCameraData;
class QGeoTileSpec;
class QDoubleVector2D;
-class QGeoTileTexture;
+struct QGeoTileTexture;
class QSGNode;
class QQuickWindow;
class QGeoTiledMapScenePrivate;
diff --git a/src/location/maps/qgeotilerequestmanager_p.h b/src/location/maps/qgeotilerequestmanager_p.h
index a7c53d8b..ba63b0c4 100644
--- a/src/location/maps/qgeotilerequestmanager_p.h
+++ b/src/location/maps/qgeotilerequestmanager_p.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
class QGeoTiledMap;
class QGeoTiledMappingManagerEngine;
class QGeoTileSpec;
-class QGeoTileTexture;
+struct QGeoTileTexture;
class QGeoTileRequestManagerPrivate;
diff --git a/src/location/maps/qgeotilespec.cpp b/src/location/maps/qgeotilespec.cpp
index 722f489c..6690524d 100644
--- a/src/location/maps/qgeotilespec.cpp
+++ b/src/location/maps/qgeotilespec.cpp
@@ -44,19 +44,19 @@
QT_BEGIN_NAMESPACE
+QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoTileSpecPrivate)
+
QGeoTileSpec::QGeoTileSpec()
: d(QSharedDataPointer<QGeoTileSpecPrivate>(new QGeoTileSpecPrivate())) {}
QGeoTileSpec::QGeoTileSpec(const QString &plugin, int mapId, int zoom, int x, int y, int version)
: d(QSharedDataPointer<QGeoTileSpecPrivate>(new QGeoTileSpecPrivate(plugin, mapId, zoom, x, y, version))) {}
-QGeoTileSpec::QGeoTileSpec(const QGeoTileSpec &other)
- : d(other.d) {}
+QGeoTileSpec::QGeoTileSpec(const QGeoTileSpec &other) noexcept = default;
-QGeoTileSpec::~QGeoTileSpec() {
-}
+QGeoTileSpec::~QGeoTileSpec() = default;
-QGeoTileSpec &QGeoTileSpec::operator = (const QGeoTileSpec &other)
+QGeoTileSpec &QGeoTileSpec::operator=(const QGeoTileSpec &other) noexcept
{
if (this == &other)
return *this;
@@ -120,12 +120,12 @@ int QGeoTileSpec::version() const
return d->version_;
}
-bool QGeoTileSpec::operator == (const QGeoTileSpec &rhs) const
+bool QGeoTileSpec::isEqual(const QGeoTileSpec &rhs) const noexcept
{
return (*(d.constData()) == *(rhs.d.constData()));
}
-bool QGeoTileSpec::operator < (const QGeoTileSpec &rhs) const
+bool QGeoTileSpec::isLess(const QGeoTileSpec &rhs) const noexcept
{
return (*(d.constData()) < *(rhs.d.constData()));
}
diff --git a/src/location/maps/qgeotilespec_p.h b/src/location/maps/qgeotilespec_p.h
index ef382143..06cbf8c4 100644
--- a/src/location/maps/qgeotilespec_p.h
+++ b/src/location/maps/qgeotilespec_p.h
@@ -60,16 +60,21 @@
QT_BEGIN_NAMESPACE
class QGeoTileSpecPrivate;
+QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoTileSpecPrivate, Q_LOCATION_PRIVATE_EXPORT)
class Q_LOCATION_PRIVATE_EXPORT QGeoTileSpec
{
public:
QGeoTileSpec();
- QGeoTileSpec(const QGeoTileSpec &other);
+ QGeoTileSpec(const QGeoTileSpec &other) noexcept;
+ QGeoTileSpec(QGeoTileSpec &&other) noexcept = default;
QGeoTileSpec(const QString &plugin, int mapId, int zoom, int x, int y, int version = -1);
~QGeoTileSpec();
- QGeoTileSpec &operator = (const QGeoTileSpec &other);
+ QGeoTileSpec &operator=(const QGeoTileSpec &other) noexcept;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoTileSpec)
+
+ void swap(QGeoTileSpec &other) noexcept { d.swap(other.d); }
QString plugin() const;
@@ -88,11 +93,18 @@ public:
void setVersion(int version);
int version() const;
- bool operator == (const QGeoTileSpec &rhs) const;
- bool operator < (const QGeoTileSpec &rhs) const;
+ friend inline bool operator==(const QGeoTileSpec &lhs, const QGeoTileSpec &rhs) noexcept
+ { return lhs.isEqual(rhs); }
+ friend inline bool operator!=(const QGeoTileSpec &lhs, const QGeoTileSpec &rhs) noexcept
+ { return !lhs.isEqual(rhs); }
+ friend inline bool operator < (const QGeoTileSpec &lhs, const QGeoTileSpec &rhs) noexcept
+ { return lhs.isLess(rhs); }
private:
QSharedDataPointer<QGeoTileSpecPrivate> d;
+
+ bool isEqual(const QGeoTileSpec &rhs) const noexcept;
+ bool isLess(const QGeoTileSpec &rhs) const noexcept;
};
Q_LOCATION_PRIVATE_EXPORT unsigned int qHash(const QGeoTileSpec &spec);