KPublicTransport

attribution.h
1/*
2 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KPUBLICTRANSPORT_ATTRIBUTION_H
8#define KPUBLICTRANSPORT_ATTRIBUTION_H
9
10#include "kpublictransport_export.h"
11#include "datatypes.h"
12
13#include <vector>
14
15class QJsonArray;
16class QJsonObject;
17class QString;
18class QUrl;
19
20namespace KPublicTransport {
21
22class AttributionPrivate;
23
24/** Copyright and license information about the provided data.
25 * Should be displayed by the application in order to comply with licenses and/or terms and conditions
26 * of the data providers.
27 */
28class KPUBLICTRANSPORT_EXPORT Attribution
29{
30 KPUBLICTRANSPORT_GADGET(Attribution)
31 /** Name of the entity providing the data. */
32 KPUBLICTRANSPORT_PROPERTY(QString, name, setName)
33 /** Link to the entity providing the data. */
34 KPUBLICTRANSPORT_PROPERTY(QUrl, url, setUrl)
35 /** Name of the license for the provided data. */
36 KPUBLICTRANSPORT_PROPERTY(QString, license, setLicense)
37 /** Link to the license or terms and conditions text. */
38 KPUBLICTRANSPORT_PROPERTY(QUrl, licenseUrl, setLicenseUrl)
39
40 /** @c true if there is license information for this attribution object. */
41 Q_PROPERTY(bool hasLicense READ hasLicense STORED false)
42
43public:
44 /** Returns @c true if this is an empty or default-constructed Attribution object. */
45 bool isEmpty() const;
46
47 bool hasLicense() const;
48
49 /** Serializes one Attribution object to JSON. */
50 static QJsonObject toJson(const Attribution &attr);
51 /** Serializes an array of Attribution objects to JSON. */
52 static QJsonArray toJson(const std::vector<Attribution> &attrs);
53 /** Deserialize an Attribution object from JSON. */
54 static Attribution fromJson(const QJsonObject &obj);
55 /** Dezerializes an array of Attribution objects from JSON. */
56 static std::vector<Attribution> fromJson(const QJsonArray &a);
57};
58
59}
60
61Q_DECLARE_METATYPE(KPublicTransport::Attribution)
62
63#endif // KPUBLICTRANSPORT_ATTRIBUTION_H
Copyright and license information about the provided data.
Definition attribution.h:29
Query operations and data types for accessing realtime public transport information from online servi...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:10:39 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.