File indexing completed on 2024-05-12 04:42:47
0001 /* 0002 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KPUBLICTRANSPORT_GBFSREADER_H 0008 #define KPUBLICTRANSPORT_GBFSREADER_H 0009 0010 class QJsonDocument; 0011 class QJsonObject; 0012 class QJsonValue; 0013 class QLatin1String; 0014 0015 namespace KPublicTransport { 0016 0017 /** Utility methods for reading GBFS data. */ 0018 namespace GBFSReader 0019 { 0020 /** Reads and sanity-checks geographic coordinates. */ 0021 double readLatitude(const QJsonObject &obj); 0022 double readLongitude(const QJsonObject &obj); 0023 0024 /** Returns the top-level data object. 0025 * Also handles broken feeds missing the data object and having things 0026 * on the top level directly. 0027 */ 0028 QJsonObject dataObject(const QJsonDocument &doc); 0029 QJsonValue dataValue(const QJsonDocument &doc, QLatin1String name); 0030 } 0031 0032 } 0033 0034 #endif // KPUBLICTRANSPORT_GBFSREADER_H