1 #pragma once 2 3 #include <rapidjson/document.h> 4 #include <mapbox/geojson.hpp> 5 6 namespace mapbox { 7 namespace geojson { 8 9 // Use the CrtAllocator, because the MemoryPoolAllocator is broken on ARM 10 // https://github.com/miloyip/rapidjson/issues/200, 301, 388 11 using rapidjson_allocator = rapidjson::CrtAllocator; 12 using rapidjson_document = rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson_allocator>; 13 using rapidjson_value = rapidjson::GenericValue<rapidjson::UTF8<>, rapidjson_allocator>; 14 15 // Convert inputs of known types. Instantiations are provided for geometry, feature, and 16 // feature_collection. 17 template <typename T> 18 T convert(const rapidjson_value &); 19 20 // Convert any GeoJSON type. 21 geojson convert(const rapidjson_value &); 22 23 // Convert back to rapidjson value. Instantiations are provided for geometry, feature, and 24 // feature_collection. 25 template <typename T> 26 rapidjson_value convert(const T &, rapidjson_allocator&); 27 28 // Convert any GeoJSON type. 29 rapidjson_value convert(const geojson &, rapidjson_allocator&); 30 31 } // namespace geojson 32 } // namespace mapbox 33