KItinerary

uic9183head.cpp
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "uic9183head.h"
8
9using namespace KItinerary;
10
11Uic9183Head::Uic9183Head() = default;
12
13// U_HEAD Block (version 1, size 53)
14// 4x issuing carrier id
15// 6x PNR
16// 20x unique ticket key
17// 12x issuing date/time as ddMMyyyyHHMM, as UTC
18// 1x flags
19// 2x ticket language
20// 2x secondary ticket language
21
22Uic9183Head::Uic9183Head(const Uic9183Block &block)
23{
24 if (block.version() == 1 && block.size() == 53) {
25 m_data = block;
26 }
27}
28
29Uic9183Head::~Uic9183Head() = default;
30
32{
33 return !m_data.isNull();
34}
35
36QDateTime Uic9183Head::issuingDateTime() const
37{
38 return QDateTime::fromString(Uic9183Utils::readUtf8String(m_data, 24, 12), QStringLiteral("ddMMyyyyhhmm"));
39}
40
41#include "moc_uic9183head.cpp"
A data block from a UIC 918.3 ticket.
bool isNull() const
Checks if the block is valid or empty/default constructed.
int version() const
Returns the version number of this block.
int size() const
Returns the size of the entire block data.
bool isValid() const
Returns true if this is a valid U_HEAD block.
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.