fix includes + use typedefs for json types

This commit is contained in:
artemp 2016-05-06 10:57:35 +02:00
parent 7544f57efe
commit 97b8a11a72
2 changed files with 12 additions and 5 deletions

View file

@ -34,6 +34,9 @@
#include <boost/fusion/include/std_pair.hpp> #include <boost/fusion/include/std_pair.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#include <vector>
#include <unordered_map>
namespace mapnik { namespace json { namespace mapnik { namespace json {
namespace qi = boost::spirit::qi; namespace qi = boost::spirit::qi;
@ -43,13 +46,16 @@ using space_type = standard::space_type;
struct json_value; 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_value_base = mapnik::util::variant<value_null, using json_value_base = mapnik::util::variant<value_null,
value_bool, value_bool,
value_integer, value_integer,
value_double, value_double,
std::string, std::string,
mapnik::util::recursive_wrapper<std::vector<json_value>>, mapnik::util::recursive_wrapper<json_array>,
mapnik::util::recursive_wrapper<std::unordered_map<std::string, json_value> > >; mapnik::util::recursive_wrapper<json_object> >;
struct json_value : json_value_base struct json_value : json_value_base
{ {
using json_value_base::json_value_base; using json_value_base::json_value_base;
@ -163,10 +169,10 @@ struct generic_json
qi::rule<Iterator, json_value(), space_type> value; qi::rule<Iterator, json_value(), space_type> value;
qi::int_parser<mapnik::value_integer, 10, 1, -1> int__; qi::int_parser<mapnik::value_integer, 10, 1, -1> int__;
unicode_string<Iterator> string_; unicode_string<Iterator> string_;
qi::rule<Iterator, std::pair<std::string, json_value>(), 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_value(), space_type> number;
qi::rule<Iterator, std::unordered_map<std::string, json_value>(), space_type> object; qi::rule<Iterator, json_object(), space_type> object;
qi::rule<Iterator, std::vector<json_value>(), space_type> array; qi::rule<Iterator, json_array(), space_type> array;
qi::real_parser<double, qi::strict_real_policies<double>> strict_double; qi::real_parser<double, qi::strict_real_policies<double>> strict_double;
// conversions // conversions
boost::phoenix::function<mapnik::detail::value_converter<mapnik::value_integer>> integer_converter; boost::phoenix::function<mapnik::detail::value_converter<mapnik::value_integer>> integer_converter;

View file

@ -26,6 +26,7 @@
// mapnik // mapnik
#include <mapnik/json/generic_json.hpp> #include <mapnik/json/generic_json.hpp>
#include <mapnik/util/conversions.hpp> #include <mapnik/util/conversions.hpp>
#include <mapnik/util/variant.hpp>
// stl // stl
#include <string> #include <string>