File indexing completed on 2024-11-24 04:45:10
0001 /* 0002 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kitinerary_export.h" 0010 0011 #include <qobjectdefs.h> 0012 #include <QByteArray> 0013 0014 #include <cstdint> 0015 0016 namespace KItinerary { 0017 0018 /** Internal base class for ERA SSB tickets. */ 0019 class KITINERARY_EXPORT SSBTicketBase 0020 { 0021 Q_GADGET 0022 protected: 0023 SSBTicketBase(); 0024 ~SSBTicketBase(); 0025 0026 // start and length in bits 0027 Q_INVOKABLE quint64 readNumber(int start, int length) const; 0028 Q_INVOKABLE QString readString(int start, int length) const; 0029 0030 QByteArray m_data; 0031 }; 0032 0033 #define SSB_NUM_PROPERTY(Name, Start, Len) \ 0034 public: \ 0035 inline int Name() const { return readNumber(Start, Len); } \ 0036 Q_PROPERTY(int Name READ Name) 0037 #define SSB_LONG_PROPERTY(Name, Start, Len) \ 0038 public: \ 0039 inline quint64 Name() const { return readNumber(Start, Len); } \ 0040 Q_PROPERTY(quint64 Name READ Name) 0041 #define SSB_STR_PROPERTY(Name, Start, Len) \ 0042 public: \ 0043 inline QString Name() const { return readString(Start, Len); } \ 0044 Q_PROPERTY(QString Name READ Name) 0045 0046 } 0047