mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
JSON - store 'object' properties in std::vector to preserve order
This commit is contained in:
parent
f0386e0469
commit
3909fe5b7d
@ -48,7 +48,7 @@ public:
|
||||
return mapnik::value(tr_.transcode(str.c_str()));
|
||||
}
|
||||
|
||||
mapnik::value operator()(std::unordered_map<std::string, mapnik::json::json_value> const& object) const
|
||||
mapnik::value operator()(std::vector<std::pair<std::string, mapnik::json::json_value> > const& object) const
|
||||
{
|
||||
std::string str = stringifier()(object);
|
||||
return mapnik::value(tr_.transcode(str.c_str()));
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace mapnik { namespace json {
|
||||
|
||||
@ -47,8 +46,8 @@ using space_type = standard::space_type;
|
||||
struct json_value;
|
||||
|
||||
using json_array = std::vector<json_value>;
|
||||
using json_object = std::unordered_map<std::string, json_value>;
|
||||
using json_object_element = std::pair<std::string, json_value>;
|
||||
using json_object = std::vector<json_object_element>;
|
||||
using json_value_base = mapnik::util::variant<value_null,
|
||||
value_bool,
|
||||
value_integer,
|
||||
@ -169,7 +168,7 @@ struct generic_json
|
||||
qi::rule<Iterator, json_value(), space_type> value;
|
||||
qi::int_parser<mapnik::value_integer, 10, 1, -1> int__;
|
||||
unicode_string<Iterator> string_;
|
||||
qi::rule<Iterator, json_object_element, space_type> key_value;
|
||||
qi::rule<Iterator, json_object_element(), space_type> key_value;
|
||||
qi::rule<Iterator, json_value(), space_type> number;
|
||||
qi::rule<Iterator, json_object(), space_type> object;
|
||||
qi::rule<Iterator, json_array(), space_type> array;
|
||||
|
||||
@ -78,7 +78,7 @@ struct stringifier
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string operator()(std::unordered_map<std::string, mapnik::json::json_value> const& object) const
|
||||
std::string operator()(std::vector<std::pair<std::string, mapnik::json::json_value>> const& object) const
|
||||
{
|
||||
std::string str = "{";
|
||||
bool first = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user