summaryrefslogtreecommitdiff
path: root/deps/geojson/0.4.0/include/mapbox/geojson/rapidjson.hpp
blob: 360eefd010446217c96d926e99b579b6e9c974b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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