summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-14 15:44:46 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-20 13:42:00 +0200
commite534ad70e047f4c9b52f77dc0b740fcaa6208667 (patch)
treef90cda594fe7475fd9aab7e40b82fbe22850ba99
parentc7ae3541cbdda1453a32288ead37382cb7d1b863 (diff)
downloadqtlocation-e534ad70e047f4c9b52f77dc0b740fcaa6208667.tar.gz
Cleanup: de-virtualize QGeoManeuverPrivate
The possibility to override this type in plugins is not used anywhere, and overcomplicates the code. There isn't even a way to create a QGeoManeuver with a reimplementation of the private. So remove this; if this is really needed for anything, then we can bring it back later. Change-Id: I4edf78a21f53593e609f6e86e04464d4e974b0df Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> (cherry picked from commit 87eb1a45b83e6044d7d0c83f98f419c8fbd5e007) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/location/maps/qgeomaneuver.cpp147
-rw-r--r--src/location/maps/qgeomaneuver_p.h79
2 files changed, 41 insertions, 185 deletions
diff --git a/src/location/maps/qgeomaneuver.cpp b/src/location/maps/qgeomaneuver.cpp
index f50f6c8d..4d8455c0 100644
--- a/src/location/maps/qgeomaneuver.cpp
+++ b/src/location/maps/qgeomaneuver.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
@@ -45,12 +45,6 @@
QT_BEGIN_NAMESPACE
-template<>
-QGeoManeuverPrivate *QSharedDataPointer<QGeoManeuverPrivate>::clone()
-{
- return d->clone();
-}
-
QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoManeuverPrivate)
/*!
@@ -155,7 +149,7 @@ The instruction indicates that the direction of travel should bear to the left.
setWaypoint() is called.
*/
QGeoManeuver::QGeoManeuver()
- : d_ptr(new QGeoManeuverPrivateDefault()) {}
+ : d_ptr(new QGeoManeuverPrivate()) {}
/*!
Constructs a maneuver object from the contents of \a other.
@@ -419,196 +413,95 @@ bool QGeoManeuverPrivate::equals(const QGeoManeuverPrivate &other) const
&& (waypoint() == other.waypoint()));
}
-bool QGeoManeuverPrivate::valid() const
-{
- return false;
-}
-
-void QGeoManeuverPrivate::setValid(bool valid)
-{
- Q_UNUSED(valid);
-}
-
-QString QGeoManeuverPrivate::id() const
-{
- return QString();
-}
-
-void QGeoManeuverPrivate::setId(const QString &id)
-{
- Q_UNUSED(id);
-}
-
-QGeoCoordinate QGeoManeuverPrivate::position() const
-{
- return QGeoCoordinate();
-}
-
-void QGeoManeuverPrivate::setPosition(const QGeoCoordinate &position)
-{
- Q_UNUSED(position);
-}
-
-QString QGeoManeuverPrivate::text() const
-{
- return QString();
-}
-
-void QGeoManeuverPrivate::setText(const QString &text)
-{
- Q_UNUSED(text);
-}
-
-QGeoManeuver::InstructionDirection QGeoManeuverPrivate::direction() const
-{
- return QGeoManeuver::NoDirection;
-}
-
-void QGeoManeuverPrivate::setDirection(QGeoManeuver::InstructionDirection direction)
-{
- Q_UNUSED(direction);
-}
-
-int QGeoManeuverPrivate::timeToNextInstruction() const
-{
- return 0;
-}
-
-void QGeoManeuverPrivate::setTimeToNextInstruction(int timeToNextInstruction)
-{
- Q_UNUSED(timeToNextInstruction);
-}
-
-qreal QGeoManeuverPrivate::distanceToNextInstruction() const
-{
- return 0;
-}
-
-void QGeoManeuverPrivate::setDistanceToNextInstruction(qreal distanceToNextInstruction)
-{
- Q_UNUSED(distanceToNextInstruction);
-}
-
-QGeoCoordinate QGeoManeuverPrivate::waypoint() const
-{
- return QGeoCoordinate();
-}
-
-void QGeoManeuverPrivate::setWaypoint(const QGeoCoordinate &waypoint)
-{
- Q_UNUSED(waypoint);
-}
-
-QVariantMap QGeoManeuverPrivate::extendedAttributes() const
-{
- return QVariantMap();
-}
-
-void QGeoManeuverPrivate::setExtendedAttributes(const QVariantMap &extendedAttributes)
-{
- Q_UNUSED(extendedAttributes);
-}
-
-
-
/*******************************************************************************
*******************************************************************************/
-QGeoManeuverPrivate::~QGeoManeuverPrivate() = default;
-
-QGeoManeuverPrivateDefault::~QGeoManeuverPrivateDefault() = default;
-
-QGeoManeuverPrivate *QGeoManeuverPrivateDefault::clone()
-{
- return new QGeoManeuverPrivateDefault(*this);
-}
-
-bool QGeoManeuverPrivateDefault::valid() const
+bool QGeoManeuverPrivate::valid() const
{
return m_valid;
}
-void QGeoManeuverPrivateDefault::setValid(bool valid)
+void QGeoManeuverPrivate::setValid(bool valid)
{
m_valid = valid;
}
-QString QGeoManeuverPrivateDefault::id() const
+QString QGeoManeuverPrivate::id() const
{
return m_id;
}
-void QGeoManeuverPrivateDefault::setId(const QString &id)
+void QGeoManeuverPrivate::setId(const QString &id)
{
m_id = id;
}
-QGeoCoordinate QGeoManeuverPrivateDefault::position() const
+QGeoCoordinate QGeoManeuverPrivate::position() const
{
return m_position;
}
-void QGeoManeuverPrivateDefault::setPosition(const QGeoCoordinate &position)
+void QGeoManeuverPrivate::setPosition(const QGeoCoordinate &position)
{
m_position = position;
}
-QString QGeoManeuverPrivateDefault::text() const
+QString QGeoManeuverPrivate::text() const
{
return m_text;
}
-void QGeoManeuverPrivateDefault::setText(const QString &text)
+void QGeoManeuverPrivate::setText(const QString &text)
{
m_text = text;
}
-QGeoManeuver::InstructionDirection QGeoManeuverPrivateDefault::direction() const
+QGeoManeuver::InstructionDirection QGeoManeuverPrivate::direction() const
{
return m_direction;
}
-void QGeoManeuverPrivateDefault::setDirection(QGeoManeuver::InstructionDirection direction)
+void QGeoManeuverPrivate::setDirection(QGeoManeuver::InstructionDirection direction)
{
m_direction = direction;
}
-int QGeoManeuverPrivateDefault::timeToNextInstruction() const
+int QGeoManeuverPrivate::timeToNextInstruction() const
{
return m_timeToNextInstruction;
}
-void QGeoManeuverPrivateDefault::setTimeToNextInstruction(int timeToNextInstruction)
+void QGeoManeuverPrivate::setTimeToNextInstruction(int timeToNextInstruction)
{
m_timeToNextInstruction = timeToNextInstruction;
}
-qreal QGeoManeuverPrivateDefault::distanceToNextInstruction() const
+qreal QGeoManeuverPrivate::distanceToNextInstruction() const
{
return m_distanceToNextInstruction;
}
-void QGeoManeuverPrivateDefault::setDistanceToNextInstruction(qreal distanceToNextInstruction)
+void QGeoManeuverPrivate::setDistanceToNextInstruction(qreal distanceToNextInstruction)
{
m_distanceToNextInstruction = distanceToNextInstruction;
}
-QGeoCoordinate QGeoManeuverPrivateDefault::waypoint() const
+QGeoCoordinate QGeoManeuverPrivate::waypoint() const
{
return m_waypoint;
}
-void QGeoManeuverPrivateDefault::setWaypoint(const QGeoCoordinate &waypoint)
+void QGeoManeuverPrivate::setWaypoint(const QGeoCoordinate &waypoint)
{
m_waypoint = waypoint;
}
-QVariantMap QGeoManeuverPrivateDefault::extendedAttributes() const
+QVariantMap QGeoManeuverPrivate::extendedAttributes() const
{
return m_extendedAttributes;
}
-void QGeoManeuverPrivateDefault::setExtendedAttributes(const QVariantMap &extendedAttributes)
+void QGeoManeuverPrivate::setExtendedAttributes(const QVariantMap &extendedAttributes)
{
m_extendedAttributes = extendedAttributes;
}
diff --git a/src/location/maps/qgeomaneuver_p.h b/src/location/maps/qgeomaneuver_p.h
index e88a57eb..52f8a0bf 100644
--- a/src/location/maps/qgeomaneuver_p.h
+++ b/src/location/maps/qgeomaneuver_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
@@ -60,74 +60,37 @@
QT_BEGIN_NAMESPACE
-class Q_LOCATION_PRIVATE_EXPORT QGeoManeuverPrivate : public QSharedData
+class QGeoManeuverPrivate : public QSharedData
{
public:
- virtual ~QGeoManeuverPrivate();
- virtual QGeoManeuverPrivate *clone() = 0;
+ bool equals(const QGeoManeuverPrivate &other) const;
- virtual bool valid() const;
- virtual void setValid(bool valid);
+ bool valid() const;
+ void setValid(bool valid);
- virtual QString id() const;
- virtual void setId(const QString &id);
+ QString id() const;
+ void setId(const QString &id);
- virtual QGeoCoordinate position() const;
- virtual void setPosition(const QGeoCoordinate &position);
+ QGeoCoordinate position() const;
+ void setPosition(const QGeoCoordinate &position);
- virtual QString text() const;
- virtual void setText(const QString &text);
+ QString text() const;
+ void setText(const QString &text);
- virtual QGeoManeuver::InstructionDirection direction() const;
- virtual void setDirection(QGeoManeuver::InstructionDirection direction);
+ QGeoManeuver::InstructionDirection direction() const;
+ void setDirection(QGeoManeuver::InstructionDirection direction);
- virtual int timeToNextInstruction() const;
- virtual void setTimeToNextInstruction(int timeToNextInstruction);
+ int timeToNextInstruction() const;
+ void setTimeToNextInstruction(int timeToNextInstruction);
- virtual qreal distanceToNextInstruction() const;
- virtual void setDistanceToNextInstruction(qreal distanceToNextInstruction);
+ qreal distanceToNextInstruction() const;
+ void setDistanceToNextInstruction(qreal distanceToNextInstruction);
- virtual QGeoCoordinate waypoint() const;
- virtual void setWaypoint(const QGeoCoordinate &waypoint);
+ QGeoCoordinate waypoint() const;
+ void setWaypoint(const QGeoCoordinate &waypoint);
- virtual QVariantMap extendedAttributes() const;
- virtual void setExtendedAttributes(const QVariantMap &extendedAttributes);
-
- virtual bool equals(const QGeoManeuverPrivate &other) const;
-};
-
-class Q_LOCATION_PRIVATE_EXPORT QGeoManeuverPrivateDefault : public QGeoManeuverPrivate
-{
-public:
- ~QGeoManeuverPrivateDefault();
- QGeoManeuverPrivate *clone() override;
-
- bool valid() const override;
- void setValid(bool valid) override;
-
- QString id() const override;
- void setId(const QString &id) override;
-
- QGeoCoordinate position() const override;
- void setPosition(const QGeoCoordinate &position) override;
-
- QString text() const override;
- void setText(const QString &text) override;
-
- QGeoManeuver::InstructionDirection direction() const override;
- void setDirection(QGeoManeuver::InstructionDirection direction) override;
-
- int timeToNextInstruction() const override;
- void setTimeToNextInstruction(int timeToNextInstruction) override;
-
- qreal distanceToNextInstruction() const override;
- void setDistanceToNextInstruction(qreal distanceToNextInstruction) override;
-
- QGeoCoordinate waypoint() const override;
- void setWaypoint(const QGeoCoordinate &waypoint) override;
-
- QVariantMap extendedAttributes() const override;
- void setExtendedAttributes(const QVariantMap &extendedAttributes) override;
+ QVariantMap extendedAttributes() const;
+ void setExtendedAttributes(const QVariantMap &extendedAttributes);
QString m_id;
QGeoCoordinate m_position;