KItinerary

ssbticketbase.h
1/*
2 SPDX-FileCopyrightText: 2021 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 <qobjectdefs.h>
12#include <QByteArray>
13
14#include <cstdint>
15
16class QDate;
17class QDateTime;
18
19namespace KItinerary {
20
21/** Internal base class for ERA SSB tickets. */
22class KITINERARY_EXPORT SSBTicketBase
23{
24 Q_GADGET
25protected:
28
29 // start and length in bits
30 Q_INVOKABLE [[nodiscard]] quint64 readNumber(int start, int length) const;
31 Q_INVOKABLE [[nodiscard]] QString readString(int start, int length) const;
32
33 /** Convert a SSBv1 or v2 day number to a date based on @p context. */
34 [[nodiscard]] static QDate dayNumberToDate(int days, const QDateTime &context);
35
36 QByteArray m_data;
37};
38
39#define SSB_NUM_PROPERTY(Name, Start, Len) \
40public: \
41 inline int Name() const { return readNumber(Start, Len); } \
42 Q_PROPERTY(int Name READ Name)
43#define SSB_LONG_PROPERTY(Name, Start, Len) \
44public: \
45 inline quint64 Name() const { return readNumber(Start, Len); } \
46 Q_PROPERTY(quint64 Name READ Name)
47#define SSB_STR_PROPERTY(Name, Start, Len) \
48public: \
49 inline QString Name() const { return readString(Start, Len); } \
50 Q_PROPERTY(QString Name READ Name)
51
52}
53
Internal base class for ERA SSB tickets.
Q_SCRIPTABLE Q_NOREPLY void start()
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 Sat Dec 21 2024 16:56:36 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.