KItinerary

vdvticket.h
1/*
2 SPDX-FileCopyrightText: 2019 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 <KItinerary/Person>
12
13#include <QDateTime>
14#include <QExplicitlySharedDataPointer>
15#include <QMetaType>
16
17namespace KItinerary {
18
19class VdvTicketHeader;
20class VdvTicketPrivate;
21class VdvTicketCommonTransactionData;
22class VdvTicketIssueData;
23class VdvTicketTrailer;
24namespace BER { class Element; }
25
26/** Ticket information from a VDV barcode.
27 * For use by tooling or custom extractor scripts.
28 */
29class KITINERARY_EXPORT VdvTicket
30{
31 Q_GADGET
32 /** Begin of the validitiy of this ticket. */
33 Q_PROPERTY(QDateTime beginDateTime READ beginDateTime)
34 /** End of the validity of this ticket. */
35 Q_PROPERTY(QDateTime endDateTime READ endDateTime)
36
37 /** VDV organization identifier of the ticket issuer. */
38 Q_PROPERTY(int issuerId READ issuerId)
39 /** VDV organization identifier of the operator. */
40 Q_PROPERTY(int operatorId READ operatorId)
41 /** Service class for this ticket. */
42 Q_PROPERTY(ServiceClass serviceClass READ serviceClass)
43 /** The person this ticket is valid for. */
44 Q_PROPERTY(KItinerary::Person person READ person)
45 /** Ticket number. */
46 Q_PROPERTY(QString ticketNumber READ ticketNumber)
47
48 Q_PROPERTY(QByteArray rawData READ rawData STORED false)
49
50public:
51 VdvTicket();
52 VdvTicket(const QByteArray &data, const QByteArray &rawData);
53 VdvTicket(const VdvTicket&);
54 ~VdvTicket();
55 VdvTicket& operator=(const VdvTicket&);
56
57 QDateTime beginDateTime() const;
58 QDateTime endDateTime() const;
59 int issuerId() const;
60 int operatorId() const;
61
62 enum ServiceClass {
63 UnknownClass = 0,
64 FirstClass = 1,
65 SecondClass = 2,
66 FirstClassUpgrade = 3
67 };
68 Q_ENUM(ServiceClass)
69 ServiceClass serviceClass() const;
70
71 Person person() const;
72 QString ticketNumber() const;
73
74 // low-level content access
75 const VdvTicketHeader* header() const;
76 BER::Element productData() const;
77 const VdvTicketCommonTransactionData* commonTransactionData() const;
78 BER::Element productSpecificTransactionData() const;
79 const VdvTicketIssueData* issueData() const;
80 const VdvTicketTrailer* trailer() const;
81
82 /** Raw data of this ticket.
83 * Useful for generating a barcode for it again.
84 */
85 QByteArray rawData() const;
86
87private:
89};
90
91}
An element in BER/DER/X.690 encoding.
Definition berelement.h:28
A person.
Definition person.h:20
Ticket issuer data block.
Ticket trailer, after padding.
Ticket information from a VDV barcode.
Definition vdvticket.h:30
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 Mon Nov 4 2024 16:28:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.