KPublicTransport

coveragearea.h
1 /*
2  SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]>
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 "coveragearea.h"
11 #include "datatypes.h"
12 
13 class QJsonObject;
14 class QStringList;
15 
16 namespace KPublicTransport {
17 
18 class CoverageAreaPrivate;
19 class Location;
20 
21 /** Describes the area a specific KPublicTransport::Backend can provide information for. */
22 class KPUBLICTRANSPORT_EXPORT CoverageArea
23 {
24  KPUBLICTRANSPORT_GADGET(CoverageArea)
25 public:
26  /** Coverage quality as defined by the Transport API Repository format. */
27  enum Type {
28  Realtime,
29  Regular,
30  Any
31  };
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 
42 public:
43  /** Checks whether this coverage area is empty.
44  * coversLocation() would always return @p false for empty areas.
45  */
46  bool isEmpty() const;
47 
48  /** Returns @c true if this area covers the entire world. */
49  bool isGlobal() const;
50 
51  /** Checks whether @p loc is covered by this area. */
52  bool coversLocation(const Location &loc) const;
53 
54  /** Read a single coverage area information from a JSON object
55  * in Transport API Repository format.
56  */
57  static CoverageArea fromJson(const QJsonObject &obj);
58 };
59 
60 }
61 
62 #endif // KPUBLICTRANSPORT_COVERAGEAREA_H
Describes the area a specific KPublicTransport::Backend can provide information for.
Definition: coveragearea.h:22
Query operations and data types for accessing realtime public transport information from online servi...
Definition: attribution.cpp:16
Type
Coverage quality as defined by the Transport API Repository format.
Definition: coveragearea.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 23 2021 23:05:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.