KItinerary

uic9183utils.h
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7
8#pragma once
9
10#include "kitinerary_export.h"
11
12#include <QString>
13
14namespace KItinerary {
15
16class Uic9183Block;
17
18/*
19 * Low-level decoding utilities for UIC 918.3 ticket content.
20 * @internal
21 */
22namespace Uic9183Utils
23{
24 /** Reads an ASCII encoded numerical value. */
25 int readAsciiEncodedNumber(const char *data, int size, int offset, int length);
26 KITINERARY_EXPORT int readAsciiEncodedNumber(const QByteArray &data, int offset, int length);
27 KITINERARY_EXPORT int readAsciiEncodedNumber(const Uic9183Block &block, int offset, int length);
28
29 /** Reads a UTF8 encoded string. */
30 QString readUtf8String(const char *data, int size, int offset, int length);
31 KITINERARY_EXPORT QString readUtf8String(const QByteArray &data, int offset, int length);
32 KITINERARY_EXPORT QString readUtf8String(const Uic9183Block &block, int offset, int length);
33}
34
35#define UIC_NUM_PROPERTY(Name, Offset, Length) \
36public: \
37 inline int Name() const { return Uic9183Utils::readAsciiEncodedNumber(m_data, Offset, Length); } \
38 Q_PROPERTY(int Name READ Name)
39
40#define UIC_STR_PROPERTY(Name, Offset, Length) \
41public: \
42 inline QString Name() const { return Uic9183Utils::readUtf8String(m_data, Offset, Length); } \
43 Q_PROPERTY(QString Name READ Name)
44}
45
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 Fri Dec 27 2024 11:51:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.