KPublicTransport

uicstationcode.h
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KPUBLICTRANSPORT_UICSTATIONCODE_H
8#define KPUBLICTRANSPORT_UICSTATIONCODE_H
9
10#include <cstdint>
11#include <vector>
12
13class QString;
14class QStringView;
15
16namespace KPublicTransport {
17
18
19/** Utility functions for dealing with UIC station codes.
20 * Also works for the syntactically identical IBNR station codes.
21 */
22namespace UicStationCode
23{
24
25/** Returns @c true if @p id is a valid UIC station code.
26 * @params allowedCountryCodes if non-empty, only UIC station codes with an UIC country code included
27 * in that list are considered valid. This list has to be sorted.
28 */
29[[nodiscard]] bool isValid(QStringView id, const std::vector<uint8_t> &allowedCountryCodes = {});
30
31/** Returns the country code of a given valid UIC station code. */
32[[nodiscard]] QStringView country(QStringView id);
33
34/** The identifier type for use in @c Location::identifer for UIC station ids. */
35[[nodiscard]] QString identifierType();
36
37}
38
39}
40
41#endif // KPUBLICTRANSPORT_UICSTATIONCODE_H
bool isValid(QStringView id, const std::vector< uint8_t > &allowedCountryCodes={})
Returns true if id is a valid UIC station code.
QString identifierType()
The identifier type for use in Location::identifer for UIC station ids.
Query operations and data types for accessing realtime public transport information from online servi...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.