Commit 7e1f7543 authored by Volker Krause's avatar Volker Krause
Browse files

Expose UIC 918.3 and VDV raw data

This is needed to recreate barcodes out of parsed tickets.
parent 9860873c
Pipeline #54810 passed with stages
in 15 minutes and 55 seconds
......@@ -245,6 +245,11 @@ Uic9183Header Uic9183Parser::header() const
return Uic9183Header(d->m_data);
}
QByteArray Uic9183Parser::rawData() const
{
return d->m_data;
}
bool Uic9183Parser::maybeUic9183(const QByteArray& data)
{
Uic9183Header h(data);
......
......@@ -105,6 +105,11 @@ public:
/** Header found before the compressed payload. */
Uic9183Header header() const;
/** Raw data of this ticket.
* Useful for generating a barcode for it again.
*/
QByteArray rawData() const;
/** Quickly checks if @p might be UIC 918.3 content.
* This prioritizes speed over correctness and is used in barcode content auto-detection.
*/
......
......@@ -214,3 +214,8 @@ const VdvTicketTrailer* VdvTicket::trailer() const
offset += std::max<int>(111 - offset - sizeof(VdvTicketTrailer), 0); // padding to 111 bytes
return d->m_data.isEmpty() ? nullptr : reinterpret_cast<const VdvTicketTrailer*>(d->m_data.constData() + offset);
}
QByteArray VdvTicket::rawData() const
{
return d->m_data;
}
......@@ -75,6 +75,11 @@ public:
const VdvTicketIssueData* issueData() const;
const VdvTicketTrailer* trailer() const;
/** Raw data of this ticket.
* Useful for generating a barcode for it again.
*/
QByteArray rawData() const;
private:
QExplicitlySharedDataPointer<VdvTicketPrivate> d;
};
......
Markdown is supported
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