KPublicTransport

attribution.h
1 /*
2  SPDX-FileCopyrightText: 2019 Volker Krause <[email protected]>
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 
15 class QJsonArray;
16 class QJsonObject;
17 class QString;
18 class QUrl;
19 
20 namespace KPublicTransport {
21 
22 class 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  */
28 class 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 
43 public:
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 
61 Q_DECLARE_METATYPE(KPublicTransport::Attribution)
62 
63 #endif // KPUBLICTRANSPORT_ATTRIBUTION_H
Query operations and data types for accessing realtime public transport information from online servi...
Definition: attribution.cpp:16
Copyright and license information about the provided data.
Definition: attribution.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 23 2021 23:05:20 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.