diff options
Diffstat (limited to 'src/location/places/qplacecontent.h')
-rw-r--r-- | src/location/places/qplacecontent.h | 85 |
1 files changed, 58 insertions, 27 deletions
diff --git a/src/location/places/qplacecontent.h b/src/location/places/qplacecontent.h index f1a6ea7f..a955e024 100644 --- a/src/location/places/qplacecontent.h +++ b/src/location/places/qplacecontent.h @@ -41,23 +41,19 @@ #include <QtLocation/qlocationglobal.h> +#include <QtCore/QExplicitlySharedDataPointer> #include <QtCore/QMap> #include <QtCore/QMetaType> -#include <QtCore/QSharedDataPointer> +#include <QtCore/QVariant> -QT_BEGIN_NAMESPACE - -#define Q_DECLARE_CONTENT_D_FUNC(Class) \ - inline Class##Private *d_func(); \ - inline const Class##Private *d_func() const;\ - friend class Class##Private; +#include <QtLocation/QPlaceUser> +#include <QtLocation/QPlaceSupplier> -#define Q_DECLARE_CONTENT_COPY_CTOR(Class) \ - Class(const QPlaceContent &other); +QT_BEGIN_NAMESPACE -class QPlaceUser; -class QPlaceSupplier; class QPlaceContentPrivate; +QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceContentPrivate, Q_LOCATION_EXPORT) + class Q_LOCATION_EXPORT QPlaceContent { public: @@ -71,34 +67,69 @@ public: CustomType = 0x0100 }; - QPlaceContent(); - QPlaceContent(const QPlaceContent &other); - virtual ~QPlaceContent(); + enum DataTag { + ContentSupplier, + ContentUser, + ContentAttribution, + ImageId, + ImageUrl, + ImageMimeType, + EditorialTitle, + EditorialText, + EditorialLanguage, + ReviewId, + ReviewDateTime, + ReviewTitle, + ReviewText, + ReviewLanguage, + ReviewRating, + CustomDataTag = 1000 + }; + + QPlaceContent(Type type = NoType); + ~QPlaceContent(); + + QPlaceContent(const QPlaceContent &other) noexcept; + QPlaceContent &operator=(const QPlaceContent &other) noexcept; - QPlaceContent &operator=(const QPlaceContent &other); + QPlaceContent(QPlaceContent &&other) noexcept = default; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceContent) + void swap(QPlaceContent &other) noexcept + { d_ptr.swap(other.d_ptr); } + void detach(); bool operator==(const QPlaceContent &other) const; bool operator!=(const QPlaceContent &other) const; QPlaceContent::Type type() const; - QPlaceSupplier supplier() const; - void setSupplier(const QPlaceSupplier &supplier); - - QPlaceUser user() const; - void setUser(const QPlaceUser &user); - - QString attribution() const; - void setAttribution(const QString &attribution); + QList<DataTag> dataTags() const; + QVariant value(DataTag tag) const; + void setValue(DataTag tag, const QVariant &); + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use value()") QPlaceSupplier supplier() const + { return value(QPlaceContent::ContentSupplier).value<QPlaceSupplier>(); } + QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setSupplier(const QPlaceSupplier &supplier) + { setValue(QPlaceContent::ContentSupplier, QVariant::fromValue(supplier)); } + + QT_DEPRECATED_VERSION_X_6_0("Use value()") QPlaceUser user() const + { return value(QPlaceContent::ContentUser).value<QPlaceUser>(); } + QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setUser(const QPlaceUser &user) + { setValue(QPlaceContent::ContentUser, QVariant::fromValue(user)); } + + QT_DEPRECATED_VERSION_X_6_0("Use value()") QString attribution() const + { return value(QPlaceContent::ContentAttribution).value<QString>(); } + QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setAttribution(const QString &attribution) + { setValue(QPlaceContent::ContentAttribution, QVariant::fromValue(attribution)); } +#endif protected: - explicit QPlaceContent(QPlaceContentPrivate *d); - QSharedDataPointer<QPlaceContentPrivate> d_ptr; - -private: inline QPlaceContentPrivate *d_func(); inline const QPlaceContentPrivate *d_func() const; +private: + QExplicitlySharedDataPointer<QPlaceContentPrivate> d_ptr; friend class QPlaceContentPrivate; }; |