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/android/src/style/conversion | |
parent | 321d820a87b37ecd4656b8c5adf585f2f00e09e2 (diff) | |
download | qtlocation-mapboxgl-9b39013ce4c6f98590b80ced425e0a3bcdb3f77f.tar.gz |
[core] Internalize rapidjson.hpp
Diffstat (limited to 'platform/android/src/style/conversion')
-rw-r--r-- | platform/android/src/style/conversion/geojson.hpp | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/platform/android/src/style/conversion/geojson.hpp b/platform/android/src/style/conversion/geojson.hpp index 6ac6abcd7c..db474e8542 100644 --- a/platform/android/src/style/conversion/geojson.hpp +++ b/platform/android/src/style/conversion/geojson.hpp @@ -5,45 +5,23 @@ #include <mapbox/geojson.hpp> #include <mbgl/style/conversion.hpp> #include <mbgl/style/conversion/geojson.hpp> -#include <mbgl/util/rapidjson.hpp> #include <mbgl/util/logging.hpp> #include <jni/jni.hpp> -#include <sstream> -#include <string> - namespace mbgl { namespace style { namespace conversion { template <> optional<GeoJSON> convertGeoJSON(const mbgl::android::Value& value, Error& error) { - // Value should be a string wrapped in an object mbgl::android::Value jsonValue = value.get("data"); if(value.isNull()) { error = { "no json data found" }; return {}; } - std::string jsonString = value.get("data").toString(); - - rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> d; - d.Parse(jsonString.c_str()); - - if (d.HasParseError()) { - std::stringstream message; - message << d.GetErrorOffset() << " - " << rapidjson::GetParseError_En(d.GetParseError()); - error = { message.str() }; - return {}; - } - - optional<GeoJSON> geoJSON = conversion::convertGeoJSON<JSValue>(d, error); - if (!geoJSON) { - error = { error.message }; - return {}; - } - return geoJSON; + return convertGeoJSON(value.get("data").toString(), error); } template <> |