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.
24 lines
578 B
C++
24 lines
578 B
C++
#pragma once
|
|
|
|
#include <mbgl/style/conversion.hpp>
|
|
#include <mbgl/util/geojson.hpp>
|
|
|
|
namespace mbgl {
|
|
namespace style {
|
|
namespace conversion {
|
|
|
|
template <>
|
|
struct Converter<GeoJSON> {
|
|
public:
|
|
optional<GeoJSON> operator()(const std::string&, Error&) const;
|
|
|
|
// This is explicitly specialized in the .cpp file for JSValue. It may also be explicitly
|
|
// specialized for SDK-specific types (e.g. mbgl::android::Value).
|
|
template <class V>
|
|
optional<GeoJSON> operator()(const V&, Error&) const;
|
|
};
|
|
|
|
} // namespace conversion
|
|
} // namespace style
|
|
} // namespace mbgl
|