diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-07-29 16:01:49 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-08-19 06:15:03 +0200 |
commit | 4c4ef4ae797549ac4597d4c8aeba1533c8e4c1f6 (patch) | |
tree | 1326c7a56ab307705b04babd25c22fc7214b3850 /src | |
parent | 9f40dfe98a7d7fc37e267160ce01a8e9dbd2282c (diff) | |
download | qtlocation-4c4ef4ae797549ac4597d4c8aeba1533c8e4c1f6.tar.gz |
Cleanup private map types
Use member initialization and remove any explicit implementation of the
special member functions if they are just the default.
Remove some unnecessary Q_DISABLE_COPY that prevents compiler-generated
versions of the special member functions.
Task-number: QTBUG-105206
Pick-to: 6.2
Change-Id: I206abd07acbbcb863a4d8099a5d8b7ff1f641079
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
30 files changed, 104 insertions, 405 deletions
diff --git a/src/location/maps/qgeocameracapabilities.cpp b/src/location/maps/qgeocameracapabilities.cpp index aeeb5bd9..3664aadd 100644 --- a/src/location/maps/qgeocameracapabilities.cpp +++ b/src/location/maps/qgeocameracapabilities.cpp @@ -54,89 +54,29 @@ QT_BEGIN_NAMESPACE class QGeoCameraCapabilitiesPrivate : public QSharedData { public: - QGeoCameraCapabilitiesPrivate(); - QGeoCameraCapabilitiesPrivate(const QGeoCameraCapabilitiesPrivate &other); - ~QGeoCameraCapabilitiesPrivate(); + bool operator==(const QGeoCameraCapabilitiesPrivate &rhs) const noexcept; - QGeoCameraCapabilitiesPrivate &operator = (const QGeoCameraCapabilitiesPrivate &other); - - bool operator == (const QGeoCameraCapabilitiesPrivate &rhs) const; - - bool supportsBearing_; - bool supportsRolling_; - bool supportsTilting_; + bool supportsBearing_ = false; + bool supportsRolling_ = false; + bool supportsTilting_ = false; // this is mutable so that it can be set from accessor functions that are const // TODO: remove the mutable here - mutable bool valid_; - - double minZoom_; - double maxZoom_; - double minTilt_; - double maxTilt_; - int tileSize_; - double minimumFieldOfView_; - double maximumFieldOfView_; - bool overzoomEnabled_; + mutable bool valid_ = false; + + double minZoom_ = 0.0; + double maxZoom_ = 0.0; + double minTilt_ = 0.0; + double maxTilt_ = 0.0; + int tileSize_ = 256; + double minimumFieldOfView_ = 45.0; // Defaulting to a fixed FOV of 45 degrees. + double maximumFieldOfView_ = 45.0; // Too large FOVs cause the loading of too many tiles. + bool overzoomEnabled_ = false; }; QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoCameraCapabilitiesPrivate) -QGeoCameraCapabilitiesPrivate::QGeoCameraCapabilitiesPrivate() - : supportsBearing_(false), - supportsRolling_(false), - supportsTilting_(false), - valid_(false), - minZoom_(0.0), - maxZoom_(0.0), - minTilt_(0.0), - maxTilt_(0.0), - tileSize_(256), - minimumFieldOfView_(45.0), // Defaulting to a fixed FOV of 45 degrees. Too large FOVs cause the loading of too many tiles - maximumFieldOfView_(45.0), - overzoomEnabled_(false) {} - - -QGeoCameraCapabilitiesPrivate::QGeoCameraCapabilitiesPrivate(const QGeoCameraCapabilitiesPrivate &other) - : QSharedData(other), - supportsBearing_(other.supportsBearing_), - supportsRolling_(other.supportsRolling_), - supportsTilting_(other.supportsTilting_), - valid_(other.valid_), - minZoom_(other.minZoom_), - maxZoom_(other.maxZoom_), - minTilt_(other.minTilt_), - maxTilt_(other.maxTilt_), - tileSize_(other.tileSize_), - minimumFieldOfView_(other.minimumFieldOfView_), - maximumFieldOfView_(other.maximumFieldOfView_), - overzoomEnabled_(other.overzoomEnabled_){} - - -QGeoCameraCapabilitiesPrivate::~QGeoCameraCapabilitiesPrivate() {} - -QGeoCameraCapabilitiesPrivate &QGeoCameraCapabilitiesPrivate::operator = (const QGeoCameraCapabilitiesPrivate &other) -{ - if (this == &other) - return *this; - - supportsBearing_ = other.supportsBearing_; - supportsRolling_ = other.supportsRolling_; - supportsTilting_ = other.supportsTilting_; - valid_ = other.valid_; - minZoom_ = other.minZoom_; - maxZoom_ = other.maxZoom_; - minTilt_ = other.minTilt_; - maxTilt_ = other.maxTilt_; - tileSize_ = other.tileSize_; - minimumFieldOfView_ = other.minimumFieldOfView_; - maximumFieldOfView_ = other.maximumFieldOfView_; - overzoomEnabled_ = other.overzoomEnabled_; - - return *this; -} - -bool QGeoCameraCapabilitiesPrivate::operator == (const QGeoCameraCapabilitiesPrivate &rhs) const +bool QGeoCameraCapabilitiesPrivate::operator==(const QGeoCameraCapabilitiesPrivate &rhs) const noexcept { return ((supportsBearing_ == rhs.supportsBearing_) && (supportsRolling_ == rhs.supportsRolling_) diff --git a/src/location/maps/qgeocameradata.cpp b/src/location/maps/qgeocameradata.cpp index 6fcdcf38..bf657a3c 100644 --- a/src/location/maps/qgeocameradata.cpp +++ b/src/location/maps/qgeocameradata.cpp @@ -50,57 +50,19 @@ QT_BEGIN_NAMESPACE class QGeoCameraDataPrivate : public QSharedData { public: - QGeoCameraDataPrivate(); - QGeoCameraDataPrivate(const QGeoCameraDataPrivate &rhs); - - QGeoCameraDataPrivate &operator = (const QGeoCameraDataPrivate &rhs); - - bool operator == (const QGeoCameraDataPrivate &rhs) const; - - QGeoCoordinate m_center; - double m_bearing; - double m_tilt; - double m_roll; - double m_fieldOfView; - double m_zoomLevel; + bool operator==(const QGeoCameraDataPrivate &rhs) const noexcept; + + QGeoCoordinate m_center = {0, 0}; + double m_bearing = 0.0; + double m_tilt = 0.0; + double m_roll = 0.0; + double m_fieldOfView = 45.0; + double m_zoomLevel = 0.0; }; QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoCameraDataPrivate) -QGeoCameraDataPrivate::QGeoCameraDataPrivate() - : QSharedData(), - m_center(0, 0), - m_bearing(0.0), - m_tilt(0.0), - m_roll(0.0), - m_fieldOfView(45.0), - m_zoomLevel(0.0) {} - -QGeoCameraDataPrivate::QGeoCameraDataPrivate(const QGeoCameraDataPrivate &rhs) - : QSharedData(rhs), - m_center(rhs.m_center), - m_bearing(rhs.m_bearing), - m_tilt(rhs.m_tilt), - m_roll(rhs.m_roll), - m_fieldOfView(rhs.m_fieldOfView), - m_zoomLevel(rhs.m_zoomLevel) {} - -QGeoCameraDataPrivate &QGeoCameraDataPrivate::operator = (const QGeoCameraDataPrivate &rhs) -{ - if (this == &rhs) - return *this; - - m_center = rhs.m_center; - m_bearing = rhs.m_bearing; - m_tilt = rhs.m_tilt; - m_roll = rhs.m_roll; - m_fieldOfView = rhs.m_fieldOfView; - m_zoomLevel = rhs.m_zoomLevel; - - return *this; -} - -bool QGeoCameraDataPrivate::operator == (const QGeoCameraDataPrivate &rhs) const +bool QGeoCameraDataPrivate::operator==(const QGeoCameraDataPrivate &rhs) const noexcept { return ((m_center == rhs.m_center) && (m_bearing == rhs.m_bearing) diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp index 92d3b183..de72df4d 100644 --- a/src/location/maps/qgeocameratiles.cpp +++ b/src/location/maps/qgeocameratiles.cpp @@ -178,18 +178,6 @@ const QSet<QGeoTileSpec>& QGeoCameraTiles::createTiles() return d_ptr->m_tiles; } -QGeoCameraTilesPrivate::QGeoCameraTilesPrivate() -: m_mapVersion(-1), - m_tileSize(0), - m_intZoomLevel(0), - m_sideLength(0), - m_dirtyGeometry(false), - m_dirtyMetadata(false), - m_viewExpansion(1.0) -{ -} - -QGeoCameraTilesPrivate::~QGeoCameraTilesPrivate() {} void QGeoCameraTilesPrivate::updateMetadata() { diff --git a/src/location/maps/qgeocameratiles_p_p.h b/src/location/maps/qgeocameratiles_p_p.h index a00fa54a..f1b60673 100644 --- a/src/location/maps/qgeocameratiles_p_p.h +++ b/src/location/maps/qgeocameratiles_p_p.h @@ -103,10 +103,6 @@ public: QMap<int, QPair<int, int> > data; }; - QGeoCameraTilesPrivate(); - ~QGeoCameraTilesPrivate(); - - void updateMetadata(); void updateGeometry(); @@ -126,18 +122,18 @@ public: public: QString m_pluginString; QGeoMapType m_mapType; - int m_mapVersion; + int m_mapVersion = -1; QGeoCameraData m_camera; QSize m_screenSize; QRectF m_visibleArea; - int m_tileSize; + int m_tileSize = 0; QSet<QGeoTileSpec> m_tiles; - int m_intZoomLevel; - int m_sideLength; - bool m_dirtyGeometry; - bool m_dirtyMetadata; - double m_viewExpansion; + int m_intZoomLevel = 0; + int m_sideLength = 0; + bool m_dirtyGeometry = false; + bool m_dirtyMetadata = false; + double m_viewExpansion = 1.0; #ifdef QT_LOCATION_DEBUG // updateGeometry diff --git a/src/location/maps/qgeocodereply.cpp b/src/location/maps/qgeocodereply.cpp index 8172ce9a..fec03a29 100644 --- a/src/location/maps/qgeocodereply.cpp +++ b/src/location/maps/qgeocodereply.cpp @@ -346,7 +346,7 @@ QGeoCodeReplyPrivate::QGeoCodeReplyPrivate(QGeoCodeReply::Error error, const QSt limit(-1), offset(0) {} -QGeoCodeReplyPrivate::~QGeoCodeReplyPrivate() {} +QGeoCodeReplyPrivate::~QGeoCodeReplyPrivate() = default; QVariantMap QGeoCodeReplyPrivate::extraData() const { diff --git a/src/location/maps/qgeocodingmanager.cpp b/src/location/maps/qgeocodingmanager.cpp index 8fc1070c..13a6c510 100644 --- a/src/location/maps/qgeocodingmanager.cpp +++ b/src/location/maps/qgeocodingmanager.cpp @@ -314,8 +314,7 @@ QLocale QGeoCodingManager::locale() const /******************************************************************************* *******************************************************************************/ -QGeoCodingManagerPrivate::QGeoCodingManagerPrivate() - : engine(0) {} +QGeoCodingManagerPrivate::QGeoCodingManagerPrivate() = default; QGeoCodingManagerPrivate::~QGeoCodingManagerPrivate() { diff --git a/src/location/maps/qgeocodingmanager_p.h b/src/location/maps/qgeocodingmanager_p.h index 63593d62..d01e5a7e 100644 --- a/src/location/maps/qgeocodingmanager_p.h +++ b/src/location/maps/qgeocodingmanager_p.h @@ -65,7 +65,7 @@ public: QGeoCodingManagerPrivate(); ~QGeoCodingManagerPrivate(); - QGeoCodingManagerEngine *engine; + QGeoCodingManagerEngine *engine = nullptr; private: Q_DISABLE_COPY(QGeoCodingManagerPrivate) diff --git a/src/location/maps/qgeocodingmanagerengine.cpp b/src/location/maps/qgeocodingmanagerengine.cpp index a26e73c4..35ab0d3a 100644 --- a/src/location/maps/qgeocodingmanagerengine.cpp +++ b/src/location/maps/qgeocodingmanagerengine.cpp @@ -326,12 +326,7 @@ QLocale QGeoCodingManagerEngine::locale() const /******************************************************************************* *******************************************************************************/ -QGeoCodingManagerEnginePrivate::QGeoCodingManagerEnginePrivate() - : managerVersion(-1) -{} - -QGeoCodingManagerEnginePrivate::~QGeoCodingManagerEnginePrivate() -{ -} +QGeoCodingManagerEnginePrivate::QGeoCodingManagerEnginePrivate() = default; +QGeoCodingManagerEnginePrivate::~QGeoCodingManagerEnginePrivate() = default; QT_END_NAMESPACE diff --git a/src/location/maps/qgeocodingmanagerengine_p.h b/src/location/maps/qgeocodingmanagerengine_p.h index 169eaabd..065b2336 100644 --- a/src/location/maps/qgeocodingmanagerengine_p.h +++ b/src/location/maps/qgeocodingmanagerengine_p.h @@ -64,9 +64,8 @@ public: ~QGeoCodingManagerEnginePrivate(); QString managerName; - int managerVersion; - QLocale locale; + int managerVersion = -1; private: Q_DISABLE_COPY(QGeoCodingManagerEnginePrivate) diff --git a/src/location/maps/qgeofiletilecache.cpp b/src/location/maps/qgeofiletilecache.cpp index 9c0b9504..c2990bc3 100644 --- a/src/location/maps/qgeofiletilecache.cpp +++ b/src/location/maps/qgeofiletilecache.cpp @@ -72,7 +72,7 @@ void QCache3QTileEvictionPolicy::aboutToBeRemoved(const QGeoTileSpec &key, QShar { Q_UNUSED(key); // set the cache pointer to zero so we can't call evictFromDiskCache - obj->cache = 0; + obj->cache = nullptr; } void QCache3QTileEvictionPolicy::aboutToBeEvicted(const QGeoTileSpec &key, QSharedPointer<QGeoCachedTileDisk> obj) diff --git a/src/location/maps/qgeofiletilecache_p.h b/src/location/maps/qgeofiletilecache_p.h index bc5c849c..128ad092 100644 --- a/src/location/maps/qgeofiletilecache_p.h +++ b/src/location/maps/qgeofiletilecache_p.h @@ -77,7 +77,7 @@ public: QGeoTileSpec spec; QString filename; QString format; - QGeoFileTileCache *cache; + QGeoFileTileCache *cache = nullptr; }; /* Custom eviction policy for the disk cache, to avoid deleting all the files diff --git a/src/location/maps/qgeomaneuver.cpp b/src/location/maps/qgeomaneuver.cpp index 0ed9a881..8332b9c3 100644 --- a/src/location/maps/qgeomaneuver.cpp +++ b/src/location/maps/qgeomaneuver.cpp @@ -167,7 +167,7 @@ QGeoManeuver &QGeoManeuver::operator= (const QGeoManeuver & other) bool QGeoManeuver::isEqual(const QGeoManeuver &other) const { return ( (d_ptr.constData() == other.d_ptr.constData()) - || (*(d_ptr.constData()) == *(other.d_ptr.constData())) ); + || (d_ptr->equals(*other.d_ptr)) ); } /*! @@ -320,27 +320,6 @@ QVariantMap QGeoManeuver::extendedAttributes() const /******************************************************************************* *******************************************************************************/ -QGeoManeuverPrivate::QGeoManeuverPrivate() -{ - -} - -QGeoManeuverPrivate::QGeoManeuverPrivate(const QGeoManeuverPrivate &other) - : QSharedData(other) -{ - -} - -QGeoManeuverPrivate::~QGeoManeuverPrivate() -{ - -} - -bool QGeoManeuverPrivate::operator==(const QGeoManeuverPrivate &other) const -{ - return equals(other); -} - bool QGeoManeuverPrivate::equals(const QGeoManeuverPrivate &other) const { return ((valid() == other.valid()) @@ -447,23 +426,9 @@ void QGeoManeuverPrivate::setExtendedAttributes(const QVariantMap &extendedAttri /******************************************************************************* *******************************************************************************/ -QGeoManeuverPrivateDefault::QGeoManeuverPrivateDefault() - : m_valid(false), - m_direction(QGeoManeuver::NoDirection), - m_timeToNextInstruction(0), - m_distanceToNextInstruction(0.0) {} - -QGeoManeuverPrivateDefault::QGeoManeuverPrivateDefault(const QGeoManeuverPrivateDefault &other) - : QGeoManeuverPrivate(other), - m_valid(other.m_valid), - m_position(other.m_position), - m_text(other.m_text), - m_direction(other.m_direction), - m_timeToNextInstruction(other.m_timeToNextInstruction), - m_distanceToNextInstruction(other.m_distanceToNextInstruction), - m_waypoint(other.m_waypoint) {} - -QGeoManeuverPrivateDefault::~QGeoManeuverPrivateDefault() {} +QGeoManeuverPrivate::~QGeoManeuverPrivate() = default; + +QGeoManeuverPrivateDefault::~QGeoManeuverPrivateDefault() = default; QGeoManeuverPrivate *QGeoManeuverPrivateDefault::clone() { diff --git a/src/location/maps/qgeomaneuver_p.h b/src/location/maps/qgeomaneuver_p.h index 8ce368e0..fb62d6dc 100644 --- a/src/location/maps/qgeomaneuver_p.h +++ b/src/location/maps/qgeomaneuver_p.h @@ -63,13 +63,9 @@ QT_BEGIN_NAMESPACE class Q_LOCATION_PRIVATE_EXPORT QGeoManeuverPrivate : public QSharedData { public: - QGeoManeuverPrivate(); - QGeoManeuverPrivate(const QGeoManeuverPrivate &other); virtual ~QGeoManeuverPrivate(); virtual QGeoManeuverPrivate *clone() = 0; - bool operator== (const QGeoManeuverPrivate &other) const; - virtual bool valid() const; virtual void setValid(bool valid); @@ -97,15 +93,12 @@ public: virtual QVariantMap extendedAttributes() const; virtual void setExtendedAttributes(const QVariantMap &extendedAttributes); -protected: virtual bool equals(const QGeoManeuverPrivate &other) const; }; class Q_LOCATION_PRIVATE_EXPORT QGeoManeuverPrivateDefault : public QGeoManeuverPrivate { public: - QGeoManeuverPrivateDefault(); - QGeoManeuverPrivateDefault(const QGeoManeuverPrivateDefault &other); ~QGeoManeuverPrivateDefault(); virtual QGeoManeuverPrivate *clone() override; @@ -136,15 +129,15 @@ public: virtual QVariantMap extendedAttributes() const override; virtual void setExtendedAttributes(const QVariantMap &extendedAttributes) override; - bool m_valid; QString m_id; QGeoCoordinate m_position; QString m_text; - QGeoManeuver::InstructionDirection m_direction; - int m_timeToNextInstruction; - qreal m_distanceToNextInstruction; QGeoCoordinate m_waypoint; QVariantMap m_extendedAttributes; + qreal m_distanceToNextInstruction = 0.0; + QGeoManeuver::InstructionDirection m_direction = QGeoManeuver::NoDirection; + int m_timeToNextInstruction = 0; + bool m_valid = false; }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomappingmanager.cpp b/src/location/maps/qgeomappingmanager.cpp index e6af19b2..ef06199a 100644 --- a/src/location/maps/qgeomappingmanager.cpp +++ b/src/location/maps/qgeomappingmanager.cpp @@ -180,13 +180,11 @@ QLocale QGeoMappingManager::locale() const /******************************************************************************* *******************************************************************************/ -QGeoMappingManagerPrivate::QGeoMappingManagerPrivate() - : engine(0) {} +QGeoMappingManagerPrivate::QGeoMappingManagerPrivate() = default; QGeoMappingManagerPrivate::~QGeoMappingManagerPrivate() { delete engine; - engine = 0; } QT_END_NAMESPACE diff --git a/src/location/maps/qgeomappingmanager_p_p.h b/src/location/maps/qgeomappingmanager_p_p.h index e82e71c6..ab257a8b 100644 --- a/src/location/maps/qgeomappingmanager_p_p.h +++ b/src/location/maps/qgeomappingmanager_p_p.h @@ -59,7 +59,7 @@ public: QGeoMappingManagerPrivate(); ~QGeoMappingManagerPrivate(); - QGeoMappingManagerEngine *engine; + QGeoMappingManagerEngine *engine = nullptr; private: Q_DISABLE_COPY(QGeoMappingManagerPrivate) diff --git a/src/location/maps/qgeomappingmanagerengine.cpp b/src/location/maps/qgeomappingmanagerengine.cpp index 50b12d25..5d9f41d1 100644 --- a/src/location/maps/qgeomappingmanagerengine.cpp +++ b/src/location/maps/qgeomappingmanagerengine.cpp @@ -207,10 +207,7 @@ QLocale QGeoMappingManagerEngine::locale() const /******************************************************************************* *******************************************************************************/ -QGeoMappingManagerEnginePrivate::QGeoMappingManagerEnginePrivate() - : managerVersion(-1), - initialized(false) {} - -QGeoMappingManagerEnginePrivate::~QGeoMappingManagerEnginePrivate() {} +QGeoMappingManagerEnginePrivate::QGeoMappingManagerEnginePrivate() = default; +QGeoMappingManagerEnginePrivate::~QGeoMappingManagerEnginePrivate() = default; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomappingmanagerengine_p_p.h b/src/location/maps/qgeomappingmanagerengine_p_p.h index 4991ff69..17ff03fa 100644 --- a/src/location/maps/qgeomappingmanagerengine_p_p.h +++ b/src/location/maps/qgeomappingmanagerengine_p_p.h @@ -69,13 +69,12 @@ public: ~QGeoMappingManagerEnginePrivate(); QString managerName; - int managerVersion; - QList<QGeoMapType> supportedMapTypes; + QLocale locale; QGeoCameraCapabilities capabilities_; - QLocale locale; - bool initialized; + bool initialized = false; + int managerVersion = -1; private: Q_DISABLE_COPY(QGeoMappingManagerEnginePrivate) diff --git a/src/location/maps/qgeomaptype.cpp b/src/location/maps/qgeomaptype.cpp index adece18a..4d95f710 100644 --- a/src/location/maps/qgeomaptype.cpp +++ b/src/location/maps/qgeomaptype.cpp @@ -119,29 +119,16 @@ QVariantMap QGeoMapType::metadata() const return d_ptr->metadata_; } -QGeoMapTypePrivate::QGeoMapTypePrivate() -: style_(QGeoMapType::NoMap), mobile_(false), night_(false), mapId_(0) -{ -} - -QGeoMapTypePrivate::QGeoMapTypePrivate(const QGeoMapTypePrivate &other) -: QSharedData(other), style_(other.style_), name_(other.name_), description_(other.description_), - mobile_(other.mobile_), night_(other.night_), mapId_(other.mapId_), pluginName_(other.pluginName_), - cameraCapabilities_(other.cameraCapabilities_), metadata_(other.metadata_) -{ -} +QGeoMapTypePrivate::QGeoMapTypePrivate() = default; QGeoMapTypePrivate::QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name, const QString &description, bool mobile, bool night, int mapId, const QByteArray &pluginName, const QGeoCameraCapabilities &cameraCapabilities, const QVariantMap &metadata) -: style_(style), name_(name), description_(description), mobile_(mobile), night_(night), - mapId_(mapId), pluginName_(pluginName), cameraCapabilities_(cameraCapabilities), metadata_(metadata) -{ -} - -QGeoMapTypePrivate::~QGeoMapTypePrivate() +: name_(name), description_(description), pluginName_(pluginName), + cameraCapabilities_(cameraCapabilities), metadata_(metadata), + style_(style), mapId_(mapId), mobile_(mobile), night_(night) { } diff --git a/src/location/maps/qgeomaptype_p_p.h b/src/location/maps/qgeomaptype_p_p.h index 50ba7484..eef7e00a 100644 --- a/src/location/maps/qgeomaptype_p_p.h +++ b/src/location/maps/qgeomaptype_p_p.h @@ -69,22 +69,18 @@ public: bool night, int mapId, const QByteArray &pluginName, const QGeoCameraCapabilities &cameraCapabilities, const QVariantMap &metadata); - QGeoMapTypePrivate(const QGeoMapTypePrivate &other); - ~QGeoMapTypePrivate(); - QGeoMapTypePrivate &operator = (const QGeoMapTypePrivate &other); + bool operator==(const QGeoMapTypePrivate &other) const; - bool operator == (const QGeoMapTypePrivate &other) const; - - QGeoMapType::MapStyle style_; QString name_; QString description_; - bool mobile_; - bool night_; - int mapId_; QByteArray pluginName_; QGeoCameraCapabilities cameraCapabilities_; QVariantMap metadata_; + QGeoMapType::MapStyle style_ = QGeoMapType::NoMap; + int mapId_ = 0; + bool mobile_ = false; + bool night_ = false; }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeorouterequest.cpp b/src/location/maps/qgeorouterequest.cpp index 76d38567..f1b2c5fa 100644 --- a/src/location/maps/qgeorouterequest.cpp +++ b/src/location/maps/qgeorouterequest.cpp @@ -524,30 +524,11 @@ QVariantMap QGeoRouteRequest::extraParameters() const /******************************************************************************* *******************************************************************************/ -QGeoRouteRequestPrivate::QGeoRouteRequestPrivate() - : QSharedData(), - numberAlternativeRoutes(0), - travelModes(QGeoRouteRequest::CarTravel), - routeOptimization(QGeoRouteRequest::FastestRoute), - segmentDetail(QGeoRouteRequest::BasicSegmentData), - maneuverDetail(QGeoRouteRequest::BasicManeuvers) {} - -QGeoRouteRequestPrivate::QGeoRouteRequestPrivate(const QGeoRouteRequestPrivate &other) - : QSharedData(other), - waypoints(other.waypoints), - waypointMetadata(other.waypointMetadata), - excludeAreas(other.excludeAreas), - numberAlternativeRoutes(other.numberAlternativeRoutes), - travelModes(other.travelModes), - featureWeights(other.featureWeights), - routeOptimization(other.routeOptimization), - segmentDetail(other.segmentDetail), - maneuverDetail(other.maneuverDetail), - extraParameters(other.extraParameters) {} - -QGeoRouteRequestPrivate::~QGeoRouteRequestPrivate() {} - -bool QGeoRouteRequestPrivate::operator ==(const QGeoRouteRequestPrivate &other) const +QGeoRouteRequestPrivate::QGeoRouteRequestPrivate() = default; +QGeoRouteRequestPrivate::QGeoRouteRequestPrivate(const QGeoRouteRequestPrivate &other) = default; +QGeoRouteRequestPrivate::~QGeoRouteRequestPrivate() = default; + +bool QGeoRouteRequestPrivate::operator==(const QGeoRouteRequestPrivate &other) const { return ((waypoints == other.waypoints) && (waypointMetadata == other.waypointMetadata) diff --git a/src/location/maps/qgeorouterequest_p.h b/src/location/maps/qgeorouterequest_p.h index e6751835..23c2c924 100644 --- a/src/location/maps/qgeorouterequest_p.h +++ b/src/location/maps/qgeorouterequest_p.h @@ -68,18 +68,18 @@ public: QGeoRouteRequestPrivate(const QGeoRouteRequestPrivate &other); ~QGeoRouteRequestPrivate(); - bool operator ==(const QGeoRouteRequestPrivate &other) const; + bool operator==(const QGeoRouteRequestPrivate &other) const; QList<QGeoCoordinate> waypoints; QList<QVariantMap> waypointMetadata; QList<QGeoRectangle> excludeAreas; - int numberAlternativeRoutes; - QGeoRouteRequest::TravelModes travelModes; - QMap < QGeoRouteRequest::FeatureType, - QGeoRouteRequest::FeatureWeight > featureWeights; - QGeoRouteRequest::RouteOptimizations routeOptimization; - QGeoRouteRequest::SegmentDetail segmentDetail; - QGeoRouteRequest::ManeuverDetail maneuverDetail; + int numberAlternativeRoutes = 0; + QGeoRouteRequest::TravelModes travelModes = QGeoRouteRequest::CarTravel; + QMap <QGeoRouteRequest::FeatureType, + QGeoRouteRequest::FeatureWeight> featureWeights; + QGeoRouteRequest::RouteOptimizations routeOptimization = QGeoRouteRequest::FastestRoute; + QGeoRouteRequest::SegmentDetail segmentDetail = QGeoRouteRequest::BasicSegmentData; + QGeoRouteRequest::ManeuverDetail maneuverDetail = QGeoRouteRequest::BasicManeuvers; QDateTime departureTime; QVariantMap extraParameters; }; diff --git a/src/location/maps/qgeoroutingmanager.cpp b/src/location/maps/qgeoroutingmanager.cpp index 588b979f..3e8cd402 100644 --- a/src/location/maps/qgeoroutingmanager.cpp +++ b/src/location/maps/qgeoroutingmanager.cpp @@ -332,9 +332,7 @@ Use deleteLater() instead. /******************************************************************************* *******************************************************************************/ -QGeoRoutingManagerPrivate::QGeoRoutingManagerPrivate() - : engine(0) {} - +QGeoRoutingManagerPrivate::QGeoRoutingManagerPrivate() = default; QGeoRoutingManagerPrivate::~QGeoRoutingManagerPrivate() { delete engine; diff --git a/src/location/maps/qgeoroutingmanager_p.h b/src/location/maps/qgeoroutingmanager_p.h index c2ce066e..5dc86299 100644 --- a/src/location/maps/qgeoroutingmanager_p.h +++ b/src/location/maps/qgeoroutingmanager_p.h @@ -63,7 +63,7 @@ public: QGeoRoutingManagerPrivate(); ~QGeoRoutingManagerPrivate(); - QGeoRoutingManagerEngine *engine; + QGeoRoutingManagerEngine *engine = nullptr; private: Q_DISABLE_COPY(QGeoRoutingManagerPrivate) diff --git a/src/location/maps/qgeoroutingmanagerengine.cpp b/src/location/maps/qgeoroutingmanagerengine.cpp index 6434cb78..1493c209 100644 --- a/src/location/maps/qgeoroutingmanagerengine.cpp +++ b/src/location/maps/qgeoroutingmanagerengine.cpp @@ -413,14 +413,4 @@ This signal and QGeoRouteReply::error() will be emitted at the same time. Use deleteLater() instead. */ -/******************************************************************************* -*******************************************************************************/ - -QGeoRoutingManagerEnginePrivate::QGeoRoutingManagerEnginePrivate() -: managerVersion(-1), measurementSystem(locale.measurementSystem()) -{ -} - -QGeoRoutingManagerEnginePrivate::~QGeoRoutingManagerEnginePrivate() {} - QT_END_NAMESPACE diff --git a/src/location/maps/qgeoroutingmanagerengine_p.h b/src/location/maps/qgeoroutingmanagerengine_p.h index dd643df3..ef85fefd 100644 --- a/src/location/maps/qgeoroutingmanagerengine_p.h +++ b/src/location/maps/qgeoroutingmanagerengine_p.h @@ -62,12 +62,8 @@ QT_BEGIN_NAMESPACE class QGeoRoutingManagerEnginePrivate { public: - QGeoRoutingManagerEnginePrivate(); - ~QGeoRoutingManagerEnginePrivate(); - QString managerName; - int managerVersion; - + int managerVersion = -1; QGeoRouteRequest::TravelModes supportedTravelModes; QGeoRouteRequest::FeatureTypes supportedFeatureTypes; QGeoRouteRequest::FeatureWeights supportedFeatureWeights; @@ -76,10 +72,7 @@ public: QGeoRouteRequest::ManeuverDetails supportedManeuverDetails; QLocale locale; - QLocale::MeasurementSystem measurementSystem; - -private: - Q_DISABLE_COPY(QGeoRoutingManagerEnginePrivate) + QLocale::MeasurementSystem measurementSystem = locale.measurementSystem(); }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeotilefetcher.cpp b/src/location/maps/qgeotilefetcher.cpp index d05e46f7..cb1780bf 100644 --- a/src/location/maps/qgeotilefetcher.cpp +++ b/src/location/maps/qgeotilefetcher.cpp @@ -219,13 +219,4 @@ void QGeoTileFetcher::handleReply(QGeoTiledMapReply *reply, const QGeoTileSpec & /******************************************************************************* *******************************************************************************/ -QGeoTileFetcherPrivate::QGeoTileFetcherPrivate() -: QObjectPrivate(), enabled_(false), engine_(0) -{ -} - -QGeoTileFetcherPrivate::~QGeoTileFetcherPrivate() -{ -} - QT_END_NAMESPACE diff --git a/src/location/maps/qgeotilefetcher_p_p.h b/src/location/maps/qgeotilefetcher_p_p.h index 24774ecf..fcfebb70 100644 --- a/src/location/maps/qgeotilefetcher_p_p.h +++ b/src/location/maps/qgeotilefetcher_p_p.h @@ -74,18 +74,12 @@ class Q_LOCATION_PRIVATE_EXPORT QGeoTileFetcherPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QGeoTileFetcher) public: - QGeoTileFetcherPrivate(); - virtual ~QGeoTileFetcherPrivate(); - - bool enabled_; QBasicTimer timer_; QMutex queueMutex_; QList<QGeoTileSpec> queue_; QHash<QGeoTileSpec, QGeoTiledMapReply *> invmap_; - QGeoMappingManagerEngine *engine_; - -private: - Q_DISABLE_COPY(QGeoTileFetcherPrivate) + QGeoMappingManagerEngine *engine_ = nullptr; + bool enabled_ = false; }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeotilespec.cpp b/src/location/maps/qgeotilespec.cpp index 6690524d..db1fbadf 100644 --- a/src/location/maps/qgeotilespec.cpp +++ b/src/location/maps/qgeotilespec.cpp @@ -147,71 +147,7 @@ QDebug operator<< (QDebug dbg, const QGeoTileSpec &spec) return dbg; } -QGeoTileSpecPrivate::QGeoTileSpecPrivate() - : mapId_(0), - zoom_(-1), - x_(-1), - y_(-1), - version_(-1) {} - -QGeoTileSpecPrivate::QGeoTileSpecPrivate(const QGeoTileSpecPrivate &other) - : QSharedData(other), - plugin_(other.plugin_), - mapId_(other.mapId_), - zoom_(other.zoom_), - x_(other.x_), - y_(other.y_), - version_(other.version_) {} - -QGeoTileSpecPrivate::QGeoTileSpecPrivate(const QString &plugin, int mapId, int zoom, int x, int y, int version) - : plugin_(plugin), - mapId_(mapId), - zoom_(zoom), - x_(x), - y_(y), - version_(version) {} - -QGeoTileSpecPrivate::~QGeoTileSpecPrivate() {} - -QGeoTileSpecPrivate &QGeoTileSpecPrivate::operator = (const QGeoTileSpecPrivate &other) -{ - if (this == &other) - return *this; - - plugin_ = other.plugin_; - mapId_ = other.mapId_; - zoom_ = other.zoom_; - x_ = other.x_; - y_ = other.y_; - version_ = other.version_; - - return *this; -} - -bool QGeoTileSpecPrivate::operator == (const QGeoTileSpecPrivate &rhs) const -{ - if (plugin_ != rhs.plugin_) - return false; - - if (mapId_ != rhs.mapId_) - return false; - - if (zoom_ != rhs.zoom_) - return false; - - if (x_ != rhs.x_) - return false; - - if (y_ != rhs.y_) - return false; - - if (version_ != rhs.version_) - return false; - - return true; -} - -bool QGeoTileSpecPrivate::operator < (const QGeoTileSpecPrivate &rhs) const +bool QGeoTileSpecPrivate::operator<(const QGeoTileSpecPrivate &rhs) const { if (plugin_ < rhs.plugin_) return true; diff --git a/src/location/maps/qgeotilespec_p_p.h b/src/location/maps/qgeotilespec_p_p.h index 3a09eb3e..17df0b78 100644 --- a/src/location/maps/qgeotilespec_p_p.h +++ b/src/location/maps/qgeotilespec_p_p.h @@ -58,22 +58,29 @@ QT_BEGIN_NAMESPACE class QGeoTileSpecPrivate : public QSharedData { public: - QGeoTileSpecPrivate(); - QGeoTileSpecPrivate(const QGeoTileSpecPrivate &other); - QGeoTileSpecPrivate(const QString &plugin, int mapId, int zoom, int x, int y, int version); - ~QGeoTileSpecPrivate(); + QGeoTileSpecPrivate(const QString &plugin = {}, int mapId = 0, + int zoom = -1, int x = -1, int y = -1, int version = -1) + : plugin_(plugin), mapId_(mapId), zoom_(zoom), + x_(x), y_(y), version_(version) + {} - QGeoTileSpecPrivate &operator = (const QGeoTileSpecPrivate &other); - - bool operator == (const QGeoTileSpecPrivate &rhs) const; - bool operator < (const QGeoTileSpecPrivate &rhs) const; + inline bool operator==(const QGeoTileSpecPrivate &rhs) const + { + return mapId_ == rhs.mapId_ + && zoom_ == rhs.zoom_ + && x_ == rhs.x_ + && y_ == rhs.y_ + && version_ == rhs.version_ + && plugin_ == rhs.plugin_; + } + bool operator<(const QGeoTileSpecPrivate &rhs) const; QString plugin_; - int mapId_; - int zoom_; - int x_; - int y_; - int version_; + int mapId_ = 0; + int zoom_ = -1; + int x_ = -1; + int y_ = -1; + int version_ = -1; }; QT_END_NAMESPACE diff --git a/src/location/maps/qnavigationmanager.cpp b/src/location/maps/qnavigationmanager.cpp index dbb56942..3b5e73b0 100644 --- a/src/location/maps/qnavigationmanager.cpp +++ b/src/location/maps/qnavigationmanager.cpp @@ -54,15 +54,10 @@ private: Q_DISABLE_COPY(QNavigationManagerPrivate) }; -QNavigationManagerPrivate::QNavigationManagerPrivate() -{ - -} - +QNavigationManagerPrivate::QNavigationManagerPrivate() = default; QNavigationManagerPrivate::~QNavigationManagerPrivate() { delete engine; - engine = nullptr; } QNavigationManager::~QNavigationManager() |