KPublicTransport

load.cpp
1 /*
2  SPDX-FileCopyrightText: 2020 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "load.h"
8 #include "datatypes_p.h"
9 #include "json_p.h"
10 
11 using namespace KPublicTransport;
12 
13 namespace KPublicTransport {
14 class LoadInfoPrivate : public QSharedData
15 {
16 public:
18  QString seatingClass;
19 };
20 }
21 
22 KPUBLICTRANSPORT_MAKE_GADGET(LoadInfo)
23 KPUBLICTRANSPORT_MAKE_PROPERTY(LoadInfo, Load::Category, load, setLoad)
24 KPUBLICTRANSPORT_MAKE_PROPERTY(LoadInfo, QString, seatingClass, setSeatingClass)
25 
26 QJsonObject LoadInfo::toJson(const LoadInfo &info)
27 {
28  return Json::toJson(info);
29 }
30 
31 QJsonArray LoadInfo::toJson(const std::vector<LoadInfo> &loadInfos)
32 {
33  return Json::toJson(loadInfos);
34 }
35 
37 {
38  return Json::fromJson<LoadInfo>(obj);
39 }
40 
41 std::vector<LoadInfo> LoadInfo::fromJson(const QJsonArray &array)
42 {
43  return Json::fromJson<LoadInfo>(array);
44 }
45 
46 #include "moc_load.cpp"
Query operations and data types for accessing realtime public transport information from online servi...
Definition: attribution.cpp:16
Vehicle load information.
Definition: load.h:37
QAction * load(const QObject *recvr, const char *slot, QObject *parent)
no load information are available
Definition: load.h:21
Category
Vehicle load categories.
Definition: load.h:20
static LoadInfo fromJson(const QJsonObject &obj)
Deserialize an object from JSON.
Definition: load.cpp:36
static QJsonObject toJson(const LoadInfo &info)
Serializes one load information object to JSON.
Definition: load.cpp:26
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Oct 15 2021 23:07:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.