KPublicTransport

coveragearea.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_COVERAGEAREA_H
8#define KPUBLICTRANSPORT_COVERAGEAREA_H
9
10#include "datatypes.h"
11#include <QStringList>
12
13class QJsonObject;
14
15namespace KPublicTransport {
16
17class CoverageAreaPrivate;
18class Location;
19
20/** Describes the area a specific KPublicTransport::Backend can provide information for. */
21class KPUBLICTRANSPORT_EXPORT CoverageArea
22{
23 KPUBLICTRANSPORT_GADGET(CoverageArea)
24public:
25 /** Coverage quality as defined by the Transport API Repository format. */
26 enum Type {
27 Realtime,
28 Regular,
29 Any
30 };
31 Q_ENUM(Type)
32 KPUBLICTRANSPORT_PROPERTY(Type, type, setType)
33
34 /** ISO 3166-1/2 codes of covered regions.
35 * Note that actual coverage might be small (e.g. just a city inside the given region).
36 */
37 KPUBLICTRANSPORT_PROPERTY(QStringList, regions, setRegions)
38
39 /** UIC company codes of operators covered by this backend. */
40 KPUBLICTRANSPORT_PROPERTY(QStringList, uicCompanyCodes, setUicCompanyCodes)
41 /** VDV organization ids of operators covered by this backend. */
42 KPUBLICTRANSPORT_PROPERTY(QStringList, vdvOrganizationIds, setVdvOrganizationIds)
43
44public:
45 /** Checks whether this coverage area is empty.
46 * coversLocation() would always return @p false for empty areas.
47 */
48 bool isEmpty() const;
49
50 /** Returns @c true if this area covers the entire world. */
51 bool isGlobal() const;
52
53 /** Checks whether @p loc is covered by this area. */
54 bool coversLocation(const Location &loc) const;
55
56 /** Checks whether this includes the entire country @p country. */
57 bool hasNationWideCoverage(const QString &country) const;
58
59 /** Read a single coverage area information from a JSON object
60 * in Transport API Repository format.
61 */
62 static CoverageArea fromJson(const QJsonObject &obj);
63};
64
65}
66
67#endif // KPUBLICTRANSPORT_COVERAGEAREA_H
Describes the area a specific KPublicTransport::Backend can provide information for.
Type
Coverage quality as defined by the Transport API Repository format.
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 Fri Dec 6 2024 11:59:34 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.