From 3cb74f0871c534fff576b4857466200009e07055 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Tue, 14 Nov 2017 10:09:29 +0100 Subject: [PATCH] attempting to fix #3793 --- .../mapnik/json/feature_grammar_x3_def.hpp | 23 +++++-------------- .../json/generic_json_grammar_x3_def.hpp | 20 ++++------------ .../mapnik/json/geojson_grammar_x3_def.hpp | 14 ----------- .../mapnik/json/positions_grammar_x3_def.hpp | 7 ------ .../mapnik/json/topojson_grammar_x3_def.hpp | 9 +------- .../json/unicode_string_grammar_x3_def.hpp | 7 +----- src/json/feature_grammar_x3.cpp | 14 ++++++++++- src/json/generic_json_grammar_x3.cpp | 13 ++++++++++- src/json/geojson_grammar_x3.cpp | 14 ++++++++++- src/json/positions_grammar_x3.cpp | 9 +++++++- src/json/topojson_grammar_x3.cpp | 9 +++++++- src/json/unicode_string_grammar_x3.cpp | 8 ++++++- 12 files changed, 74 insertions(+), 73 deletions(-) diff --git a/include/mapnik/json/feature_grammar_x3_def.hpp b/include/mapnik/json/feature_grammar_x3_def.hpp index d05219350..310d74048 100644 --- a/include/mapnik/json/feature_grammar_x3_def.hpp +++ b/include/mapnik/json/feature_grammar_x3_def.hpp @@ -140,11 +140,12 @@ using x3::omit; using x3::char_; namespace { -auto const& value = generic_json_grammar(); // import unicode string rule auto const& geojson_string = unicode_string_grammar(); // import positions rule auto const& positions_rule = positions_grammar(); +// import generic rule +auto const& value = generic_json_grammar(); } // geometry types symbols @@ -235,13 +236,15 @@ auto assign_property = [](auto const& ctx) //exported rules feature_grammar_type const feature_rule = "Feature Rule"; -geometry_grammar_type const geometry_rule = "Feature Rule"; +geometry_grammar_type const geometry_rule = "Geometry Rule"; // rules x3::rule const feature_type = "Feature Type"; x3::rule const geometry_type = "Geometry Type"; x3::rule const coordinates = "Coordinates"; -x3::rule>> const geometry_tuple = "Geometry"; +x3::rule>> const geometry_tuple = "Geometry"; x3::rule> const property = "Property"; x3::rule const properties = "Properties"; x3::rule const feature_part = "Feature part"; @@ -305,18 +308,4 @@ BOOST_SPIRIT_DEFINE( }}} -namespace mapnik { namespace json { - -grammar::feature_grammar_type const& feature_grammar() -{ - return grammar::feature_rule; -} - -grammar::geometry_grammar_type const& geometry_grammar() -{ - return grammar::geometry_rule; -} - -}} - #endif // MAPNIK_JSON_FEATURE_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/json/generic_json_grammar_x3_def.hpp b/include/mapnik/json/generic_json_grammar_x3_def.hpp index c16d9477a..5408a2220 100644 --- a/include/mapnik/json/generic_json_grammar_x3_def.hpp +++ b/include/mapnik/json/generic_json_grammar_x3_def.hpp @@ -67,6 +67,10 @@ auto assign_value = [](auto const& ctx) using x3::lit; using x3::string; + +// import unicode string rule +namespace { auto const& json_string = mapnik::json::unicode_string_grammar(); } + // exported rules // start generic_json_grammar_type const value("JSON Value"); @@ -79,9 +83,7 @@ x3::rule const number("JSON Number"); auto const json_double = x3::real_parser>(); auto const json_integer = x3::int_parser(); -// import unicode string rule -namespace { auto const& json_string = mapnik::json::unicode_string_grammar(); } - // generic json types +// generic json types auto const value_def = object | array | json_string | number ; @@ -120,17 +122,5 @@ BOOST_SPIRIT_DEFINE( }}} -namespace mapnik { namespace json { - -grammar::generic_json_grammar_type const& generic_json_grammar() -{ - return grammar::value; -} -grammar::generic_json_key_value_type const& generic_json_key_value() -{ - return grammar::key_value; -} - -}} #endif // MAPNIK_JSON_GENERIC_JSON_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/json/geojson_grammar_x3_def.hpp b/include/mapnik/json/geojson_grammar_x3_def.hpp index a7915e0e8..545826e7b 100644 --- a/include/mapnik/json/geojson_grammar_x3_def.hpp +++ b/include/mapnik/json/geojson_grammar_x3_def.hpp @@ -166,18 +166,4 @@ BOOST_SPIRIT_DEFINE( }}} -namespace mapnik { namespace json { - -grammar::geojson_grammar_type const& geojson_grammar() -{ - return grammar::value; -} - -grammar::key_value_type const& key_value_grammar() -{ - return grammar::key_value; -} - -}} - #endif // MAPNIK_JSON_GEOJSON_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/json/positions_grammar_x3_def.hpp b/include/mapnik/json/positions_grammar_x3_def.hpp index f6ef084f9..6f6b96500 100644 --- a/include/mapnik/json/positions_grammar_x3_def.hpp +++ b/include/mapnik/json/positions_grammar_x3_def.hpp @@ -64,11 +64,4 @@ BOOST_SPIRIT_DEFINE( ); }}} -namespace mapnik { namespace json { -grammar::positions_grammar_type const& positions_grammar() -{ - return grammar::positions; -} -}} - #endif // MAPNIK_JSON_POSITIONS_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/json/topojson_grammar_x3_def.hpp b/include/mapnik/json/topojson_grammar_x3_def.hpp index d8d7e8aa1..7200fdbd3 100644 --- a/include/mapnik/json/topojson_grammar_x3_def.hpp +++ b/include/mapnik/json/topojson_grammar_x3_def.hpp @@ -23,9 +23,9 @@ #ifndef MAPNIK_JSON_TOPOJSON_GRAMMAR_X3_DEF_HPP #define MAPNIK_JSON_TOPOJSON_GRAMMAR_X3_DEF_HPP -#include #include #include +#include #pragma GCC diagnostic push #include #include @@ -435,11 +435,4 @@ BOOST_SPIRIT_DEFINE( }}} -namespace mapnik { namespace json { -grammar::topojson_grammar_type const& topojson_grammar() -{ - return grammar::topology; -} -}} - #endif //MAPNIK_TOPOJSON_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/json/unicode_string_grammar_x3_def.hpp b/include/mapnik/json/unicode_string_grammar_x3_def.hpp index a73a73851..039e2d624 100644 --- a/include/mapnik/json/unicode_string_grammar_x3_def.hpp +++ b/include/mapnik/json/unicode_string_grammar_x3_def.hpp @@ -149,11 +149,6 @@ BOOST_SPIRIT_DEFINE( #pragma GCC diagnostic pop -} -grammar::unicode_string_grammar_type const& unicode_string_grammar() -{ - return grammar::unicode_string; -} -}} +}}} #endif // MAPNIK_JSON_UNICODE_STRING_GRAMMAR_X3_DEF_HPP diff --git a/src/json/feature_grammar_x3.cpp b/src/json/feature_grammar_x3.cpp index e850d76b3..9aa2961a3 100644 --- a/src/json/feature_grammar_x3.cpp +++ b/src/json/feature_grammar_x3.cpp @@ -31,4 +31,16 @@ BOOST_SPIRIT_INSTANTIATE(geometry_grammar_type, iterator_type, phrase_parse_cont BOOST_SPIRIT_INSTANTIATE_UNUSED(feature_grammar_type, iterator_type, feature_context_type); BOOST_SPIRIT_INSTANTIATE_UNUSED(feature_grammar_type, iterator_type, feature_context_const_type); -}}} +} + +grammar::feature_grammar_type const& feature_grammar() +{ + return grammar::feature_rule; +} + +grammar::geometry_grammar_type const& geometry_grammar() +{ + return grammar::geometry_rule; +} + +}} diff --git a/src/json/generic_json_grammar_x3.cpp b/src/json/generic_json_grammar_x3.cpp index 43997d71e..92931be33 100644 --- a/src/json/generic_json_grammar_x3.cpp +++ b/src/json/generic_json_grammar_x3.cpp @@ -34,4 +34,15 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(generic_json_grammar_type, iterator_type, phrase BOOST_SPIRIT_INSTANTIATE_UNUSED(generic_json_grammar_type, iterator_type, feature_context_type); BOOST_SPIRIT_INSTANTIATE_UNUSED(generic_json_grammar_type, iterator_type, feature_context_const_type); -}}} +} + +grammar::generic_json_grammar_type const& generic_json_grammar() +{ + return grammar::value; +} +grammar::generic_json_key_value_type const& generic_json_key_value() +{ + return grammar::key_value; +} + +}} diff --git a/src/json/geojson_grammar_x3.cpp b/src/json/geojson_grammar_x3.cpp index 334188e17..583c9e999 100644 --- a/src/json/geojson_grammar_x3.cpp +++ b/src/json/geojson_grammar_x3.cpp @@ -38,4 +38,16 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(geojson_grammar_type, iterator_type, extract_bou BOOST_SPIRIT_INSTANTIATE_UNUSED(geojson_grammar_type, iterator_type, extract_bounding_boxes_context_type_f); BOOST_SPIRIT_INSTANTIATE_UNUSED(geojson_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f); -}}} +} + +grammar::geojson_grammar_type const& geojson_grammar() +{ + return grammar::value; +} + +grammar::key_value_type const& key_value_grammar() +{ + return grammar::key_value; +} + +}} diff --git a/src/json/positions_grammar_x3.cpp b/src/json/positions_grammar_x3.cpp index 101f1c725..ab5a0f5fe 100644 --- a/src/json/positions_grammar_x3.cpp +++ b/src/json/positions_grammar_x3.cpp @@ -41,4 +41,11 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(positions_grammar_type, iterator_type, extract_b BOOST_SPIRIT_INSTANTIATE_UNUSED(positions_grammar_type, iterator_type, extract_bounding_boxes_context_type_f); BOOST_SPIRIT_INSTANTIATE_UNUSED(positions_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f); -}}} +} + +grammar::positions_grammar_type const& positions_grammar() +{ + return grammar::positions; +} + +}} diff --git a/src/json/topojson_grammar_x3.cpp b/src/json/topojson_grammar_x3.cpp index 1eef5e4b6..536e4675a 100644 --- a/src/json/topojson_grammar_x3.cpp +++ b/src/json/topojson_grammar_x3.cpp @@ -27,4 +27,11 @@ namespace mapnik { namespace json { namespace grammar { BOOST_SPIRIT_INSTANTIATE(topojson_grammar_type, iterator_type, phrase_parse_context_type); -}}} +} + +grammar::topojson_grammar_type const& topojson_grammar() +{ + return grammar::topology; +} + +}} diff --git a/src/json/unicode_string_grammar_x3.cpp b/src/json/unicode_string_grammar_x3.cpp index 59838b7ab..80c2efc71 100644 --- a/src/json/unicode_string_grammar_x3.cpp +++ b/src/json/unicode_string_grammar_x3.cpp @@ -42,5 +42,11 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extr BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type); BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_context_type_f); BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f); +} -}}} +grammar::unicode_string_grammar_type const& unicode_string_grammar() +{ + return grammar::unicode_string; +} + +}}