Commit 69ecdda9 authored by Volker Krause's avatar Volker Krause
Browse files

Add access to the return trip line in RCT2 tickets

parent 7fc47086
[
{
"@context": "http://schema.org",
"@type": "Rct2Ticket",
"firstDayOfValidity": "2022-01-01",
"outboundArrivalStation": "WIEN",
"outboundArrivalTime": "2022-04-01T00:00:00",
"outboundClass": "2",
"outboundDepartureStation": "BRATISLAVA",
"outboundDepartureTime": "2022-04-01T00:00:00",
"passengerName": "KONQUI DRAGONN",
"returnArrivalStation": "BRATISLAVA",
"returnArrivalTime": "2022-04-01T00:00:00",
"returnClass": "2",
"returnDepartureStation": "WIEN",
"returnDepartureTime": "2022-04-01T00:00:00",
"title": "CESTOVNY LISTOK",
"type": "http://schema.org/Transport"
}
]
U_TLAY010621RCT20022020501040000411560301015000019PLATNY / VALID 20220018023300022CESTOVNY LISTOK
TICKET0052011400014KONQUI DRAGONN015201190001601 DOSPELY/ADULT060101050000501.04060701050000500:00065201050000501.04065801050000524:000613011900010BRATISLAVA0634011700004WIEN06660105000012070101050000501.04070701050000500:00075201050000501.04075801050000524:000713011900004WIEN0734011700010BRATISLAVA076601050000120801047000041<1156>MARCHEGG(GR)<1181>SIEBENBRUNN-LEOP.1201035000152EUROPA REGIONAL WIEN TICKET VIA MARCHEGG/GAENSERND
DO/ZO VSETKYCH STANIC / NACH/VON ALLEN BAHNHOEFEN
NEPLATI VO VLAKOCH IC A RJX INCL. 1 RAD/BICYKE1352021900009EUR 98.76
\ No newline at end of file
......@@ -190,27 +190,52 @@ QDateTime Rct2Ticket::outboundArrivalTime() const
return d->parseTime(d->layout.text(6, 52, 5, 1).trimmed(), d->layout.text(6, 58, 5, 1).trimmed());
}
QString Rct2Ticket::outboundDepartureStation() const
static QString rct2Clean(const QString &s)
{
const auto s = d->layout.text(6, 13, 17, 1).trimmed();
if (s == QLatin1Char('*')) { // * is used to mark unset fields
return {};
}
return s;
}
QString Rct2Ticket::outboundDepartureStation() const
{
return rct2Clean(d->layout.text(6, 13, 17, 1).trimmed());
}
QString Rct2Ticket::outboundArrivalStation() const
{
const auto s = d->layout.text(6, 34, 17, 1).trimmed();
if (s == QLatin1Char('*')) { // * is used to mark unset fields
return {};
}
return s;
return rct2Clean(d->layout.text(6, 34, 17, 1).trimmed());
}
QString Rct2Ticket::outboundClass() const
{
return d->layout.text(6, 66, 5, 1).trimmed();
return rct2Clean(d->layout.text(6, 66, 5, 1).trimmed());
}
QDateTime Rct2Ticket::returnDepartureTime() const
{
return d->parseTime(d->layout.text(7, 1, 5, 1).trimmed(), d->layout.text(7, 7, 5, 1).trimmed());
}
QDateTime Rct2Ticket::returnArrivalTime() const
{
return d->parseTime(d->layout.text(7, 52, 5, 1).trimmed(), d->layout.text(7, 58, 5, 1).trimmed());
}
QString Rct2Ticket::returnDepartureStation() const
{
return rct2Clean(d->layout.text(7, 13, 17, 1).trimmed());
}
QString Rct2Ticket::returnArrivalStation() const
{
return rct2Clean(d->layout.text(7, 34, 17, 1).trimmed());
}
QString Rct2Ticket::returnClass() const
{
return rct2Clean(d->layout.text(7, 66, 5, 1).trimmed());
}
QString Rct2Ticket::trainNumber() const
......
......@@ -26,11 +26,19 @@ class KITINERARY_EXPORT Rct2Ticket
Q_PROPERTY(Type type READ type)
Q_PROPERTY(QString title READ title)
Q_PROPERTY(QString passengerName READ passengerName)
Q_PROPERTY(QDateTime outboundDepartureTime READ outboundDepartureTime)
Q_PROPERTY(QDateTime outboundArrivalTime READ outboundArrivalTime)
Q_PROPERTY(QString outboundDepartureStation READ outboundDepartureStation)
Q_PROPERTY(QString outboundArrivalStation READ outboundArrivalStation)
Q_PROPERTY(QString outboundClass READ outboundClass)
Q_PROPERTY(QDateTime returnDepartureTime READ returnDepartureTime)
Q_PROPERTY(QDateTime returnArrivalTime READ returnArrivalTime)
Q_PROPERTY(QString returnDepartureStation READ returnDepartureStation)
Q_PROPERTY(QString returnArrivalStation READ returnArrivalStation)
Q_PROPERTY(QString returnClass READ returnClass)
Q_PROPERTY(QString trainNumber READ trainNumber)
Q_PROPERTY(QString coachNumber READ coachNumber)
Q_PROPERTY(QString seatNumber READ seatNumber)
......@@ -83,6 +91,17 @@ public:
/** Class of the outbound segment. */
QString outboundClass() const;
/** Departure time of the return segment, if present. */
QDateTime returnDepartureTime() const;
/** Arrival time of the return segment, if present. */
QDateTime returnArrivalTime() const;
/** Departure station of the return segment, if present. */
QString returnDepartureStation() const;
/** Arrival station of the return segment, if present. */
QString returnArrivalStation() const;
/** Class of the return segment, if present. */
QString returnClass() const;
/** Train number (for reservation tickets). */
QString trainNumber() const;
/** Coach number (for reservation tickets). */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment