KItinerary

reservation.cpp
1/*
2 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "reservation.h"
8#include "datatypes_p.h"
9
10#include <QDateTime>
11#include <QList>
12#include <QUrl>
13#include <QVariant>
14
15#include <cmath>
16
17using namespace KItinerary;
18
19namespace KItinerary {
20
21class ReservationPrivate : public QSharedData
22{
23 KITINERARY_PRIVATE_BASE_GADGET(Reservation)
24public:
25 QString reservationNumber;
26 QVariant reservationFor;
27 QVariant reservedTicket;
28 QVariant underName;
29 QUrl url;
30 QString pkpassPassTypeIdentifier;
31 QString pkpassSerialNumber;
32 Organization provider;
33 QVariantList potentialAction;
34 QDateTime modifiedTime;
35 QVariantList subjectOf;
36 Reservation::ReservationStatus reservationStatus = Reservation::ReservationConfirmed;
37 ProgramMembership programMembershipUsed;
38 double totalPrice = NAN;
39 QString priceCurrency;
40};
41
42KITINERARY_MAKE_CLASS(Reservation)
43KITINERARY_MAKE_PROPERTY(Reservation, QString, reservationNumber, setReservationNumber)
44KITINERARY_MAKE_PROPERTY(Reservation, QVariant, reservationFor, setReservationFor)
45KITINERARY_MAKE_PROPERTY(Reservation, QVariant, reservedTicket, setReservedTicket)
46KITINERARY_MAKE_PROPERTY(Reservation, QVariant, underName, setUnderName)
47KITINERARY_MAKE_PROPERTY(Reservation, QUrl, url, setUrl)
48KITINERARY_MAKE_PROPERTY(Reservation, QString, pkpassPassTypeIdentifier, setPkpassPassTypeIdentifier)
49KITINERARY_MAKE_PROPERTY(Reservation, QString, pkpassSerialNumber, setPkpassSerialNumber)
50KITINERARY_MAKE_PROPERTY(Reservation, Organization, provider, setProvider)
51KITINERARY_MAKE_PROPERTY(Reservation, QVariantList, potentialAction, setPotentialAction)
52KITINERARY_MAKE_PROPERTY(Reservation, QDateTime, modifiedTime, setModifiedTime)
53KITINERARY_MAKE_PROPERTY(Reservation, QVariantList, subjectOf, setSubjectOf)
54KITINERARY_MAKE_PROPERTY(Reservation, Reservation::ReservationStatus, reservationStatus, setReservationStatus)
55KITINERARY_MAKE_PROPERTY(Reservation, ProgramMembership, programMembershipUsed, setProgramMembershipUsed)
56KITINERARY_MAKE_PROPERTY(Reservation, double, totalPrice, setTotalPrice)
57KITINERARY_MAKE_PROPERTY(Reservation, QString, priceCurrency, setPriceCurrency)
58KITINERARY_MAKE_OPERATOR(Reservation)
59
60class LodgingReservationPrivate : public ReservationPrivate
61{
62 KITINERARY_PRIVATE_GADGET(LodgingReservation)
63public:
64 QDateTime checkinTime;
65 QDateTime checkoutTime;
66};
67KITINERARY_MAKE_DERIVED_CLASS(LodgingReservation, Reservation)
68KITINERARY_MAKE_PROPERTY(LodgingReservation, QDateTime, checkinTime, setCheckinTime)
69KITINERARY_MAKE_PROPERTY(LodgingReservation, QDateTime, checkoutTime, setCheckoutTime)
70KITINERARY_MAKE_OPERATOR(LodgingReservation)
71
72
73class FlightReservationPrivate : public ReservationPrivate
74{
75 KITINERARY_PRIVATE_GADGET(FlightReservation)
76public:
77 QString passengerSequenceNumber;
78 QString airplaneSeat;
79 QString boardingGroup;
80};
81
82KITINERARY_MAKE_DERIVED_CLASS(FlightReservation, Reservation)
83KITINERARY_MAKE_PROPERTY(FlightReservation, QString, passengerSequenceNumber, setPassengerSequenceNumber)
84KITINERARY_MAKE_PROPERTY(FlightReservation, QString, airplaneSeat, setAirplaneSeat)
85KITINERARY_MAKE_PROPERTY(FlightReservation, QString, boardingGroup, setBoardingGroup)
86KITINERARY_MAKE_OPERATOR(FlightReservation)
87
88class TrainReservationPrivate : public ReservationPrivate
89{
90 KITINERARY_PRIVATE_GADGET(TrainReservation)
91};
92KITINERARY_MAKE_DERIVED_CLASS(TrainReservation, Reservation)
93KITINERARY_MAKE_OPERATOR(TrainReservation)
94
95class BusReservationPrivate : public ReservationPrivate
96{
97 KITINERARY_PRIVATE_GADGET(BusReservation)
98};
99KITINERARY_MAKE_DERIVED_CLASS(BusReservation, Reservation)
100KITINERARY_MAKE_OPERATOR(BusReservation)
101
102class FoodEstablishmentReservationPrivate : public ReservationPrivate
103{
104 KITINERARY_PRIVATE_GADGET(FoodEstablishmentReservation)
105public:
106 QDateTime endTime;
107 QDateTime startTime;
108 int partySize = 0;
109};
110KITINERARY_MAKE_DERIVED_CLASS(FoodEstablishmentReservation, Reservation)
111KITINERARY_MAKE_PROPERTY(FoodEstablishmentReservation, QDateTime, endTime, setEndTime)
112KITINERARY_MAKE_PROPERTY(FoodEstablishmentReservation, int, partySize, setPartySize)
113KITINERARY_MAKE_PROPERTY(FoodEstablishmentReservation, QDateTime, startTime, setStartTime)
114KITINERARY_MAKE_OPERATOR(FoodEstablishmentReservation)
115
116class EventReservationPrivate : public ReservationPrivate
117{
118 KITINERARY_PRIVATE_GADGET(EventReservation)
119};
120KITINERARY_MAKE_DERIVED_CLASS(EventReservation, Reservation)
121KITINERARY_MAKE_OPERATOR(EventReservation)
122
123class RentalCarReservationPrivate : public ReservationPrivate
124{
125 KITINERARY_PRIVATE_GADGET(RentalCarReservation)
126public:
127 QDateTime dropoffTime;
128 QDateTime pickupTime;
129 Place pickupLocation;
130 Place dropoffLocation;
131};
132KITINERARY_MAKE_DERIVED_CLASS(RentalCarReservation, Reservation)
133KITINERARY_MAKE_PROPERTY(RentalCarReservation, QDateTime, dropoffTime, setDropoffTime)
134KITINERARY_MAKE_PROPERTY(RentalCarReservation, QDateTime, pickupTime, setPickupTime)
135KITINERARY_MAKE_PROPERTY(RentalCarReservation, Place, pickupLocation, setPickupLocation)
136KITINERARY_MAKE_PROPERTY(RentalCarReservation, Place, dropoffLocation, setDropoffLocation)
137KITINERARY_MAKE_OPERATOR(RentalCarReservation)
138
139
140class TaxiReservationPrivate : public ReservationPrivate
141{
142 KITINERARY_PRIVATE_GADGET(TaxiReservation)
143public:
144 QDateTime pickupTime;
145 Place pickupLocation;
146};
147KITINERARY_MAKE_DERIVED_CLASS(TaxiReservation, Reservation)
148KITINERARY_MAKE_PROPERTY(TaxiReservation, QDateTime, pickupTime, setPickupTime)
149KITINERARY_MAKE_PROPERTY(TaxiReservation, Place, pickupLocation, setPickupLocation)
150KITINERARY_MAKE_OPERATOR(TaxiReservation)
151
152
153class BoatReservationPrivate : public ReservationPrivate
154{
155 KITINERARY_PRIVATE_GADGET(BoatReservation)
156};
157KITINERARY_MAKE_DERIVED_CLASS(BoatReservation, Reservation)
158KITINERARY_MAKE_OPERATOR(BoatReservation)
159
160}
161
162template <>
164{
165 return d->clone();
166}
167
168#include "moc_reservation.cpp"
A boat or ferry reservation.
A bus reservation.
An event reservation.
A flight reservation.
Definition reservation.h:90
A hotel reservation.
Definition reservation.h:77
Base class for places.
Definition place.h:69
A frequent traveler, bonus points or discount scheme program membership.
A Rental Car reservation.
Abstract base class for reservations.
Definition reservation.h:25
ReservationStatus
Reservation status enum.
Definition reservation.h:30
A Taxi reservation.
A train reservation.
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 Oct 4 2024 12:00:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.