diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-02-23 14:48:56 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-03-28 13:53:19 +0200 |
commit | 9b39013ce4c6f98590b80ced425e0a3bcdb3f77f (patch) | |
tree | 6afaab5e122b013f45f5e8763822ccf8ebd7c4e5 /platform/qt | |
parent | 321d820a87b37ecd4656b8c5adf585f2f00e09e2 (diff) | |
download | qtlocation-mapboxgl-9b39013ce4c6f98590b80ced425e0a3bcdb3f77f.tar.gz |
[core] Internalize rapidjson.hpp
Diffstat (limited to 'platform/qt')
-rw-r--r-- | platform/qt/src/qt_geojson.hpp | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/platform/qt/src/qt_geojson.hpp b/platform/qt/src/qt_geojson.hpp index 7c50c663dd..7d12660aec 100644 --- a/platform/qt/src/qt_geojson.hpp +++ b/platform/qt/src/qt_geojson.hpp @@ -2,7 +2,6 @@ #include <mapbox/geojson.hpp> #include <mbgl/style/conversion/geojson.hpp> -#include <mbgl/util/rapidjson.hpp> #include <QMapbox> @@ -10,7 +9,6 @@ #include <QDebug> #include <QVariant> -#include <sstream> #include <string> namespace QMapbox { @@ -197,29 +195,8 @@ optional<GeoJSON> convertGeoJSON(const QVariant& value, Error& error) { return {}; } - auto data = value.toByteArray(); - - rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> d; - if (data.endsWith(char(0))) { - d.Parse<0>(value.toByteArray().data()); - } else { - d.Parse<0>(value.toByteArray().constData()); - } - - if (d.HasParseError()) { - std::stringstream message; - message << d.GetErrorOffset() << " - " << rapidjson::GetParseError_En(d.GetParseError()); - error = { message.str() }; - return {}; - } - - optional<GeoJSON> geoJSON = convertGeoJSON<JSValue>(d, error); - if (!geoJSON) { - error = { error.message }; - return {}; - } - - return geoJSON; + QByteArray data = value.toByteArray(); + return convertGeoJSON(std::string(data.constData(), data.size()), error); } } // namespace conversion |