summaryrefslogtreecommitdiff
path: root/deps/geojson/0.4.2/include/mapbox/geojson/rapidjson.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'deps/geojson/0.4.2/include/mapbox/geojson/rapidjson.hpp')
-rw-r--r--deps/geojson/0.4.2/include/mapbox/geojson/rapidjson.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/deps/geojson/0.4.2/include/mapbox/geojson/rapidjson.hpp b/deps/geojson/0.4.2/include/mapbox/geojson/rapidjson.hpp
new file mode 100644
index 0000000000..360eefd010
--- /dev/null
+++ b/deps/geojson/0.4.2/include/mapbox/geojson/rapidjson.hpp
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <rapidjson/document.h>
+#include <mapbox/geojson.hpp>
+
+namespace mapbox {
+namespace geojson {
+
+// Use the CrtAllocator, because the MemoryPoolAllocator is broken on ARM
+// https://github.com/miloyip/rapidjson/issues/200, 301, 388
+using rapidjson_allocator = rapidjson::CrtAllocator;
+using rapidjson_document = rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson_allocator>;
+using rapidjson_value = rapidjson::GenericValue<rapidjson::UTF8<>, rapidjson_allocator>;
+
+// Convert inputs of known types. Instantiations are provided for geometry, feature, and
+// feature_collection.
+template <typename T>
+T convert(const rapidjson_value &);
+
+// Convert any GeoJSON type.
+geojson convert(const rapidjson_value &);
+
+// Convert back to rapidjson value. Instantiations are provided for geometry, feature, and
+// feature_collection.
+template <typename T>
+rapidjson_value convert(const T &, rapidjson_allocator&);
+
+// Convert any GeoJSON type.
+rapidjson_value convert(const geojson &, rapidjson_allocator&);
+
+} // namespace geojson
+} // namespace mapbox