mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
move keys_map initilizer with well-known-names into separate inline method
This commit is contained in:
parent
1b74544b08
commit
c2d7ecbef7
@ -37,7 +37,8 @@ enum well_known_names
|
||||
type = 1,
|
||||
geometry,
|
||||
coordinates,
|
||||
properties
|
||||
properties,
|
||||
id
|
||||
};
|
||||
|
||||
constexpr char const* wkn_to_string(well_known_names val)
|
||||
@ -48,16 +49,29 @@ constexpr char const* wkn_to_string(well_known_names val)
|
||||
case geometry: return "geometry";
|
||||
case coordinates: return "coordinates";
|
||||
case properties: return "properties";
|
||||
case id: return "id";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
struct keys_tag;
|
||||
|
||||
namespace grammar {
|
||||
|
||||
using keys_map = std::unordered_map<std::string, int>;
|
||||
|
||||
inline keys_map get_keys()
|
||||
{
|
||||
keys_map keys = {
|
||||
{"type", well_known_names::type},
|
||||
{"geometry", well_known_names::geometry},
|
||||
{"coordinates", well_known_names::coordinates},
|
||||
{"properties", well_known_names::properties},
|
||||
{"id", well_known_names::id}
|
||||
};
|
||||
return keys;
|
||||
}
|
||||
|
||||
namespace grammar {
|
||||
|
||||
namespace x3 = boost::spirit::x3;
|
||||
using space_type = x3::standard::space_type;
|
||||
using iterator_type = std::string::const_iterator;
|
||||
|
||||
@ -428,14 +428,7 @@ std::pair<bool,typename T::value_type::first_type> process_geojson_file_x3(T & b
|
||||
auto const* itr = start;
|
||||
|
||||
extract_positions<base_iterator_type, boxes_type> callback(itr, boxes);
|
||||
mapnik::json::grammar::keys_map keys =
|
||||
{
|
||||
{"type", mapnik::json::well_known_names::type},
|
||||
{"geometry", mapnik::json::well_known_names::geometry},
|
||||
{"coordinates", mapnik::json::well_known_names::coordinates},
|
||||
{"properties", mapnik::json::well_known_names::properties}
|
||||
};
|
||||
|
||||
auto keys = mapnik::json::get_keys();
|
||||
std::size_t bracket_counter = 0;
|
||||
auto feature_collection_impl = x3::with<mapnik::json::grammar::bracket_tag>(std::ref(bracket_counter))
|
||||
[x3::with<mapnik::json::keys_tag>(std::ref(keys))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user