KPublicTransport

individualtransport.h
1 /*
2  SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KPUBLICTRANSPORT_INDIVIDUALTRANSPORT_H
8 #define KPUBLICTRANSPORT_INDIVIDUALTRANSPORT_H
9 
10 #include "kpublictransport_export.h"
11 #include "datatypes.h"
12 
13 namespace KPublicTransport {
14 
15 class IndividualTransportPrivate;
16 
17 /** Individual transport mode details for a journey section, and for specifying journey requests. */
18 class KPUBLICTRANSPORT_EXPORT IndividualTransport
19 {
20  KPUBLICTRANSPORT_GADGET(IndividualTransport)
21 public:
22  /** Mode of (individual) transportation. */
23  enum Mode {
24  Walk,
25  Bike,
26  Car
27  };
28  Q_ENUM(Mode)
29  KPUBLICTRANSPORT_PROPERTY(Mode, mode, setMode)
30 
31 public:
32  /** Qualifier on how the mode of transport is used. */
33  enum Qualifier {
34  None, ///< not applicable, or bike is taken on public transport legs.
35  Park, ///< for access legs, vehicle is parked before taking public transport.
36  Rent, ///< use a rental vehicle
37  Dropoff, ///< for access legs: vehicle is not taken onto public transport but also doesn't need parking
38  Pickup, ///< for egress legs: vehicle is available at the last public transport leg
39  };
40  Q_ENUM(Qualifier)
41  KPUBLICTRANSPORT_PROPERTY(Qualifier, qualifier, setQualifier)
42 
43 public:
44  IndividualTransport(Mode mode, Qualifier qualifier = None);
45 
46  bool operator==(const IndividualTransport &other) const;
47  bool operator!=(const IndividualTransport &other) const;
48 
49  /** Serializes one object to JSON. */
50  static QJsonObject toJson(const IndividualTransport &it);
51  /** Serializes a vector of objects to JSON. */
52  static QJsonArray toJson(const std::vector<IndividualTransport> &its);
53  /** Deserialize an object from JSON. */
54  static IndividualTransport fromJson(const QJsonObject &obj);
55  /** Deserialize a list of journey from JSON. */
56  static std::vector<IndividualTransport> fromJson(const QJsonArray &array);
57 
58  /** @internal for QML bindings only */
59  static std::vector<IndividualTransport> fromVariant(const QVariantList &v);
60 };
61 
62 }
63 
64 Q_DECLARE_METATYPE(KPublicTransport::IndividualTransport)
65 
66 #endif // KPUBLICTRANSPORT_INDIVIDUALTRANSPORT_H
for access legs, vehicle is parked before taking public transport.
Query operations and data types for accessing realtime public transport information from online servi...
Definition: attribution.cpp:16
for access legs: vehicle is not taken onto public transport but also doesn&#39;t need parking ...
Individual transport mode details for a journey section, and for specifying journey requests...
not applicable, or bike is taken on public transport legs.
for egress legs: vehicle is available at the last public transport leg
Qualifier
Qualifier on how the mode of transport is used.
Mode
Mode of (individual) transportation.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Nov 29 2021 22:56:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.