From 7374f82414ee4ed586394a039192bd071a07386c Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 6 May 2016 09:47:40 +0200 Subject: [PATCH] generic_json - add support for JSON object and array type in json_value + update rules attributes --- include/mapnik/json/generic_json.hpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/include/mapnik/json/generic_json.hpp b/include/mapnik/json/generic_json.hpp index 2d176bdc6..26a1fd1e3 100644 --- a/include/mapnik/json/generic_json.hpp +++ b/include/mapnik/json/generic_json.hpp @@ -31,6 +31,7 @@ #include #include #include +#include #pragma GCC diagnostic pop namespace mapnik { namespace json { @@ -39,7 +40,21 @@ namespace qi = boost::spirit::qi; namespace standard = boost::spirit::standard; namespace phoenix = boost::phoenix; using space_type = standard::space_type; -using json_value = mapnik::util::variant; + +struct json_value; + +using json_value_base = mapnik::util::variant>, + mapnik::util::recursive_wrapper > >; +struct json_value : json_value_base +{ + using json_value_base::json_value_base; +}; + using uchar = std::uint32_t; // a unicode code point // unicode string grammar via boost/libs/spirit/example/qi/json/json/parser/grammar.hpp @@ -145,14 +160,14 @@ unicode_string::unicode_string() template struct generic_json { - qi::rule value; + qi::rule value; qi::int_parser int__; unicode_string string_; - qi::rule key_value; + qi::rule(), space_type> key_value; qi::rule number; - qi::rule object; - qi::rule array; - qi::rule pairs; + qi::rule(), space_type> object; + qi::rule(), space_type> array; + qi::rule(), space_type> pairs; qi::real_parser> strict_double; // conversions boost::phoenix::function> integer_converter;