remove reference_wrapper usage when injecting attributes into grammar ( >= boost_1_67) [skip-ci]
This commit is contained in:
parent
c946620fec
commit
664d3508de
15 changed files with 53 additions and 53 deletions
|
@ -35,7 +35,7 @@ using phrase_context_type = x3::phrase_parse_context<x3::ascii::space_type>::typ
|
|||
|
||||
// define combined context
|
||||
using context_type = x3::context<transcoder_tag,
|
||||
std::reference_wrapper<mapnik::transcoder const>,
|
||||
mapnik::transcoder const,
|
||||
phrase_context_type>;
|
||||
|
||||
}}
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace mapnik { namespace grammar {
|
|||
|
||||
auto do_unicode = [] (auto const& ctx)
|
||||
{
|
||||
auto & tr = x3::get<transcoder_tag>(ctx).get();
|
||||
auto const& tr = x3::get<transcoder_tag>(ctx);
|
||||
_val(ctx) = std::move(tr.transcode(_attr(ctx).c_str()));
|
||||
};
|
||||
|
||||
|
@ -188,13 +188,13 @@ namespace mapnik { namespace grammar {
|
|||
// regex
|
||||
auto do_regex_match = [] (auto const& ctx)
|
||||
{
|
||||
auto const& tr = x3::get<transcoder_tag>(ctx).get();
|
||||
auto const& tr = x3::get<transcoder_tag>(ctx);
|
||||
_val(ctx) = std::move(mapnik::regex_match_node(tr, std::move(_val(ctx)) , std::move(_attr(ctx))));
|
||||
};
|
||||
|
||||
auto do_regex_replace = [] (auto const& ctx)
|
||||
{
|
||||
auto const& tr = x3::get<transcoder_tag>(ctx).get();
|
||||
auto const& tr = x3::get<transcoder_tag>(ctx);
|
||||
auto const& pair = _attr(ctx);
|
||||
auto const& pattern = std::get<0>(pair);
|
||||
auto const& format = std::get<1>(pair);
|
||||
|
|
|
@ -85,26 +85,26 @@ using space_type = x3::standard::space_type;
|
|||
using phrase_parse_context_type = x3::phrase_parse_context<space_type>::type;
|
||||
|
||||
using extract_bounding_boxes_context_type =
|
||||
x3::context<bracket_tag, std::reference_wrapper<std::size_t>,
|
||||
x3::context<feature_callback_tag, std::reference_wrapper<callback_type>,
|
||||
x3::context<bracket_tag, std::size_t,
|
||||
x3::context<feature_callback_tag, callback_type,
|
||||
context_type>>;
|
||||
|
||||
using extract_bounding_boxes_reverse_context_type =
|
||||
x3::context<keys_tag, std::reference_wrapper<keys_map>,
|
||||
x3::context<feature_callback_tag, std::reference_wrapper<callback_type>,
|
||||
x3::context<bracket_tag, std::reference_wrapper<std::size_t>,
|
||||
x3::context<keys_tag, keys_map,
|
||||
x3::context<feature_callback_tag, callback_type,
|
||||
x3::context<bracket_tag, std::size_t,
|
||||
phrase_parse_context_type>>>;
|
||||
|
||||
|
||||
using extract_bounding_boxes_context_type_f =
|
||||
x3::context<bracket_tag, std::reference_wrapper<std::size_t>,
|
||||
x3::context<feature_callback_tag, std::reference_wrapper<callback_type_f>,
|
||||
x3::context<bracket_tag, std::size_t,
|
||||
x3::context<feature_callback_tag, callback_type_f,
|
||||
context_type>>;
|
||||
|
||||
using extract_bounding_boxes_reverse_context_type_f =
|
||||
x3::context<keys_tag, std::reference_wrapper<keys_map>,
|
||||
x3::context<feature_callback_tag, std::reference_wrapper<callback_type_f>,
|
||||
x3::context<bracket_tag, std::reference_wrapper<std::size_t>,
|
||||
x3::context<keys_tag, keys_map,
|
||||
x3::context<feature_callback_tag, callback_type_f,
|
||||
x3::context<bracket_tag, std::size_t,
|
||||
phrase_parse_context_type>>>;
|
||||
|
||||
}}}
|
||||
|
|
|
@ -92,20 +92,20 @@ using iterator_type = char const*;
|
|||
|
||||
using phrase_parse_context_type = x3::phrase_parse_context<space_type>::type;
|
||||
using context_type = x3::context<keys_tag,
|
||||
std::reference_wrapper<keys_map>,
|
||||
keys_map,
|
||||
phrase_parse_context_type>;
|
||||
|
||||
using feature_context_type = x3::context<transcoder_tag,
|
||||
std::reference_wrapper<mapnik::transcoder>,
|
||||
mapnik::transcoder const,
|
||||
x3::context<feature_tag,
|
||||
std::reference_wrapper<mapnik::feature_impl>,
|
||||
phrase_parse_context_type>>;
|
||||
mapnik::feature_impl,
|
||||
phrase_parse_context_type>>;
|
||||
|
||||
// our spirit x3 grammars needs this one with changed order of feature_impl and transcoder (??)
|
||||
using feature_context_const_type = x3::context<feature_tag,
|
||||
std::reference_wrapper<mapnik::feature_impl>,
|
||||
mapnik::feature_impl,
|
||||
x3::context<transcoder_tag,
|
||||
std::reference_wrapper<mapnik::transcoder const>,
|
||||
mapnik::transcoder const,
|
||||
phrase_parse_context_type>>;
|
||||
|
||||
// helper macro
|
||||
|
|
|
@ -40,8 +40,8 @@ using space_type = x3::standard::space_type;
|
|||
using iterator_type = char const*;
|
||||
|
||||
using phrase_parse_context_type = x3::phrase_parse_context<space_type>::type;
|
||||
using svg_parse_context_type = x3::context<relative_tag, std::reference_wrapper<bool>,
|
||||
x3::context<svg_path_tag,std::reference_wrapper<svg_converter_type>,
|
||||
using svg_parse_context_type = x3::context<relative_tag, bool,
|
||||
x3::context<svg_path_tag, svg_converter_type,
|
||||
phrase_parse_context_type>>;
|
||||
|
||||
inline double deg2rad(double deg) {return (M_PI * deg) / 180.0;}
|
||||
|
|
|
@ -45,22 +45,22 @@ using coord_type = std::tuple<double,double>;
|
|||
|
||||
auto const move_to = [] (auto const& ctx)
|
||||
{
|
||||
x3::get<svg_path_tag>(ctx).get().move_to(std::get<0>(_attr(ctx)), std::get<1>(_attr(ctx)), x3::get<relative_tag>(ctx));
|
||||
x3::get<svg_path_tag>(ctx).move_to(std::get<0>(_attr(ctx)), std::get<1>(_attr(ctx)), x3::get<relative_tag>(ctx));
|
||||
};
|
||||
|
||||
auto const line_to = [] (auto const & ctx)
|
||||
{
|
||||
x3::get<svg_path_tag>(ctx).get().line_to(std::get<0>(_attr(ctx)), std::get<1>(_attr(ctx)), x3::get<relative_tag>(ctx));
|
||||
x3::get<svg_path_tag>(ctx).line_to(std::get<0>(_attr(ctx)), std::get<1>(_attr(ctx)), x3::get<relative_tag>(ctx));
|
||||
};
|
||||
|
||||
auto const hline_to = [] (auto const& ctx)
|
||||
{
|
||||
x3::get<svg_path_tag>(ctx).get().hline_to(_attr(ctx), x3::get<relative_tag>(ctx));
|
||||
x3::get<svg_path_tag>(ctx).hline_to(_attr(ctx), x3::get<relative_tag>(ctx));
|
||||
};
|
||||
|
||||
auto const vline_to = [] (auto const& ctx)
|
||||
{
|
||||
x3::get<svg_path_tag>(ctx).get().vline_to(_attr(ctx), x3::get<relative_tag>(ctx));
|
||||
x3::get<svg_path_tag>(ctx).vline_to(_attr(ctx), x3::get<relative_tag>(ctx));
|
||||
};
|
||||
|
||||
auto const curve4 = [] (auto const& ctx)
|
||||
|
@ -69,7 +69,7 @@ auto const curve4 = [] (auto const& ctx)
|
|||
auto const& p0 = boost::fusion::at_c<0>(attr);
|
||||
auto const& p1 = boost::fusion::at_c<1>(attr);
|
||||
auto const& p2 = boost::fusion::at_c<2>(attr);
|
||||
x3::get<svg_path_tag>(ctx).get().curve4(std::get<0>(p0),std::get<1>(p0),
|
||||
x3::get<svg_path_tag>(ctx).curve4(std::get<0>(p0),std::get<1>(p0),
|
||||
std::get<0>(p1),std::get<1>(p1),
|
||||
std::get<0>(p2),std::get<1>(p2),
|
||||
x3::get<relative_tag>(ctx));
|
||||
|
@ -80,7 +80,7 @@ auto const curve4_smooth = [] (auto const& ctx)
|
|||
auto const& attr = _attr(ctx);
|
||||
auto const& p0 = boost::fusion::at_c<0>(attr);
|
||||
auto const& p1 = boost::fusion::at_c<1>(attr);
|
||||
x3::get<svg_path_tag>(ctx).get().curve4(std::get<0>(p0),std::get<1>(p0),
|
||||
x3::get<svg_path_tag>(ctx).curve4(std::get<0>(p0),std::get<1>(p0),
|
||||
std::get<0>(p1),std::get<1>(p1),
|
||||
x3::get<relative_tag>(ctx));
|
||||
};
|
||||
|
@ -90,7 +90,7 @@ auto const curve3 = [] (auto const& ctx)
|
|||
auto const& attr = _attr(ctx);
|
||||
auto const& p0 = boost::fusion::at_c<0>(attr);
|
||||
auto const& p1 = boost::fusion::at_c<1>(attr);
|
||||
x3::get<svg_path_tag>(ctx).get().curve3(std::get<0>(p0),std::get<1>(p0),
|
||||
x3::get<svg_path_tag>(ctx).curve3(std::get<0>(p0),std::get<1>(p0),
|
||||
std::get<0>(p1),std::get<1>(p1),
|
||||
x3::get<relative_tag>(ctx));
|
||||
};
|
||||
|
@ -98,7 +98,7 @@ auto const curve3 = [] (auto const& ctx)
|
|||
auto const curve3_smooth = [] (auto const& ctx)
|
||||
{
|
||||
auto const& attr = _attr(ctx);
|
||||
x3::get<svg_path_tag>(ctx).get().curve3(std::get<0>(attr),std::get<1>(attr),
|
||||
x3::get<svg_path_tag>(ctx).curve3(std::get<0>(attr),std::get<1>(attr),
|
||||
x3::get<relative_tag>(ctx));
|
||||
};
|
||||
|
||||
|
@ -111,7 +111,7 @@ auto const arc_to = [] (auto & ctx)
|
|||
int large_arc_flag = boost::fusion::at_c<2>(attr);
|
||||
int sweep_flag = boost::fusion::at_c<3>(attr);
|
||||
auto const& v = boost::fusion::at_c<4>(attr);
|
||||
x3::get<svg_path_tag>(ctx).get().arc_to(std::get<0>(p),std::get<1>(p),
|
||||
x3::get<svg_path_tag>(ctx).arc_to(std::get<0>(p),std::get<1>(p),
|
||||
deg2rad(angle), large_arc_flag, sweep_flag,
|
||||
std::get<0>(v),std::get<1>(v),
|
||||
x3::get<relative_tag>(ctx));
|
||||
|
@ -119,17 +119,17 @@ auto const arc_to = [] (auto & ctx)
|
|||
|
||||
auto const close_path = [] (auto const& ctx)
|
||||
{
|
||||
x3::get<svg_path_tag>(ctx).get().close_subpath();
|
||||
x3::get<svg_path_tag>(ctx).close_subpath();
|
||||
};
|
||||
|
||||
auto const relative = [] (auto const& ctx)
|
||||
{
|
||||
x3::get<relative_tag>(ctx).get() = true;
|
||||
x3::get<relative_tag>(ctx) = true;
|
||||
};
|
||||
|
||||
auto const absolute = [] (auto const& ctx)
|
||||
{
|
||||
x3::get<relative_tag>(ctx).get() = false;
|
||||
x3::get<relative_tag>(ctx) = false;
|
||||
};
|
||||
|
||||
// exported rules
|
||||
|
|
|
@ -46,7 +46,7 @@ using x3::no_case;
|
|||
|
||||
auto const matrix_action = [] (auto const& ctx)
|
||||
{
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx).get();
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx);
|
||||
auto const& attr = _attr(ctx);
|
||||
auto a = boost::fusion::at_c<0>(attr);
|
||||
auto b = boost::fusion::at_c<1>(attr);
|
||||
|
@ -59,7 +59,7 @@ auto const matrix_action = [] (auto const& ctx)
|
|||
|
||||
auto const rotate_action = [] (auto const& ctx)
|
||||
{
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx).get();
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx);
|
||||
auto const& attr = _attr(ctx);
|
||||
auto a = boost::fusion::at_c<0>(attr);
|
||||
auto cx = boost::fusion::at_c<1>(attr) ? *boost::fusion::at_c<1>(attr) : 0.0;
|
||||
|
@ -79,7 +79,7 @@ auto const rotate_action = [] (auto const& ctx)
|
|||
|
||||
auto const translate_action = [] (auto const& ctx)
|
||||
{
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx).get();
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx);
|
||||
auto const& attr = _attr(ctx);
|
||||
auto tx = boost::fusion::at_c<0>(attr);
|
||||
auto ty = boost::fusion::at_c<1>(attr);
|
||||
|
@ -89,7 +89,7 @@ auto const translate_action = [] (auto const& ctx)
|
|||
|
||||
auto const scale_action = [] (auto const& ctx)
|
||||
{
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx).get();
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx);
|
||||
auto const& attr = _attr(ctx);
|
||||
auto sx = boost::fusion::at_c<0>(attr);
|
||||
auto sy = boost::fusion::at_c<1>(attr);
|
||||
|
@ -99,14 +99,14 @@ auto const scale_action = [] (auto const& ctx)
|
|||
|
||||
auto const skewX_action = [] (auto const& ctx)
|
||||
{
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx).get();
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx);
|
||||
auto skew_x = _attr(ctx);
|
||||
tr = agg::trans_affine_skewing(deg2rad(skew_x), 0.0) * tr;
|
||||
};
|
||||
|
||||
auto const skewY_action = [] (auto const& ctx)
|
||||
{
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx).get();
|
||||
auto & tr = x3::get<svg_transform_tag>(ctx);
|
||||
auto skew_y= _attr(ctx);
|
||||
tr = agg::trans_affine_skewing(0.0, deg2rad(skew_y)) * tr;
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ expression_ptr parse_expression(std::string const& str)
|
|||
auto node = std::make_shared<expr_node>();
|
||||
using boost::spirit::x3::ascii::space;
|
||||
mapnik::transcoder const tr("utf8");
|
||||
auto parser = boost::spirit::x3::with<mapnik::grammar::transcoder_tag>(std::ref(tr))
|
||||
auto parser = boost::spirit::x3::with<mapnik::grammar::transcoder_tag>(tr)
|
||||
[
|
||||
mapnik::expression_grammar()
|
||||
];
|
||||
|
|
|
@ -185,9 +185,9 @@ void extract_bounding_boxes(Iterator& start, Iterator const& end, Boxes & boxes)
|
|||
extract_positions<iterator_type, Boxes> callback(start, boxes);
|
||||
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::grammar::feature_callback_tag>(std::ref(callback))
|
||||
[x3::with<mapnik::json::grammar::keys_tag>(std::ref(keys))
|
||||
auto feature_collection_impl = x3::with<mapnik::json::grammar::bracket_tag>(bracket_counter)
|
||||
[x3::with<mapnik::json::grammar::feature_callback_tag>(callback)
|
||||
[x3::with<mapnik::json::grammar::keys_tag>(keys)
|
||||
[mapnik::json::grammar::feature_collection]
|
||||
]];
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ void parse_feature(Iterator start, Iterator end, feature_impl& feature, mapnik::
|
|||
{
|
||||
namespace x3 = boost::spirit::x3;
|
||||
using space_type = mapnik::json::grammar::space_type;
|
||||
auto grammar = x3::with<mapnik::json::grammar::transcoder_tag>(std::ref(tr))
|
||||
[x3::with<mapnik::json::grammar::feature_tag>(std::ref(feature))
|
||||
auto grammar = x3::with<mapnik::json::grammar::transcoder_tag>(tr)
|
||||
[x3::with<mapnik::json::grammar::feature_tag>(feature)
|
||||
[ mapnik::json::feature_grammar() ]];
|
||||
if (!x3::phrase_parse(start, end, grammar, space_type()))
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ transform_list_ptr parse_transform(std::string const& str, std::string const& en
|
|||
std::string::const_iterator itr = str.begin();
|
||||
std::string::const_iterator end = str.end();
|
||||
mapnik::transcoder const tr(encoding);
|
||||
auto const parser = boost::spirit::x3::with<mapnik::grammar::transcoder_tag>(std::ref(tr))
|
||||
auto const parser = boost::spirit::x3::with<mapnik::grammar::transcoder_tag>(tr)
|
||||
[
|
||||
mapnik::transform_expression_grammar()
|
||||
];
|
||||
|
|
|
@ -40,8 +40,8 @@ bool parse_path(const char* wkt, PathType& p)
|
|||
iterator_type last = wkt + std::strlen(wkt);
|
||||
bool relative = false;
|
||||
using space_type = mapnik::svg::grammar::space_type;
|
||||
auto const grammar = x3::with<mapnik::svg::grammar::svg_path_tag>(std::ref(p))
|
||||
[ x3::with<mapnik::svg::grammar::relative_tag>(std::ref(relative))
|
||||
auto const grammar = x3::with<mapnik::svg::grammar::svg_path_tag>(p)
|
||||
[ x3::with<mapnik::svg::grammar::relative_tag>(relative)
|
||||
[mapnik::svg::svg_path_grammar()]];
|
||||
|
||||
try
|
||||
|
|
|
@ -40,8 +40,8 @@ bool parse_points(const char* wkt, PathType& p)
|
|||
iterator_type last = wkt + std::strlen(wkt);
|
||||
bool relative = false;
|
||||
|
||||
auto const grammar = x3::with<mapnik::svg::grammar::svg_path_tag>(std::ref(p))
|
||||
[ x3::with<mapnik::svg::grammar::relative_tag>(std::ref(relative))
|
||||
auto const grammar = x3::with<mapnik::svg::grammar::svg_path_tag>(p)
|
||||
[ x3::with<mapnik::svg::grammar::relative_tag>(relative)
|
||||
[mapnik::svg::svg_points_grammar()]];
|
||||
|
||||
try
|
||||
|
|
|
@ -37,7 +37,7 @@ bool parse_svg_transform(const char* wkt, Transform& tr)
|
|||
iterator_type first = wkt;
|
||||
iterator_type last = wkt + std::strlen(wkt);
|
||||
using space_type = mapnik::svg::grammar::space_type;
|
||||
auto const grammar = x3::with<mapnik::svg::grammar::svg_transform_tag>(std::ref(tr))
|
||||
auto const grammar = x3::with<mapnik::svg::grammar::svg_transform_tag>(tr)
|
||||
[mapnik::svg::svg_transform_grammar()];
|
||||
|
||||
try
|
||||
|
|
|
@ -285,7 +285,7 @@ std::pair<bool,typename T::value_type::first_type> process_geojson_file_x3(T & b
|
|||
using namespace boost::spirit;
|
||||
using space_type = mapnik::json::grammar::space_type;
|
||||
auto keys = mapnik::json::get_keys();
|
||||
auto feature_grammar = x3::with<mapnik::json::grammar::keys_tag>(std::ref(keys))
|
||||
auto feature_grammar = x3::with<mapnik::json::grammar::keys_tag>(keys)
|
||||
[ geojson_value ];
|
||||
for (auto const& item : boxes)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue