KItinerary

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

KDE's Doxygen guidelines are available online.