KItinerary

uic9183flex.h
1/*
2 SPDX-FileCopyrightText: 2025 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KITINERARY_UIC9183FLEX_H
7#define KITINERARY_UIC9183FLEX_H
8
9#include "kitinerary_export.h"
10#include "uic9183block.h"
11
12#include "era/fcbticket.h"
13#include "era/fcbticket3.h"
14
15namespace KItinerary {
16
17class TrainStation;
18class Uic9183FlexPrivate;
19
20/** Represents a U_FLEX block holding different versions of an FCB payload.
21 * @see ERA TAP TSI TD B.12 Digital Security Elements For Rail Passenger Ticketing - ยง11 FCB - Flexible Content Barcode
22 */
23class KITINERARY_EXPORT Uic9183Flex
24{
25 Q_GADGET
26 Q_PROPERTY(QVariant fcb READ fcbVariant)
27
28public:
29 Uic9183Flex();
30 /** Parse U_FLEX block in @p data.
31 * It's the callers responsibility to ensure @p data outlives this instance, the data
32 * is not copied.
33 * @param block A UIC 918.3 U_FLEX data block
34 */
35 Uic9183Flex(const Uic9183Block &block);
36 Uic9183Flex(const Uic9183Flex&);
37 ~Uic9183Flex();
38 Uic9183Flex& operator=(const Uic9183Flex&);
39
40 /** Returns whether this is a valid U_FLEX layout block. */
41 [[nodiscard]] bool isValid() const;
42
43 /** Issuing date/time. */
44 [[nodiscard]] QDateTime issuingDateTime() const;
45
46 /** @c true when this is a valid FCB with at least one transport document. */
47 [[nodiscard]] bool hasTransportDocument() const;
48 /** Transport documents of the contained FCB. */
49 [[nodiscard]] QList<QVariant> transportDocuments() const;
50
51 /** Returns the FCB payload.
52 * Varies depending on the version of this block.
53 */
54 [[nodiscard]] const std::variant<Fcb::v13::UicRailTicketData, Fcb::v3::UicRailTicketData>& fcb() const;
55
56 /** Read departure station info from the given FCB travel document, if applicable. */
57 static void readDepartureStation(const QVariant &doc, TrainStation &station);
58 /** Read arrival station info from the given FCB travel document, if applicable. */
59 static void readArrivalStation(const QVariant &doc, TrainStation &station);
60 /** Fix known issues with station identifiers. */
61 static void fixStationCode(TrainStation &station);
62
63 static constexpr const char RecordId[] = "U_FLEX";
64
65private:
66 [[nodiscard]] QVariant fcbVariant() const;
67
69};
70
71}
72
73#endif
Train station.
Definition place.h:126
A data block from a UIC 918.3 ticket.
QDateTime issuingDateTime() const
Issuing date/time.
bool isValid() const
Returns whether this is a valid U_FLEX layout block.
static void readArrivalStation(const QVariant &doc, TrainStation &station)
Read arrival station info from the given FCB travel document, if applicable.
static void fixStationCode(TrainStation &station)
Fix known issues with station identifiers.
static void readDepartureStation(const QVariant &doc, TrainStation &station)
Read departure station info from the given FCB travel document, if applicable.
QList< QVariant > transportDocuments() const
Transport documents of the contained FCB.
bool hasTransportDocument() const
true when this is a valid FCB with at least one transport document.
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-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:52:36 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.