[core, android] Factor JSON string conversions

This adds a `convertJSON` template, to be used like:

   Error error
   optional<Foo> foo = convertJSON<Foo>(string, error);

Internally, it parses the string with RapidJSON and then calls `convert<Foo>(parsed, error)`.

While here, rationalize GeoJSON converters and fix error handling for Tileset conversion in OfflineDownload.
This commit is contained in:
John Firebaugh
2017-05-05 16:31:03 -07:00
parent e34d8b5c80
commit baaae99a03
19 changed files with 130 additions and 186 deletions

View File

@@ -5,7 +5,7 @@ namespace style {
namespace conversion {
template <>
optional<GeoJSON> convertGeoJSON(const v8::Local<v8::Value>&, Error& error) {
optional<GeoJSON> Converter<GeoJSON>::operator()(const v8::Local<v8::Value>&, Error& error) const {
error = { "not implemented" };
return {};
}