File indexing completed on 2024-11-24 04:46:17

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 #include "uic9183utils.h"
0011 
0012 #include <QByteArray>
0013 #include <qobjectdefs.h>
0014 
0015 namespace KItinerary {
0016 
0017 /** Header of an UIC 918.3 ticket. */
0018 class KITINERARY_EXPORT Uic9183Header
0019 {
0020     Q_GADGET
0021     UIC_STR_PROPERTY(messageType, 0, 3)
0022     UIC_NUM_PROPERTY(version, 3, 2)
0023     UIC_NUM_PROPERTY(signerCompanyCodeNumeric, 5, 4)
0024     UIC_STR_PROPERTY(signerCompanyCode, 5, 4)
0025     UIC_STR_PROPERTY(signatureKeyId, 9, 5)
0026     Q_PROPERTY(int signatureSize READ signatureSize)
0027     Q_PROPERTY(int compressedMessageSize READ compressedMessageSize)
0028 public:
0029     Uic9183Header();
0030     Uic9183Header(const QByteArray &data);
0031 
0032     bool operator==(const Uic9183Header &other) const;
0033 
0034     bool isValid() const;
0035     int signatureSize() const;
0036     int compressedMessageSize() const;
0037     int compressedMessageOffset() const;
0038 private:
0039     QByteArray m_data;
0040 };
0041 
0042 }
0043