KItinerary

rct2ticket.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 <QExplicitlySharedDataPointer>
12#include <QMetaType>
13
14class QDateTime;
15
16namespace KItinerary {
17
18class Rct2TicketPrivate;
19class Uic9183TicketLayout;
20
21/** RCT2 ticket layout payload of an UIC 918.3 ticket token. */
22class KITINERARY_EXPORT Rct2Ticket
23{
24 Q_GADGET
25 Q_PROPERTY(QDate firstDayOfValidity READ firstDayOfValidity)
26 Q_PROPERTY(Type type READ type)
27 Q_PROPERTY(QString title READ title)
28 Q_PROPERTY(QString passengerName READ passengerName)
29
30 Q_PROPERTY(QDateTime outboundDepartureTime READ outboundDepartureTime)
31 Q_PROPERTY(QDateTime outboundArrivalTime READ outboundArrivalTime)
32 Q_PROPERTY(QString outboundDepartureStation READ outboundDepartureStation)
33 Q_PROPERTY(QString outboundArrivalStation READ outboundArrivalStation)
34 Q_PROPERTY(QString outboundClass READ outboundClass)
35
36 Q_PROPERTY(QDateTime returnDepartureTime READ returnDepartureTime)
37 Q_PROPERTY(QDateTime returnArrivalTime READ returnArrivalTime)
38 Q_PROPERTY(QString returnDepartureStation READ returnDepartureStation)
39 Q_PROPERTY(QString returnArrivalStation READ returnArrivalStation)
40 Q_PROPERTY(QString returnClass READ returnClass)
41
42 Q_PROPERTY(QString trainNumber READ trainNumber)
43 Q_PROPERTY(QString coachNumber READ coachNumber)
44 Q_PROPERTY(QString seatNumber READ seatNumber)
45
46 Q_PROPERTY(QString currency READ currency)
47 Q_PROPERTY(double price READ price)
48
49public:
50 Rct2Ticket();
51 /** Parse RCT2 ticket information from a U_TLAY layout block. */
52 Rct2Ticket(const Uic9183TicketLayout &layout);
53 Rct2Ticket(const Rct2Ticket&);
55 Rct2Ticket& operator=(const Rct2Ticket&);
56
57 /** Returns whether this is a valid RCT2 ticket layout block. */
58 bool isValid() const;
59
60 /** Date/time this ticket was first encountered, to recover possibly missing year numbers. */
61 void setContextDate(const QDateTime &contextDt);
62
63 /** First day the ticket is valid. */
64 QDate firstDayOfValidity() const;
65
66 /** Type of RCT2 ticket.
67 * @see ERA TAP TSI Annex B.6.
68 */
69 enum Type {
70 Transport, ///< Non-integrated Reservation Ticket (NRT)
71 TransportReservation, ///< Integration Reservation Ticket (IRT)
72 Reservation, ///< Reservation Only Document (RES)
73 Upgrade, ///< Update Document (UPG)
74 RailPass, ///< Rail Pass Ticket (RPT)
75 Unknown ///< ticket type could not be detected, or ticket type not supported yet
76 };
77 Q_ENUM(Type)
78 /** Returns the ticket type. */
79 Type type() const;
80
81 /** Name or title of the ticket. */
82 QString title() const;
83
84 /** Name of the passenger this ticket is for. */
85 QString passengerName() const;
86
87 /** Departure time of the outbound segment. */
88 QDateTime outboundDepartureTime() const;
89 /** Arrival time of the outbound segment. */
90 QDateTime outboundArrivalTime() const;
91 /** Departure station of the outbound segment. */
92 QString outboundDepartureStation() const;
93 /** Arrival station of the outbound segment. */
94 QString outboundArrivalStation() const;
95 /** Class of the outbound segment. */
96 QString outboundClass() const;
97
98 /** Departure time of the return segment, if present. */
99 QDateTime returnDepartureTime() const;
100 /** Arrival time of the return segment, if present. */
101 QDateTime returnArrivalTime() const;
102 /** Departure station of the return segment, if present. */
103 QString returnDepartureStation() const;
104 /** Arrival station of the return segment, if present. */
105 QString returnArrivalStation() const;
106 /** Class of the return segment, if present. */
107 QString returnClass() const;
108
109 /** Train number (for reservation tickets). */
110 QString trainNumber() const;
111 /** Coach number (for reservation tickets). */
112 QString coachNumber() const;
113 /** Seat number (for reservation tickets). */
114 QString seatNumber() const;
115
116 /** Currency used for the price value. */
117 QString currency() const;
118 /** Price of the ticket. */
119 double price() const;
120
121private:
123};
124
125}
RCT2 ticket layout payload of an UIC 918.3 ticket token.
Definition rct2ticket.h:23
Type
Type of RCT2 ticket.
Definition rct2ticket.h:69
@ Transport
Non-integrated Reservation Ticket (NRT)
Definition rct2ticket.h:70
@ RailPass
Rail Pass Ticket (RPT)
Definition rct2ticket.h:74
@ Upgrade
Update Document (UPG)
Definition rct2ticket.h:73
@ TransportReservation
Integration Reservation Ticket (IRT)
Definition rct2ticket.h:71
@ Reservation
Reservation Only Document (RES)
Definition rct2ticket.h:72
Parser for a U_TLAY block in a UIC 918-3 ticket container, such as a ERA TLB ticket.
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 Dec 20 2024 11:52:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.