Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgeocodejsonparser.h
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QGEOCODEJSONPARSER_H
5#define QGEOCODEJSONPARSER_H
6
7#include <QtPositioning/QGeoShape>
8#include <QtPositioning/QGeoLocation>
9
10#include <QtCore/QObject>
11#include <QtCore/QRunnable>
12#include <QtCore/QJsonDocument>
13#include <QtCore/QByteArray>
14#include <QtCore/QString>
15#include <QtCore/QList>
16
17QT_BEGIN_NAMESPACE
18
19class QGeoCodeJsonParser : public QObject, public QRunnable
20{
21 Q_OBJECT
22
23public:
24 void setBounds(const QGeoShape &bounds);
25 void parse(const QByteArray &data);
26 void run() override;
27
28signals:
29 void results(const QList<QGeoLocation> &locations);
30 void errorOccurred(const QString &errorString);
31
32private:
33 QJsonDocument m_document;
34 QByteArray m_data;
35 QGeoShape m_bounds;
36 QList<QGeoLocation> m_results;
37 QString m_errorString;
38};
39
41
42#endif
bool parseLocation(const QJsonObject &obj, const QGeoShape &bounds, QGeoLocation *loc)
void parseDocument(const QJsonDocument &doc, const QGeoShape &bounds, QList< QGeoLocation > *locs)
bool checkDocument(const QJsonDocument &doc, QString *errorString)
bool checkLocation(const QJsonObject &loc, QString *errorString)