KItinerary

fcbutil.cpp
1/*
2 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#include "fcbutil.h"
7
8using namespace KItinerary;
9
10QString FcbUtil::stringifyUicStationIdentifier(int num, const QByteArray &ia5)
11{
12 if (num >= 10'00000 && num <= 99'99999) {
13 return QLatin1StringView("uic:") + QString::number(num);
14 }
15 if (ia5.size() == 7) {
16 return QLatin1StringView("uic:") + QString::fromLatin1(ia5);
17 }
18
19 return {};
20}
21
22QString FcbUtil::stringifyStationIdentifier(bool numIsSet, int num, const QByteArray ia5)
23{
24 if (numIsSet) {
25 return QString::number(num);
26 }
27 return QString::fromLatin1(ia5);
28}
29
30QString FcbUtil::classCodeToString(Fcb::TravelClassType classCode)
31{
32 switch (classCode) {
33 case Fcb::notApplicable: return {};
34 case Fcb::first: return QString::number(1);
35 case Fcb::second: return QString::number(2);
36 default:
37 qCWarning(Log) << "Unhandled FCB class code" << classCode;
38 }
39 return {};
40}
static QString classCodeToString(Fcb::TravelClassType classCode)
Convert a class code enum value to a string for human representation.
Definition fcbutil.cpp:30
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
qsizetype size() const const
QString fromLatin1(QByteArrayView str)
QString number(double n, char format, int precision)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 7 2024 11:52:32 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.