KItinerary

place.h
1 /*
2  SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "kitinerary_export.h"
10 
11 #include "datatypes.h"
12 
13 
14 namespace KItinerary {
15 
16 class GeoCoordinatesPrivate;
17 
18 /** Geographic coordinates.
19  * @see https://schema.org/GeoCoordinates
20  */
21 class KITINERARY_EXPORT GeoCoordinates
22 {
23  KITINERARY_GADGET(GeoCoordinates)
24  KITINERARY_PROPERTY(float, latitude, setLatitude)
25  KITINERARY_PROPERTY(float, longitude, setLongitude)
26 
27  Q_PROPERTY(bool isValid READ isValid STORED false)
28 public:
29  GeoCoordinates(float latitude, float longitude);
30 
31  /** Returns @c true if both latitude and longitude are set and within
32  * the valid range.
33  */
34  bool isValid() const;
35 private:
37 };
38 
39 class PostalAddressPrivate;
40 
41 /** Postal address.
42  * @see https://schema.org/PostalAddress
43  */
44 class KITINERARY_EXPORT PostalAddress
45 {
46  KITINERARY_GADGET(PostalAddress)
47  KITINERARY_PROPERTY(QString, streetAddress, setStreetAddress)
48  KITINERARY_PROPERTY(QString, addressLocality, setAddressLocality)
49  KITINERARY_PROPERTY(QString, postalCode, setPostalCode)
50  KITINERARY_PROPERTY(QString, addressRegion, setAddressRegion)
51  /** The country this address is in, as ISO 3166-1 alpha 2 code. */
52  KITINERARY_PROPERTY(QString, addressCountry, setAddressCountry)
53 
54  Q_PROPERTY(bool isEmpty READ isEmpty STORED false)
55 public:
56  /** Returns @c true if there is no property set in this object. */
57  bool isEmpty() const;
58 private:
59  QExplicitlySharedDataPointer<PostalAddressPrivate> d;
60 };
61 
62 class PlacePrivate;
63 
64 /** Base class for places.
65  * @see https://schema.org/Place
66  */
67 class KITINERARY_EXPORT Place
68 {
69  KITINERARY_BASE_GADGET(Place)
70  KITINERARY_PROPERTY(QString, name, setName)
71  KITINERARY_PROPERTY(KItinerary::PostalAddress, address, setAddress)
72  KITINERARY_PROPERTY(KItinerary::GeoCoordinates, geo, setGeo)
73  KITINERARY_PROPERTY(QString, telephone, setTelephone)
74  /** Identifier.
75  * We use the following schemas currently:
76  * - 'uic:', UIC station code (see https://www.wikidata.org/wiki/Property:P722)
77  * - 'sncf:', SNCF station id (see https://www.wikidata.org/wiki/Property:P8181), French train station identifier.
78  * - 'ibnr:', Internationale Bahnhofsnummer (see https://www.wikidata.org/wiki/Property:P954), German train station identifier.
79  * - 'ir:', Indian Railways station code (see https://www.wikidata.org/wiki/Property:P5696).
80  * - 'vrfi:', Finish railway station codes.
81  * - 'benerail:', Belgian railway station codes.
82  * @see http://schema.org/docs/datamodel.html#identifierBg
83  */
84  KITINERARY_PROPERTY(QString, identifier, setIdentifier)
85 protected:
86  ///@cond internal
87  QExplicitlySharedDataPointer<PlacePrivate> d;
88  ///@endcond
89 };
90 
91 /** Airport.
92  * @see https://schema.org/Airport.
93  */
94 class KITINERARY_EXPORT Airport : public Place
95 {
96  KITINERARY_GADGET(Airport)
97  KITINERARY_PROPERTY(QString, iataCode, setIataCode)
98 };
99 
100 /** Boat or ferry terminal.
101  * @see https://schema.org/BoatTerminal
102  */
103 class KITINERARY_EXPORT BoatTerminal : public Place
104 {
105  KITINERARY_GADGET(BoatTerminal)
106 };
107 
108 /** Train station.
109  * @see https://schema.org/TrainStation
110  */
111 class KITINERARY_EXPORT TrainStation : public Place
112 {
113  KITINERARY_GADGET(TrainStation)
114 };
115 
116 /** Bus station.
117  * @see https://schema.org/BusStation
118  */
119 class KITINERARY_EXPORT BusStation : public Place
120 {
121  KITINERARY_GADGET(BusStation)
122 };
123 
124 
125 /** Tourist attraction (e.g. Museum, sight, etc.).
126  * @see https://schema.org/TouristAttraction
127  */
128 class KITINERARY_EXPORT TouristAttraction : public Place
129 {
130  KITINERARY_GADGET(TouristAttraction)
131 };
132 
133 }
134 
135 Q_DECLARE_METATYPE(KItinerary::Place)
136 Q_DECLARE_METATYPE(KItinerary::GeoCoordinates)
137 Q_DECLARE_METATYPE(KItinerary::PostalAddress)
138 Q_DECLARE_METATYPE(KItinerary::Airport)
139 Q_DECLARE_METATYPE(KItinerary::BoatTerminal)
140 Q_DECLARE_METATYPE(KItinerary::TrainStation)
141 Q_DECLARE_METATYPE(KItinerary::BusStation)
142 Q_DECLARE_METATYPE(KItinerary::TouristAttraction)
143 
Classes for reservation/travel data models, data extraction and data augmentation.
Tourist attraction (e.g.
Definition: place.h:128
Train station.
Definition: place.h:111
Base class for places.
Definition: place.h:67
Geographic coordinates.
Definition: place.h:21
Boat or ferry terminal.
Definition: place.h:103
Postal address.
Definition: place.h:44
Airport.
Definition: place.h:94
Bus station.
Definition: place.h:119
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Oct 24 2021 23:15:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.