convert all boost::variant to util::variant

apart from topojson (TODO)
This commit is contained in:
artemp 2014-08-12 13:40:45 +01:00
parent 8c7be886bd
commit 95cea92a4a
53 changed files with 309 additions and 337 deletions

View File

@ -20,15 +20,15 @@
*
*****************************************************************************/
#include <mapnik/config.hpp>
#include "boost_std_shared_shim.hpp"
#include "python_to_value.hpp"
// boost
#include <boost/python.hpp>
#include <boost/variant.hpp>
#include <mapnik/util/variant.hpp>
#include <boost/noncopyable.hpp>
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/expression.hpp>
@ -57,12 +57,12 @@ std::string expression_to_string_(mapnik::expr_node const& expr)
mapnik::value expression_evaluate_(mapnik::expr_node const& expr, mapnik::feature_impl const& f, boost::python::dict const& d)
{
// will be auto-converted to proper python type by `mapnik_value_to_python`
return boost::apply_visitor(mapnik::evaluate<mapnik::feature_impl,mapnik::value,mapnik::attributes>(f,mapnik::dict2attr(d)),expr);
return mapnik::util::apply_visitor(mapnik::evaluate<mapnik::feature_impl,mapnik::value,mapnik::attributes>(f,mapnik::dict2attr(d)),expr);
}
bool expression_evaluate_to_bool_(mapnik::expr_node const& expr, mapnik::feature_impl const& f, boost::python::dict const& d)
{
return boost::apply_visitor(mapnik::evaluate<mapnik::feature_impl,mapnik::value,mapnik::attributes>(f,mapnik::dict2attr(d)),expr).to_bool();
return mapnik::util::apply_visitor(mapnik::evaluate<mapnik::feature_impl,mapnik::value,mapnik::attributes>(f,mapnik::dict2attr(d)),expr).to_bool();
}
// path expression

View File

@ -20,8 +20,8 @@
*
*****************************************************************************/
#include <mapnik/config.hpp>
#include "boost_std_shared_shim.hpp"
// boost
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>

View File

@ -20,6 +20,7 @@
*
*****************************************************************************/
#include <mapnik/config.hpp>
#include "boost_std_shared_shim.hpp"
#include "python_to_value.hpp"
#include <boost/python/args.hpp> // for keywords, arg, etc

View File

@ -20,8 +20,8 @@
*
*****************************************************************************/
#include <mapnik/config.hpp>
#include "boost_std_shared_shim.hpp"
// boost
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>

View File

@ -20,6 +20,7 @@
*
*****************************************************************************/
#include <mapnik/config.hpp>
#include "boost_std_shared_shim.hpp"
// boost

View File

@ -20,6 +20,8 @@
*
*****************************************************************************/
#include <mapnik/config.hpp>
#include "boost_std_shared_shim.hpp"
// boost
@ -109,4 +111,3 @@ void export_style()
;
}

View File

@ -20,6 +20,8 @@
*
*****************************************************************************/
#include <mapnik/config.hpp>
#include "boost_std_shared_shim.hpp" // FIXME - do we need it?
// The functions in this file produce deprecation warnings.
// But as shield symbolizer doesn't fully support more than one
@ -28,9 +30,9 @@
#define NO_DEPRECATION_WARNINGS
// boost
#include <boost/python.hpp>
#include <boost/variant.hpp>
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
// mapnik
#include <mapnik/symbolizer.hpp>
@ -125,7 +127,7 @@ boost::python::object __getitem__(mapnik::symbolizer_base const& sym, std::strin
return mapnik::util::apply_visitor(extract_python_object(), itr->second);
}
//mapnik::property_meta_type const& meta = mapnik::get_meta(key);
//return boost::apply_visitor(extract_python_object(), std::get<1>(meta));
//return mapnik::util::apply_visitor(extract_python_object(), std::get<1>(meta));
return boost::python::object();
}

View File

@ -21,7 +21,7 @@
*****************************************************************************/
#include "boost_std_shared_shim.hpp"
#include <mapnik/config.hpp>
#include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp>
#include <boost/noncopyable.hpp>

View File

@ -80,7 +80,7 @@ namespace boost { namespace python {
{
static PyObject* convert(mapnik::value_holder const& v)
{
return boost::apply_visitor(value_converter(),v);
return mapnik::util::apply_visitor(value_converter(),v);
}
};

View File

@ -22,6 +22,7 @@
#if defined(GRID_RENDERER)
#include <mapnik/config.hpp>
// boost
#include <boost/python.hpp>

View File

@ -72,9 +72,9 @@ boost::python::dict grid_encode( T const& grid, std::string const& format, bool
* whether features are dumped is determined by argument not 'fields'
*/
void render_layer_for_grid(const mapnik::Map& map,
mapnik::grid& grid,
unsigned layer_idx, // TODO - layer by name or index
boost::python::list const& fields);
mapnik::grid& grid,
unsigned layer_idx, // TODO - layer by name or index
boost::python::list const& fields);
}

View File

@ -54,7 +54,7 @@ layer_info_dialog::layer_info_dialog(mapnik::layer& lay, QWidget *parent)
for (pos = ps.begin();pos != ps.end();++pos)
{
boost::optional<std::string> result;
boost::apply_visitor(mapnik::value_extractor_visitor<std::string>(result),pos->second);
mapnik::util::apply_visitor(mapnik::value_extractor_visitor<std::string>(result),pos->second);
if (result)
{
QTableWidgetItem *keyItem = new QTableWidgetItem(QString(pos->first.c_str()));

View File

@ -19,6 +19,8 @@
#include "styles_model.hpp"
#include <mapnik/config.hpp>
#include <mapnik/util/variant.hpp>
#include <mapnik/expression_string.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/rule.hpp>
@ -120,7 +122,7 @@ private:
};
struct symbolizer_info : public boost::static_visitor<QString>
struct symbolizer_info : public mapnik::util::static_visitor<QString>
{
QString operator() (mapnik::point_symbolizer const& sym) const
{
@ -183,7 +185,7 @@ struct symbolizer_info : public boost::static_visitor<QString>
}
};
struct symbolizer_icon : public boost::static_visitor<QIcon>
struct symbolizer_icon : public mapnik::util::static_visitor<QIcon>
{
QIcon operator() (mapnik::polygon_symbolizer const& sym) const
{
@ -243,12 +245,12 @@ public:
QString name() const
{
//return QString("Symbolizer:fixme");
return boost::apply_visitor(symbolizer_info(),sym_);
return mapnik::util::apply_visitor(symbolizer_info(),sym_);
}
QIcon icon() const
{
return boost::apply_visitor(symbolizer_icon(),sym_);//QIcon(":/images/filter.png");
return mapnik::util::apply_visitor(symbolizer_icon(),sym_);//QIcon(":/images/filter.png");
}
mapnik::symbolizer const& sym_;
};

View File

@ -40,8 +40,6 @@
#include <mapnik/util/variant.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/algorithm/string/replace.hpp>
// stl
@ -50,7 +48,7 @@
namespace mapnik {
template <typename Container>
struct expression_attributes : boost::static_visitor<void>
struct expression_attributes : util::static_visitor<void>
{
explicit expression_attributes(Container& names)
: names_(names) {}
@ -63,24 +61,24 @@ struct expression_attributes : boost::static_visitor<void>
template <typename Tag>
void operator() (binary_node<Tag> const& x) const
{
boost::apply_visitor(*this, x.left);
boost::apply_visitor(*this, x.right);
util::apply_visitor(*this, x.left);
util::apply_visitor(*this, x.right);
}
template <typename Tag>
void operator() (unary_node<Tag> const& x) const
{
boost::apply_visitor(*this, x.expr);
util::apply_visitor(*this, x.expr);
}
void operator() (regex_match_node const& x) const
{
boost::apply_visitor(*this, x.expr);
util::apply_visitor(*this, x.expr);
}
void operator() (regex_replace_node const& x) const
{
boost::apply_visitor(*this, x.expr);
util::apply_visitor(*this, x.expr);
}
template <typename T>
@ -105,7 +103,7 @@ public:
};
template <typename Container>
struct extract_attribute_names : boost::static_visitor<void>
struct extract_attribute_names : util::static_visitor<void>
{
explicit extract_attribute_names(Container& names)
: names_(names),
@ -115,7 +113,7 @@ struct extract_attribute_names : boost::static_visitor<void>
{
if (expr)
{
boost::apply_visitor(f_attr_, *expr);
util::apply_visitor(f_attr_, *expr);
}
}
void operator() (mapnik::transform_type const& expr) const
@ -136,7 +134,7 @@ struct extract_attribute_names : boost::static_visitor<void>
expr->add_expressions(expressions);
for (it=expressions.begin(); it != expressions.end(); ++it)
{
if (*it) boost::apply_visitor(f_attr_, **it);
if (*it) util::apply_visitor(f_attr_, **it);
}
}
}
@ -230,7 +228,7 @@ public:
}
expression_ptr const& expr = r.get_filter();
boost::apply_visitor(f_attr,*expr);
util::apply_visitor(f_attr,*expr);
}
double get_filter_factor() const
@ -251,7 +249,7 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym)
expression_ptr repeat_key = get<mapnik::expression_ptr>(sym, keys::repeat_key);
if (repeat_key)
{
boost::apply_visitor(rk_attr, *repeat_key);
util::apply_visitor(rk_attr, *repeat_key);
}
// get columns from child rules and symbolizers
@ -266,7 +264,7 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym)
// still need to collect repeat key columns
if (rule->get_repeat_key())
{
boost::apply_visitor(rk_attr, *(rule->get_repeat_key()));
util::apply_visitor(rk_attr, *(rule->get_repeat_key()));
}
}
}

View File

@ -52,4 +52,7 @@
#define PROJ_ENVELOPE_POINTS 20
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_VECTOR_SIZE 30
#endif // MAPNIK_CONFIG_HPP

View File

@ -31,10 +31,8 @@
#include <mapnik/expression_node.hpp>
#include <mapnik/color_factory.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#if defined(BOOST_REGEX_HAS_ICU)
#include <boost/regex/icu.hpp>
#else
@ -46,7 +44,7 @@ namespace mapnik {
namespace {
template <typename T, typename Attributes>
struct evaluate_expression : boost::static_visitor<T>
struct evaluate_expression : util::static_visitor<T>
{
using value_type = T;
@ -75,39 +73,39 @@ struct evaluate_expression : boost::static_visitor<T>
value_type operator() (binary_node<tags::logical_and> const & x) const
{
return (boost::apply_visitor(*this, x.left).to_bool())
&& (boost::apply_visitor(*this, x.right).to_bool());
return (util::apply_visitor(*this, x.left).to_bool())
&& (util::apply_visitor(*this, x.right).to_bool());
}
value_type operator() (binary_node<tags::logical_or> const & x) const
{
return (boost::apply_visitor(*this,x.left).to_bool())
|| (boost::apply_visitor(*this,x.right).to_bool());
return (util::apply_visitor(*this,x.left).to_bool())
|| (util::apply_visitor(*this,x.right).to_bool());
}
template <typename Tag>
value_type operator() (binary_node<Tag> const& x) const
{
typename make_op<Tag>::type operation;
return operation(boost::apply_visitor(*this, x.left),
boost::apply_visitor(*this, x.right));
return operation(util::apply_visitor(*this, x.left),
util::apply_visitor(*this, x.right));
}
template <typename Tag>
value_type operator() (unary_node<Tag> const& x) const
{
typename make_op<Tag>::type func;
return func(boost::apply_visitor(*this, x.expr));
return func(util::apply_visitor(*this, x.expr));
}
value_type operator() (unary_node<tags::logical_not> const& x) const
{
return ! (boost::apply_visitor(*this,x.expr).to_bool());
return ! (util::apply_visitor(*this,x.expr).to_bool());
}
value_type operator() (regex_match_node const& x) const
{
value_type v = boost::apply_visitor(*this, x.expr);
value_type v = util::apply_visitor(*this, x.expr);
#if defined(BOOST_REGEX_HAS_ICU)
return boost::u32regex_match(v.to_unicode(),x.pattern);
#else
@ -118,7 +116,7 @@ struct evaluate_expression : boost::static_visitor<T>
value_type operator() (regex_replace_node const& x) const
{
value_type v = boost::apply_visitor(*this, x.expr);
value_type v = util::apply_visitor(*this, x.expr);
#if defined(BOOST_REGEX_HAS_ICU)
return boost::u32regex_replace(v.to_unicode(),x.pattern,x.format);
#else
@ -138,7 +136,7 @@ struct evaluate_expression : boost::static_visitor<T>
};
template <typename T>
struct evaluate_expression<T, boost::none_t> : boost::static_visitor<T>
struct evaluate_expression<T, boost::none_t> : util::static_visitor<T>
{
using value_type = T;
@ -161,39 +159,39 @@ struct evaluate_expression<T, boost::none_t> : boost::static_visitor<T>
value_type operator() (binary_node<tags::logical_and> const & x) const
{
return (boost::apply_visitor(*this, x.left).to_bool())
&& (boost::apply_visitor(*this, x.right).to_bool());
return (util::apply_visitor(*this, x.left).to_bool())
&& (util::apply_visitor(*this, x.right).to_bool());
}
value_type operator() (binary_node<tags::logical_or> const & x) const
{
return (boost::apply_visitor(*this,x.left).to_bool())
|| (boost::apply_visitor(*this,x.right).to_bool());
return (util::apply_visitor(*this,x.left).to_bool())
|| (util::apply_visitor(*this,x.right).to_bool());
}
template <typename Tag>
value_type operator() (binary_node<Tag> const& x) const
{
typename make_op<Tag>::type operation;
return operation(boost::apply_visitor(*this, x.left),
boost::apply_visitor(*this, x.right));
return operation(util::apply_visitor(*this, x.left),
util::apply_visitor(*this, x.right));
}
template <typename Tag>
value_type operator() (unary_node<Tag> const& x) const
{
typename make_op<Tag>::type func;
return func(boost::apply_visitor(*this, x.expr));
return func(util::apply_visitor(*this, x.expr));
}
value_type operator() (unary_node<tags::logical_not> const& x) const
{
return ! (boost::apply_visitor(*this,x.expr).to_bool());
return ! (util::apply_visitor(*this,x.expr).to_bool());
}
value_type operator() (regex_match_node const& x) const
{
value_type v = boost::apply_visitor(*this, x.expr);
value_type v = util::apply_visitor(*this, x.expr);
#if defined(BOOST_REGEX_HAS_ICU)
return boost::u32regex_match(v.to_unicode(),x.pattern);
#else
@ -204,7 +202,7 @@ struct evaluate_expression<T, boost::none_t> : boost::static_visitor<T>
value_type operator() (regex_replace_node const& x) const
{
value_type v = boost::apply_visitor(*this, x.expr);
value_type v = util::apply_visitor(*this, x.expr);
#if defined(BOOST_REGEX_HAS_ICU)
return boost::u32regex_replace(v.to_unicode(),x.pattern,x.format);
#else
@ -222,10 +220,10 @@ struct evaluate_expression<T, boost::none_t> : boost::static_visitor<T>
};
template <typename T, typename Attributes>
struct assign_value : boost::static_visitor<> {};
struct assign_value : util::static_visitor<> {};
template <typename Attributes>
struct assign_value<expression_ptr,Attributes> : boost::static_visitor<>
struct assign_value<expression_ptr,Attributes> : util::static_visitor<>
{
assign_value(symbolizer_base::value_type & val, expression_ptr const& expr, Attributes const& attributes)
: val_(val),
@ -235,7 +233,7 @@ struct assign_value<expression_ptr,Attributes> : boost::static_visitor<>
void operator() (color const& default_val) const
{
// evaluate expression as a string then parse as css color
std::string str = boost::apply_visitor(mapnik::evaluate_expression<mapnik::value,
std::string str = util::apply_visitor(mapnik::evaluate_expression<mapnik::value,
Attributes>(attributes_),*expr_).to_string();
try { val_ = parse_color(str); }
catch (...) { val_ = default_val;}
@ -243,17 +241,17 @@ struct assign_value<expression_ptr,Attributes> : boost::static_visitor<>
void operator() (value_double default_val) const
{
val_ = boost::apply_visitor(mapnik::evaluate_expression<mapnik::value, Attributes>(attributes_),*expr_).to_double();
val_ = util::apply_visitor(mapnik::evaluate_expression<mapnik::value, Attributes>(attributes_),*expr_).to_double();
}
void operator() (value_integer default_val) const
{
val_ = boost::apply_visitor(mapnik::evaluate_expression<mapnik::value, Attributes>(attributes_),*expr_).to_int();
val_ = util::apply_visitor(mapnik::evaluate_expression<mapnik::value, Attributes>(attributes_),*expr_).to_int();
}
void operator() (value_bool default_val) const
{
val_ = boost::apply_visitor(mapnik::evaluate_expression<mapnik::value, Attributes>(attributes_),*expr_).to_bool();
val_ = util::apply_visitor(mapnik::evaluate_expression<mapnik::value, Attributes>(attributes_),*expr_).to_bool();
}
template <typename T>
@ -273,7 +271,7 @@ std::tuple<T,bool> pre_evaluate_expression (expression_ptr const& expr)
{
try
{
return std::make_tuple(boost::apply_visitor(mapnik::evaluate_expression<T, boost::none_t>(boost::none),*expr), true);
return std::make_tuple(util::apply_visitor(mapnik::evaluate_expression<T, boost::none_t>(boost::none),*expr), true);
}
catch (...)
{
@ -284,7 +282,7 @@ std::tuple<T,bool> pre_evaluate_expression (expression_ptr const& expr)
struct evaluate_global_attributes : mapnik::noncopyable
{
template <typename Attributes>
struct evaluator : boost::static_visitor<>
struct evaluator : util::static_visitor<>
{
evaluator(symbolizer_base::cont_type::value_type & prop, Attributes const& attributes)
: prop_(prop),
@ -294,7 +292,7 @@ struct evaluate_global_attributes : mapnik::noncopyable
{
auto const& meta = get_meta(prop_.first);
try {
boost::apply_visitor(assign_value<expression_ptr,Attributes>(prop_.second, expr, attributes_), std::get<1>(meta));
util::apply_visitor(assign_value<expression_ptr,Attributes>(prop_.second, expr, attributes_), std::get<1>(meta));
} catch (std::exception const& ex) {
// no-op
}
@ -310,7 +308,7 @@ struct evaluate_global_attributes : mapnik::noncopyable
};
template <typename Attributes>
struct extract_symbolizer : boost::static_visitor<>
struct extract_symbolizer : util::static_visitor<>
{
extract_symbolizer(Attributes const& attributes)
: attributes_(attributes) {}
@ -320,7 +318,7 @@ struct evaluate_global_attributes : mapnik::noncopyable
{
for (auto & prop : sym.properties)
{
boost::apply_visitor(evaluator<Attributes>(prop, attributes_), prop.second);
util::apply_visitor(evaluator<Attributes>(prop, attributes_), prop.second);
}
}
Attributes const& attributes_;
@ -335,7 +333,7 @@ struct evaluate_global_attributes : mapnik::noncopyable
{
for (auto & sym : rule)
{
boost::apply_visitor(extract_symbolizer<Attributes>(attributes), sym);
util::apply_visitor(extract_symbolizer<Attributes>(attributes), sym);
}
}
}

View File

@ -27,10 +27,8 @@
#include <mapnik/attribute.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/expression_node.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#if defined(BOOST_REGEX_HAS_ICU)
#include <boost/regex/icu.hpp>
#else
@ -41,7 +39,7 @@ namespace mapnik
{
template <typename T0, typename T1, typename T2>
struct evaluate : boost::static_visitor<T1>
struct evaluate : util::static_visitor<T1>
{
using feature_type = T0;
using value_type = T1;
@ -98,39 +96,39 @@ struct evaluate : boost::static_visitor<T1>
value_type operator() (binary_node<tags::logical_and> const & x) const
{
return (boost::apply_visitor(*this, x.left).to_bool())
&& (boost::apply_visitor(*this, x.right).to_bool());
return (util::apply_visitor(*this, x.left).to_bool())
&& (util::apply_visitor(*this, x.right).to_bool());
}
value_type operator() (binary_node<tags::logical_or> const & x) const
{
return (boost::apply_visitor(*this,x.left).to_bool())
|| (boost::apply_visitor(*this,x.right).to_bool());
return (util::apply_visitor(*this,x.left).to_bool())
|| (util::apply_visitor(*this,x.right).to_bool());
}
template <typename Tag>
value_type operator() (binary_node<Tag> const& x) const
{
typename make_op<Tag>::type operation;
return operation(boost::apply_visitor(*this, x.left),
boost::apply_visitor(*this, x.right));
return operation(util::apply_visitor(*this, x.left),
util::apply_visitor(*this, x.right));
}
template <typename Tag>
value_type operator() (unary_node<Tag> const& x) const
{
typename make_op<Tag>::type func;
return func(boost::apply_visitor(*this, x.expr));
return func(util::apply_visitor(*this, x.expr));
}
value_type operator() (unary_node<tags::logical_not> const& x) const
{
return ! (boost::apply_visitor(*this,x.expr).to_bool());
return ! (util::apply_visitor(*this,x.expr).to_bool());
}
value_type operator() (regex_match_node const& x) const
{
value_type v = boost::apply_visitor(*this, x.expr);
value_type v = util::apply_visitor(*this, x.expr);
#if defined(BOOST_REGEX_HAS_ICU)
return boost::u32regex_match(v.to_unicode(),x.pattern);
#else
@ -141,7 +139,7 @@ struct evaluate : boost::static_visitor<T1>
value_type operator() (regex_replace_node const& x) const
{
value_type v = boost::apply_visitor(*this, x.expr);
value_type v = util::apply_visitor(*this, x.expr);
#if defined(BOOST_REGEX_HAS_ICU)
return boost::u32regex_replace(v.to_unicode(),x.pattern,x.format);
#else

View File

@ -24,11 +24,11 @@
#define MAPNIK_EXPRESSION_NODE_TYPES_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/mpl/vector/vector30.hpp>
#include <boost/variant/recursive_variant.hpp>
#include <boost/mpl/vector.hpp>
namespace mapnik
{
@ -166,7 +166,7 @@ struct attribute;
struct global_attribute;
struct geometry_type_attribute;
using expr_types = boost::mpl::vector25<
using expr_node = util::variant<
value_null,
value_bool,
value_integer,
@ -175,26 +175,24 @@ value_unicode_string,
attribute,
global_attribute,
geometry_type_attribute,
boost::recursive_wrapper<unary_node<tags::negate> >,
boost::recursive_wrapper<binary_node<tags::plus> >,
boost::recursive_wrapper<binary_node<tags::minus> >,
boost::recursive_wrapper<binary_node<tags::mult> >,
boost::recursive_wrapper<binary_node<tags::div> >,
boost::recursive_wrapper<binary_node<tags::mod> >,
boost::recursive_wrapper<binary_node<tags::less> >,
boost::recursive_wrapper<binary_node<tags::less_equal> >,
boost::recursive_wrapper<binary_node<tags::greater> >,
boost::recursive_wrapper<binary_node<tags::greater_equal> >,
boost::recursive_wrapper<binary_node<tags::equal_to> >,
boost::recursive_wrapper<binary_node<tags::not_equal_to> >,
boost::recursive_wrapper<unary_node<tags::logical_not> >,
boost::recursive_wrapper<binary_node<tags::logical_and> >,
boost::recursive_wrapper<binary_node<tags::logical_or> >,
boost::recursive_wrapper<regex_match_node>,
boost::recursive_wrapper<regex_replace_node>
>::type;
using expr_node = boost::make_recursive_variant_over<expr_types>::type;
util::recursive_wrapper<unary_node<tags::negate> >,
util::recursive_wrapper<binary_node<tags::plus> >,
util::recursive_wrapper<binary_node<tags::minus> >,
util::recursive_wrapper<binary_node<tags::mult> >,
util::recursive_wrapper<binary_node<tags::div> >,
util::recursive_wrapper<binary_node<tags::mod> >,
util::recursive_wrapper<binary_node<tags::less> >,
util::recursive_wrapper<binary_node<tags::less_equal> >,
util::recursive_wrapper<binary_node<tags::greater> >,
util::recursive_wrapper<binary_node<tags::greater_equal> >,
util::recursive_wrapper<binary_node<tags::equal_to> >,
util::recursive_wrapper<binary_node<tags::not_equal_to> >,
util::recursive_wrapper<unary_node<tags::logical_not> >,
util::recursive_wrapper<binary_node<tags::logical_and> >,
util::recursive_wrapper<binary_node<tags::logical_or> >,
util::recursive_wrapper<regex_match_node>,
util::recursive_wrapper<regex_replace_node>
>;
}

View File

@ -45,10 +45,6 @@
#include <mapnik/proj_transform.hpp>
#include <mapnik/util/featureset_buffer.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/variant/apply_visitor.hpp>
//#include <boost/variant/static_visitor.hpp>
// stl
#include <vector>
#include <stdexcept>
@ -654,7 +650,7 @@ void feature_style_processor<Processor>::render_style(
for (rule const* r : rc.get_if_rules() )
{
expression_ptr const& expr = r->get_filter();
value_type result = boost::apply_visitor(evaluate<feature_impl,value_type,attributes>(*feature,vars),*expr);
value_type result = util::apply_visitor(evaluate<feature_impl,value_type,attributes>(*feature,vars),*expr);
if (result.to_bool())
{
was_painted = true;

View File

@ -23,9 +23,8 @@
#ifndef MAPNIK_GROUP_LAYOUT_HPP
#define MAPNIK_GROUP_LAYOUT_HPP
// boost
#include <boost/variant.hpp>
// mapnik
#include <mapnik/util/variant.hpp>
// std
#include <memory>
@ -88,7 +87,7 @@ private:
double max_difference_;
};
using group_layout = boost::variant<simple_row_layout,pair_layout>;
using group_layout = util::variant<simple_row_layout,pair_layout>;
using group_layout_ptr = std::shared_ptr<group_layout>;
}

View File

@ -28,8 +28,7 @@
#include <mapnik/image_filter_types.hpp>
#include <mapnik/util/hsl.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
// boost GIL
#include <boost/gil/gil_all.hpp>
// agg
@ -758,7 +757,7 @@ void apply_filter(Src & src, invert const& /*op*/)
}
template <typename Src>
struct filter_visitor : boost::static_visitor<void>
struct filter_visitor : util::static_visitor<void>
{
filter_visitor(Src & src)
: src_(src) {}
@ -772,7 +771,7 @@ struct filter_visitor : boost::static_visitor<void>
Src & src_;
};
struct filter_radius_visitor : boost::static_visitor<void>
struct filter_radius_visitor : util::static_visitor<void>
{
int & radius_;
filter_radius_visitor(int & radius)

View File

@ -27,11 +27,7 @@
#include <mapnik/config.hpp>
#include <mapnik/color.hpp>
#include <mapnik/config_error.hpp>
// boost
#include <boost/variant/variant.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <mapnik/util/variant.hpp>
// stl
#include <vector>
@ -158,19 +154,19 @@ struct colorize_alpha : std::vector<color_stop>
colorize_alpha() {}
};
using filter_type = boost::variant<filter::blur,
filter::gray,
filter::agg_stack_blur,
filter::emboss,
filter::sharpen,
filter::edge_detect,
filter::sobel,
filter::x_gradient,
filter::y_gradient,
filter::invert,
filter::scale_hsla,
filter::colorize_alpha,
filter::color_to_alpha>;
using filter_type = util::variant<filter::blur,
filter::gray,
filter::agg_stack_blur,
filter::emboss,
filter::sharpen,
filter::edge_detect,
filter::sobel,
filter::x_gradient,
filter::y_gradient,
filter::invert,
filter::scale_hsla,
filter::colorize_alpha,
filter::color_to_alpha>;
inline std::ostream& operator<< (std::ostream& os, blur)
{
@ -268,7 +264,7 @@ inline std::ostream& operator<< (std::ostream& os, colorize_alpha const& filter)
template <typename Out>
struct to_string_visitor : boost::static_visitor<void>
struct to_string_visitor : util::static_visitor<void>
{
to_string_visitor(Out & out)
: out_(out) {}
@ -285,7 +281,7 @@ struct to_string_visitor : boost::static_visitor<void>
inline std::ostream& operator<< (std::ostream& os, filter_type const& filter)
{
to_string_visitor<std::ostream> visitor(os);
boost::apply_visitor(visitor, filter);
util::apply_visitor(std::ref(visitor), filter);
return os;
}

View File

@ -28,6 +28,7 @@
#include <boost/spirit/include/phoenix.hpp>
// mapnik
#include <mapnik/util/variant.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_utils.hpp>
#include <mapnik/json/generic_json.hpp>
@ -41,7 +42,7 @@ namespace standard_wide = boost::spirit::standard_wide;
using standard_wide::space_type;
template <typename Symbolizer>
struct json_value_visitor : boost::static_visitor<>
struct json_value_visitor : mapnik::util::static_visitor<>
{
json_value_visitor(Symbolizer & sym, mapnik::keys key)
: sym_(sym), key_(key) {}
@ -78,7 +79,7 @@ struct json_value_visitor : boost::static_visitor<>
};
template <typename T>
struct put_property_visitor : boost::static_visitor<>
struct put_property_visitor : mapnik::util::static_visitor<>
{
using value_type = T;
@ -88,7 +89,7 @@ struct put_property_visitor : boost::static_visitor<>
template <typename Symbolizer>
void operator() (Symbolizer & sym) const
{
boost::apply_visitor(json_value_visitor<Symbolizer>(sym, key_), val_);
mapnik::util::apply_visitor(json_value_visitor<Symbolizer>(sym, key_), val_);
}
keys key_;
@ -103,7 +104,7 @@ struct put_property
{
try
{
boost::apply_visitor(put_property_visitor<T2>(get_key(name),val), sym);
mapnik::util::apply_visitor(put_property_visitor<T2>(get_key(name),val), sym);
}
catch (std::runtime_error const& err)
{
@ -115,7 +116,7 @@ struct put_property
template <typename Iterator>
struct symbolizer_grammar : qi::grammar<Iterator, space_type, symbolizer()>
{
using json_value_type = boost::variant<value_null,value_bool,value_integer,value_double, std::string>;
using json_value_type = util::variant<value_null,value_bool,value_integer,value_double, std::string>;
symbolizer_grammar()
: symbolizer_grammar::base_type(sym, "symbolizer"),
json_()

View File

@ -56,7 +56,6 @@
// boost
#include <boost/optional.hpp>
#include <boost/variant/apply_visitor.hpp>
// stl
#include <memory>
@ -328,17 +327,17 @@ void build_ellipse(T const& sym, mapnik::feature_impl & feature, attributes cons
double height = 0;
if (width_expr && height_expr)
{
width = boost::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *width_expr).to_double();
height = boost::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *height_expr).to_double();
width = util::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *width_expr).to_double();
height = util::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *height_expr).to_double();
}
else if (width_expr)
{
width = boost::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *width_expr).to_double();
width = util::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *width_expr).to_double();
height = width;
}
else if (height_expr)
{
height = boost::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *height_expr).to_double();
height = util::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *height_expr).to_double();
width = height;
}
svg::svg_converter_type styled_svg(svg_path, marker_ellipse.attributes());
@ -431,11 +430,11 @@ void setup_transform_scaling(agg::trans_affine & tr,
expression_ptr width_expr = get<expression_ptr>(sym, keys::width);
if (width_expr)
width = boost::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *width_expr).to_double();
width = util::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *width_expr).to_double();
expression_ptr height_expr = get<expression_ptr>(sym, keys::height);
if (height_expr)
height = boost::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *height_expr).to_double();
height = util::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *height_expr).to_double();
if (width > 0 && height > 0)
{

View File

@ -29,8 +29,7 @@
#include <mapnik/markers_placements/vertext_first.hpp>
#include <mapnik/markers_placements/vertext_last.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <boost/variant.hpp>
#include <mapnik/util/variant.hpp>
#include <boost/functional/value_factory.hpp>
#include <boost/function.hpp>
@ -41,13 +40,13 @@ template <typename Locator, typename Detector>
class markers_placement_finder : mapnik::noncopyable
{
public:
using markers_placement = boost::variant<markers_point_placement<Locator, Detector>,
markers_line_placement<Locator, Detector>,
markers_interior_placement<Locator, Detector>,
markers_vertex_first_placement<Locator, Detector>,
markers_vertex_last_placement<Locator, Detector>>;
using markers_placement = util::variant<markers_point_placement<Locator, Detector>,
markers_line_placement<Locator, Detector>,
markers_interior_placement<Locator, Detector>,
markers_vertex_first_placement<Locator, Detector>,
markers_vertex_last_placement<Locator, Detector>>;
class get_point_visitor : public boost::static_visitor<bool>
class get_point_visitor : public util::static_visitor<bool>
{
public:
get_point_visitor(double &x, double &y, double &angle, bool ignore_placement)
@ -81,19 +80,19 @@ public:
// Get next point where the marker should be placed. Returns true if a place is found, false if none is found.
bool get_point(double &x, double &y, double &angle, bool ignore_placement)
{
return boost::apply_visitor(get_point_visitor(x, y, angle, ignore_placement), placement_);
return util::apply_visitor(get_point_visitor(x, y, angle, ignore_placement), placement_);
}
private:
// Factory function for particular placement implementations.
static markers_placement create(marker_placement_e placement_type,
Locator &locator,
box2d<double> const& size,
agg::trans_affine const& tr,
Detector &detector,
double spacing,
double max_error,
bool allow_overlap)
Locator &locator,
box2d<double> const& size,
agg::trans_affine const& tr,
Detector &detector,
double spacing,
double max_error,
bool allow_overlap)
{
static const std::map<marker_placement_e, boost::function<markers_placement(
Locator &locator,

View File

@ -26,8 +26,8 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/variant/variant.hpp>
#include <boost/optional.hpp>
// stl
@ -40,7 +40,7 @@ namespace mapnik
// fwd declare
class boolean_type;
using value_holder = boost::variant<value_null,value_integer,value_double,std::string>;
using value_holder = util::variant<value_null,value_integer,value_double,std::string>;
using parameter = std::pair<std::string, value_holder>;
using param_map = std::map<std::string, value_holder>;

View File

@ -29,9 +29,6 @@
#include <mapnik/boolean.hpp>
#include <mapnik/util/conversions.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp> // keep gcc happy
#include <boost/variant/variant.hpp>
#include <boost/optional.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
@ -120,7 +117,7 @@ boost::optional<T> param_cast(std::string const& source)
} // end namespace detail
template <typename T>
struct value_extractor_visitor : public boost::static_visitor<>
struct value_extractor_visitor : public util::static_visitor<>
{
value_extractor_visitor(boost::optional<T> & var)
@ -166,7 +163,7 @@ struct converter
parameters::const_iterator itr = params.find(name);
if (itr != params.end())
{
boost::apply_visitor(value_extractor_visitor<T>(result),itr->second);
util::apply_visitor(value_extractor_visitor<T>(result),itr->second);
}
return result;
}

View File

@ -23,11 +23,10 @@
#ifndef MAPNIK_PATH_EXPRESSION_HPP
#define MAPNIK_PATH_EXPRESSION_HPP
// boost
#include <boost/variant/variant_fwd.hpp>
#include <memory>
#include <mapnik/config.hpp>
#include <mapnik/util/variant.hpp>
// stl
#include <memory>
#include <string>
#include <vector>
@ -36,7 +35,7 @@ namespace mapnik
struct attribute;
using path_component = boost::variant<std::string, attribute>;
using path_component = util::variant<std::string, attribute>;
using path_expression = std::vector<path_component>;
using path_expression_ptr = std::shared_ptr<path_expression>;

View File

@ -36,6 +36,7 @@
#include <mapnik/group/group_symbolizer_properties.hpp>
#include <mapnik/text/placements_list.hpp>
#include <mapnik/util/conversions.hpp>
#include <mapnik/util/variant.hpp>
#include <mapnik/label_collision_detector.hpp>
// agg
@ -98,8 +99,8 @@ struct text_render_thunk
// Variant type for render thunks to allow us to re-render them
// via a static visitor later.
using render_thunk = boost::variant<point_render_thunk,
text_render_thunk>;
using render_thunk = util::variant<point_render_thunk,
text_render_thunk>;
using render_thunk_ptr = std::shared_ptr<render_thunk>;
using render_thunk_list = std::list<render_thunk_ptr>;
@ -265,7 +266,7 @@ void render_group_symbolizer(group_symbolizer const& sym,
// get the layout for this set of properties
for (auto const& rule : props->get_rules())
{
if (boost::apply_visitor(evaluate<Feature,value_type,attributes>(*sub_feature,common.vars_),
if (util::apply_visitor(evaluate<Feature,value_type,attributes>(*sub_feature,common.vars_),
*(rule->get_filter())).to_bool())
{
// add matched rule and feature to the list of things to draw
@ -321,8 +322,8 @@ void render_group_symbolizer(group_symbolizer const& sym,
// evalute the repeat key with the matched sub feature if we have one
if (rpt_key_expr)
{
rpt_key_value = boost::apply_visitor(evaluate<Feature,value_type,attributes>(*match_feature,common.vars_),
*rpt_key_expr).to_unicode();
rpt_key_value = util::apply_visitor(evaluate<Feature,value_type,attributes>(*match_feature,common.vars_),
*rpt_key_expr).to_unicode();
}
helper.add_box_element(layout_manager.offset_box_at(i), rpt_key_value);
}

View File

@ -38,10 +38,7 @@
#include <mapnik/pixel_position.hpp>
#include <mapnik/request.hpp>
#include <mapnik/renderer_common.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
#include <mapnik/util/variant.hpp>
#include <memory>
// stl
@ -123,15 +120,13 @@ public:
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
/*!
* @brief Overload that process the whole set of symbolizers of a rule.
* @return true, meaning that this renderer can process multiple symbolizers.
*/
// Overload that process the whole set of symbolizers of a rule.
// return true, meaning that this renderer can process multiple symbolizers.
bool process(rule::symbolizers const& syms,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void painted(bool /*painted*/)
void painted(bool)
{
// nothing to do
}
@ -168,13 +163,12 @@ private:
bool painted_;
renderer_common common_;
/*!
* @brief Visitor that makes the calls to process each symbolizer when stored in a boost::variant.
* This object follows the model of that found in feature_style_processor. It appears here, because
* the logic that iterates over the set of symbolizer has been moved to an SVG renderer's internal
* method.
*/
struct symbol_dispatch : public boost::static_visitor<>
// Visitor that makes the calls to process each symbolizer when stored in a variant.
// This object follows the model of that found in feature_style_processor. It appears here, because
// the logic that iterates over the set of symbolizer has been moved to an SVG renderer's internal
// method.
struct symbol_dispatch : public util::static_visitor<>
{
symbol_dispatch(svg_renderer<OutputIterator>& processor,
mapnik::feature_impl & feature,

View File

@ -337,7 +337,7 @@ struct evaluate_expression_wrapper
template <typename T1, typename T2, typename T3>
result_type operator() (T1 const& expr, T2 const& feature, T3 const& vars) const
{
mapnik::value_type result = boost::apply_visitor(mapnik::evaluate<T2,mapnik::value_type,T3>(feature,vars), expr);
mapnik::value_type result = util::apply_visitor(mapnik::evaluate<T2,mapnik::value_type,T3>(feature,vars), expr);
return detail::expression_result<result_type, std::is_enum<result_type>::value>::convert(result);
}
};
@ -349,7 +349,7 @@ struct evaluate_expression_wrapper<mapnik::color>
template <typename T1, typename T2, typename T3>
mapnik::color operator() (T1 const& expr, T2 const& feature, T3 const& vars) const
{
mapnik::value_type val = boost::apply_visitor(mapnik::evaluate<T2,mapnik::value_type,T3>(feature,vars), expr);
mapnik::value_type val = util::apply_visitor(mapnik::evaluate<T2,mapnik::value_type,T3>(feature,vars), expr);
// FIXME - throw instead?
if (val.is_null()) return mapnik::color(255,192,203); // pink
return mapnik::color(val.to_string());
@ -363,7 +363,7 @@ struct evaluate_expression_wrapper<mapnik::enumeration_wrapper>
template <typename T1, typename T2, typename T3>
mapnik::enumeration_wrapper operator() (T1 const& expr, T2 const& feature, T3 const& vars) const
{
mapnik::value_type val = boost::apply_visitor(mapnik::evaluate<T2,mapnik::value_type,T3>(feature,vars), expr);
mapnik::value_type val = util::apply_visitor(mapnik::evaluate<T2,mapnik::value_type,T3>(feature,vars), expr);
return mapnik::enumeration_wrapper(val.to_int());
}
};
@ -374,7 +374,7 @@ struct evaluate_expression_wrapper<mapnik::dash_array>
template <typename T1, typename T2, typename T3>
mapnik::dash_array operator() (T1 const& expr, T2 const& feature, T3 const& vars) const
{
mapnik::value_type val = boost::apply_visitor(mapnik::evaluate<T2,mapnik::value_type,T3>(feature,vars), expr);
mapnik::value_type val = util::apply_visitor(mapnik::evaluate<T2,mapnik::value_type,T3>(feature,vars), expr);
// FIXME - throw?
if (val.is_null()) return dash_array();
dash_array dash;

View File

@ -38,8 +38,6 @@
#include <mapnik/evaluate_global_attributes.hpp>
#include <mapnik/parse_transform.hpp>
#include <mapnik/util/variant.hpp>
// boost
//#include <boost/variant/apply_visitor.hpp>
namespace mapnik {

View File

@ -29,11 +29,9 @@
#include <mapnik/value_types.hpp>
#include <mapnik/expression_node_types.hpp>
#include <mapnik/expression_node.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/optional.hpp>
#include <boost/variant/variant.hpp>
// fusion
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/include/vector.hpp>
@ -147,13 +145,13 @@ namespace detail {
// default-constructible, but also makes little sense with our variant of
// transform nodes...
using transform_variant = boost::variant< identity_node
,matrix_node
,translate_node
,scale_node
,rotate_node
,skewX_node
,skewY_node >;
using transform_variant = mapnik::util::variant< identity_node,
matrix_node,
translate_node,
scale_node,
rotate_node,
skewX_node,
skewY_node >;
// ... thus we wrap the variant-type in a distinct type and provide
// a custom clear overload, which resets the value to identity_node
@ -214,7 +212,7 @@ struct is_null_transform_node : public mapnik::util::static_visitor<bool>
bool operator() (detail::transform_variant const& var) const
{
return boost::apply_visitor(*this, var);
return util::apply_visitor(*this, var);
}
};
@ -223,7 +221,7 @@ struct is_null_transform_node : public mapnik::util::static_visitor<bool>
template <typename T>
bool is_null_node (T const& node)
{
return boost::apply_visitor(is_null_transform_node(), node);
return util::apply_visitor(is_null_transform_node(), node);
}
} // namespace detail

View File

@ -28,11 +28,7 @@
#include <mapnik/value.hpp>
#include <mapnik/transform_expression.hpp>
#include <mapnik/expression_evaluator.hpp>
// boost
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <mapnik/util/variant.hpp>
// agg
#include <agg_trans_affine.h>
@ -50,7 +46,7 @@ struct transform_processor
using transform_type = agg::trans_affine;
template <typename Container>
struct attribute_collector : boost::static_visitor<void>
struct attribute_collector : util::static_visitor<void>
{
expression_attributes<Container> collect_;
@ -63,45 +59,45 @@ struct transform_processor
void operator() (matrix_node const& node) const
{
boost::apply_visitor(collect_, node.a_);
boost::apply_visitor(collect_, node.b_);
boost::apply_visitor(collect_, node.c_);
boost::apply_visitor(collect_, node.d_);
boost::apply_visitor(collect_, node.e_);
boost::apply_visitor(collect_, node.f_);
util::apply_visitor(collect_, node.a_);
util::apply_visitor(collect_, node.b_);
util::apply_visitor(collect_, node.c_);
util::apply_visitor(collect_, node.d_);
util::apply_visitor(collect_, node.e_);
util::apply_visitor(collect_, node.f_);
}
void operator() (translate_node const& node) const
{
boost::apply_visitor(collect_, node.tx_);
boost::apply_visitor(collect_, node.ty_);
util::apply_visitor(collect_, node.tx_);
util::apply_visitor(collect_, node.ty_);
}
void operator() (scale_node const& node) const
{
boost::apply_visitor(collect_, node.sx_);
boost::apply_visitor(collect_, node.sy_);
util::apply_visitor(collect_, node.sx_);
util::apply_visitor(collect_, node.sy_);
}
void operator() (rotate_node const& node) const
{
boost::apply_visitor(collect_, node.angle_);
boost::apply_visitor(collect_, node.cx_);
boost::apply_visitor(collect_, node.cy_);
util::apply_visitor(collect_, node.angle_);
util::apply_visitor(collect_, node.cx_);
util::apply_visitor(collect_, node.cy_);
}
void operator() (skewX_node const& node) const
{
boost::apply_visitor(collect_, node.angle_);
util::apply_visitor(collect_, node.angle_);
}
void operator() (skewY_node const& node) const
{
boost::apply_visitor(collect_, node.angle_);
util::apply_visitor(collect_, node.angle_);
}
};
struct node_evaluator : boost::static_visitor<void>
struct node_evaluator : util::static_visitor<void>
{
node_evaluator(transform_type& tr,
feature_type const& feat,
@ -173,7 +169,7 @@ struct transform_processor
double eval(expr_node const& x) const
{
mapnik::evaluate<feature_type, value_type, variable_type> e(feature_,vars_);
return boost::apply_visitor(e, x).to_double();
return util::apply_visitor(e, x).to_double();
}
double eval(expr_node const& x, double def) const
@ -195,7 +191,7 @@ struct transform_processor
for (transform_node const& node : list)
{
boost::apply_visitor(collect, *node);
util::apply_visitor(collect, *node);
}
}
@ -210,7 +206,7 @@ struct transform_processor
transform_list::const_reverse_iterator rit;
for (rit = list.rbegin(); rit!= list.rend(); ++rit)
{
boost::apply_visitor(eval, *(*rit));
util::apply_visitor(eval, *(*rit));
}
}

View File

@ -23,6 +23,8 @@
#ifndef MAPNIK_UTIL_VARIANT_HPP
#define MAPNIK_UTIL_VARIANT_HPP
#include <mapnik/config.hpp>
#include <utility>
#include <typeinfo>
#include <type_traits>

View File

@ -23,6 +23,20 @@
#ifndef MAPNIK_VERTEX_CONVERTERS_HPP
#define MAPNIK_VERTEX_CONVERTERS_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/attribute.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/offset_converter.hpp>
#include <mapnik/simplify.hpp>
#include <mapnik/simplify_converter.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/symbolizer_keys.hpp>
#include <mapnik/symbolizer.hpp>
// boost
#include <boost/type_traits/is_same.hpp>
@ -39,17 +53,7 @@
#include <boost/fusion/include/at_c.hpp>
#include <boost/fusion/container/vector.hpp>
// mapnik
#include <mapnik/attribute.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/offset_converter.hpp>
#include <mapnik/simplify.hpp>
#include <mapnik/simplify_converter.hpp>
#include <mapnik/noncopyable.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/symbolizer_keys.hpp>
#include <mapnik/symbolizer.hpp>
// agg
#include "agg_math_stroke.h"

View File

@ -29,10 +29,9 @@
#include <mapnik/ctrans.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/format.hpp>
#include <boost/variant/apply_visitor.hpp>
// stl
#include <cmath>
#include <memory>
@ -94,7 +93,7 @@ feature_ptr gdal_featureset::next()
{
first_ = false;
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Next feature in Dataset=" << &dataset_;
return boost::apply_visitor(query_dispatch(*this), gquery_);
return mapnik::util::apply_visitor(query_dispatch(*this), gquery_);
}
return feature_ptr();
}

View File

@ -25,9 +25,8 @@
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/variant.hpp>
#include <boost/optional.hpp>
#include "gdal_datasource.hpp"
@ -35,11 +34,11 @@
class GDALDataset;
class GDALRasterBand;
using gdal_query = boost::variant<mapnik::query, mapnik::coord2d>;
using gdal_query = mapnik::util::variant<mapnik::query, mapnik::coord2d>;
class gdal_featureset : public mapnik::Featureset
{
struct query_dispatch : public boost::static_visitor<mapnik::feature_ptr>
struct query_dispatch : public mapnik::util::static_visitor<mapnik::feature_ptr>
{
query_dispatch( gdal_featureset & featureset)
: featureset_(featureset) {}

View File

@ -65,7 +65,7 @@ feature_ptr rasterlite_featureset::next()
{
first_ = false;
MAPNIK_LOG_DEBUG(gdal) << "rasterlite_featureset: Next feature in Dataset=" << &dataset_;
return boost::apply_visitor(query_dispatch(*this), gquery_);
return mapnik::util::apply_visitor(query_dispatch(*this), gquery_);
}
return feature_ptr();
}

View File

@ -27,17 +27,15 @@
#include <mapnik/feature.hpp>
#include <mapnik/query.hpp>
#include <mapnik/datasource.hpp>
// boost
#include <boost/variant.hpp>
#include <mapnik/util/variant.hpp>
#include "rasterlite_include.hpp"
using rasterlite_query = boost::variant<mapnik::query,mapnik::coord2d>;
using rasterlite_query = mapnik::util::variant<mapnik::query,mapnik::coord2d>;
class rasterlite_featureset : public mapnik::Featureset
{
struct query_dispatch : public boost::static_visitor<mapnik::feature_ptr>
struct query_dispatch : public mapnik::util::static_visitor<mapnik::feature_ptr>
{
query_dispatch( rasterlite_featureset & featureset)
: featureset_(featureset) {}

View File

@ -221,7 +221,7 @@ void agg_renderer<T0,T1>::start_style_processing(feature_type_style const& st)
mapnik::filter::filter_radius_visitor visitor(radius);
for (mapnik::filter::filter_type const& filter_tag : st.image_filters())
{
boost::apply_visitor(visitor, filter_tag);
util::apply_visitor(visitor, filter_tag);
}
if (radius > common_.t_.offset())
{
@ -277,7 +277,7 @@ void agg_renderer<T0,T1>::end_style_processing(feature_type_style const& st)
mapnik::filter::filter_visitor<image_32> visitor(*current_buffer_);
for (mapnik::filter::filter_type const& filter_tag : st.image_filters())
{
boost::apply_visitor(visitor, filter_tag);
util::apply_visitor(visitor, filter_tag);
}
}
if (st.comp_op())
@ -299,7 +299,7 @@ void agg_renderer<T0,T1>::end_style_processing(feature_type_style const& st)
mapnik::filter::filter_visitor<image_32> visitor(pixmap_);
for (mapnik::filter::filter_type const& filter_tag : st.direct_image_filters())
{
boost::apply_visitor(visitor, filter_tag);
util::apply_visitor(visitor, filter_tag);
}
MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: End processing style";
}

View File

@ -25,7 +25,7 @@
#include <mapnik/agg_renderer.hpp>
#include <mapnik/agg_rasterizer.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/util/variant.hpp>
#include <mapnik/text/renderer.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/symbolizer.hpp>
@ -35,9 +35,6 @@
// agg
#include "agg_trans_affine.h"
// boost
#include <boost/variant/apply_visitor.hpp>
namespace mapnik {
/**
@ -46,7 +43,7 @@ namespace mapnik {
* to render it, and the boxes themselves should already be
* in the detector from the placement_finder.
*/
struct thunk_renderer : public boost::static_visitor<>
struct thunk_renderer : public util::static_visitor<>
{
using renderer_type = agg_renderer<image_32>;
using buffer_type = typename renderer_type::buffer_type;
@ -112,7 +109,7 @@ void agg_renderer<T0,T1>::process(group_symbolizer const& sym,
thunk_renderer ren(*this, current_buffer_, common_, render_offset);
for (render_thunk_ptr const& thunk : thunks)
{
boost::apply_visitor(ren, *thunk);
util::apply_visitor(ren, *thunk);
}
});
}

View File

@ -43,7 +43,7 @@ namespace {
// to render it, and the boxes themselves should already be
// in the detector from the placement_finder.
template <typename T>
struct thunk_renderer : public boost::static_visitor<>
struct thunk_renderer : public util::static_visitor<>
{
using renderer_type = cairo_renderer<T>;
@ -112,7 +112,7 @@ void cairo_renderer<T>::process(group_symbolizer const& sym,
thunk_renderer<T> ren(*this, context_, face_manager_, common_, render_offset);
for (render_thunk_ptr const& thunk : thunks)
{
boost::apply_visitor(ren, *thunk);
util::apply_visitor(ren, *thunk);
}
});
}

View File

@ -31,7 +31,6 @@
#include <mapnik/value.hpp>
// boost
#include <boost/variant.hpp>
#if defined(BOOST_REGEX_HAS_ICU)
#include <boost/regex/icu.hpp> // for u32regex
#endif
@ -39,7 +38,7 @@
namespace mapnik
{
struct expression_string : boost::static_visitor<void>
struct expression_string : util::static_visitor<void>
{
explicit expression_string(std::string & str)
: str_(str) {}
@ -75,9 +74,9 @@ struct expression_string : boost::static_visitor<void>
str_ += "(";
}
boost::apply_visitor(expression_string(str_),x.left);
util::apply_visitor(expression_string(str_),x.left);
str_ += x.type();
boost::apply_visitor(expression_string(str_),x.right);
util::apply_visitor(expression_string(str_),x.right);
if (x.type() != tags::mult::str() && x.type() != tags::div::str())
{
str_ += ")";
@ -89,13 +88,13 @@ struct expression_string : boost::static_visitor<void>
{
str_ += Tag::str();
str_ += "(";
boost::apply_visitor(expression_string(str_),x.expr);
util::apply_visitor(expression_string(str_),x.expr);
str_ += ")";
}
void operator() (regex_match_node const & x) const
{
boost::apply_visitor(expression_string(str_),x.expr);
util::apply_visitor(expression_string(str_),x.expr);
str_ +=".match('";
#if defined(BOOST_REGEX_HAS_ICU)
std::string utf8;
@ -110,7 +109,7 @@ struct expression_string : boost::static_visitor<void>
void operator() (regex_replace_node const & x) const
{
boost::apply_visitor(expression_string(str_),x.expr);
util::apply_visitor(expression_string(str_),x.expr);
str_ +=".replace(";
str_ += "'";
#if defined(BOOST_REGEX_HAS_ICU)
@ -137,7 +136,7 @@ std::string to_expression_string(expr_node const& node)
{
std::string str;
expression_string functor(str);
boost::apply_visitor(functor,node);
util::apply_visitor(std::ref(functor),node);
return str;
}

View File

@ -32,7 +32,7 @@
#include <mapnik/text/renderer.hpp>
#include <mapnik/group/group_layout_manager.hpp>
#include <mapnik/group/group_symbolizer_helper.hpp>
#include <mapnik/util/variant.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/label_collision_detector.hpp>
@ -53,7 +53,7 @@ namespace mapnik {
* in the detector from the placement_finder.
*/
template <typename T0>
struct thunk_renderer : public boost::static_visitor<>
struct thunk_renderer : public util::static_visitor<>
{
using renderer_type = grid_renderer<T0>;
using buffer_type = typename renderer_type::buffer_type;
@ -122,7 +122,7 @@ void grid_renderer<T>::process(group_symbolizer const& sym,
thunk_renderer<T> ren(*this, pixmap_, common_, feature, render_offset);
for (render_thunk_ptr const& thunk : thunks)
{
boost::apply_visitor(ren, *thunk);
util::apply_visitor(ren, *thunk);
}
});
}

View File

@ -22,9 +22,7 @@
// mapnik
#include <mapnik/group/group_layout_manager.hpp>
// boost
#include <boost/variant.hpp>
#include <mapnik/util/variant.hpp>
// std
#include <cmath>
@ -33,23 +31,23 @@ namespace mapnik
{
// This visitor will process offsets for the given layout
struct process_layout : public boost::static_visitor<>
struct process_layout : public util::static_visitor<>
{
// The vector containing the existing, centered item bounding boxes
const vector<bound_box> &member_boxes_;
vector<bound_box> const& member_boxes_;
// The vector to populate with item offsets
vector<pixel_position> &member_offsets_;
vector<pixel_position> & member_offsets_;
// The origin point of the member boxes
// i.e. The member boxes are positioned around input_origin,
// and the offset values should position them around (0,0)
const pixel_position &input_origin_;
pixel_position const& input_origin_;
process_layout(const vector<bound_box> &member_bboxes,
process_layout(const vector<bound_box> &member_bboxes,
vector<pixel_position> &member_offsets,
const pixel_position &input_origin)
: member_boxes_(member_bboxes),
: member_boxes_(member_bboxes),
member_offsets_(member_offsets),
input_origin_(input_origin)
{
@ -63,7 +61,7 @@ struct process_layout : public boost::static_visitor<>
{
total_width += box.width();
}
double x_offset = -(total_width / 2.0);
for (auto const& box : member_boxes_)
{
@ -111,7 +109,7 @@ struct process_layout : public boost::static_visitor<>
}
}
private:
// Place member bound boxes at [ifirst] and [ifirst + 1] in a horizontal pairi, vertically
@ -132,7 +130,7 @@ private:
pair_box.expand_to_include(box_offset_align(ifirst + 1, x_center + x_margin, pair_y, 1, y_dir));
return pair_box;
}
// only one box available for this "pair", so keep x-centered and handle y-offset
return box_offset_align(ifirst, 0, pair_y, 0, y_dir);
}
@ -165,9 +163,9 @@ void group_layout_manager::handle_update()
if (update_layout_)
{
member_offsets_.clear();
boost::apply_visitor(process_layout(member_boxes_, member_offsets_, input_origin_), layout_);
util::apply_visitor(process_layout(member_boxes_, member_offsets_, input_origin_), layout_);
update_layout_ = false;
}
}
}
}

View File

@ -26,7 +26,6 @@
// boost
#include <boost/spirit/include/karma.hpp>
#include <boost/variant.hpp>
// stl
#include <vector>
@ -35,7 +34,7 @@ namespace mapnik {
namespace filter {
bool generate_image_filters(std::back_insert_iterator<std::string>& sink, std::vector<filter_type> const& filters)
bool generate_image_filters(std::back_insert_iterator<std::string> & sink, std::vector<filter_type> const& filters)
{
boost::spirit::karma::stream_type stream;
using boost::spirit::karma::generate;

View File

@ -28,9 +28,6 @@
#include <mapnik/feature.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/variant.hpp>
// stl
#include <stdexcept>
@ -54,8 +51,9 @@ path_expression_ptr parse_path(std::string const& str)
}
}
namespace path_processor_detail {
struct path_visitor_ : boost::static_visitor<void>
namespace path_processor_detail
{
struct path_visitor_ : util::static_visitor<void>
{
path_visitor_ (std::string & filename, feature_impl const& f)
: filename_(filename),
@ -77,7 +75,7 @@ namespace path_processor_detail {
feature_impl const& feature_;
};
struct to_string_ : boost::static_visitor<void>
struct to_string_ : util::static_visitor<void>
{
to_string_ (std::string & str)
: str_(str) {}
@ -97,7 +95,7 @@ namespace path_processor_detail {
std::string & str_;
};
struct collect_ : boost::static_visitor<void>
struct collect_ : util::static_visitor<void>
{
collect_ (std::set<std::string> & cont)
: cont_(cont) {}
@ -120,7 +118,9 @@ std::string path_processor::evaluate(path_expression const& path,feature_impl co
std::string out;
path_processor_detail::path_visitor_ eval(out,f);
for ( mapnik::path_component const& token : path)
boost::apply_visitor(eval,token);
{
util::apply_visitor(std::ref(eval),token);
}
return out;
}
@ -129,7 +129,9 @@ std::string path_processor::to_string(path_expression const& path)
std::string str;
path_processor_detail::to_string_ visitor(str);
for ( mapnik::path_component const& token : path)
boost::apply_visitor(visitor,token);
{
util::apply_visitor(std::ref(visitor),token);
}
return str;
}
@ -137,7 +139,9 @@ void path_processor::collect_attributes(path_expression const& path, std::set<st
{
path_processor_detail::collect_ visitor(names);
for ( mapnik::path_component const& token : path)
boost::apply_visitor(visitor,token);
{
util::apply_visitor(std::ref(visitor),token);
}
}

View File

@ -129,7 +129,7 @@ void serialize_group_symbolizer_properties(ptree & sym_node,
bool explicit_defaults);
template <typename Meta>
class serialize_symbolizer_property : public boost::static_visitor<>
class serialize_symbolizer_property : public util::static_visitor<>
{
public:
serialize_symbolizer_property(Meta const& meta,
@ -219,7 +219,7 @@ private:
bool explicit_defaults_;
};
class serialize_symbolizer : public boost::static_visitor<>
class serialize_symbolizer : public util::static_visitor<>
{
public:
serialize_symbolizer( ptree & r , bool explicit_defaults)
@ -249,7 +249,7 @@ private:
bool explicit_defaults_;
};
class serialize_group_layout : public boost::static_visitor<>
class serialize_group_layout : public util::static_visitor<>
{
public:
serialize_group_layout(ptree & parent_node, bool explicit_defaults)
@ -317,14 +317,14 @@ void serialize_group_rule( ptree & parent_node, const group_rule & r, bool expli
rule::symbolizers::const_iterator begin = r.get_symbolizers().begin();
rule::symbolizers::const_iterator end = r.get_symbolizers().end();
serialize_symbolizer serializer( rule_node, explicit_defaults);
std::for_each( begin, end , boost::apply_visitor( serializer ));
std::for_each( begin, end , [&serializer](symbolizer const& sym) { util::apply_visitor( std::ref(serializer), sym);} );
}
void serialize_group_symbolizer_properties(ptree & sym_node,
group_symbolizer_properties_ptr const& properties,
bool explicit_defaults)
{
boost::apply_visitor(serialize_group_layout(sym_node, explicit_defaults), properties->get_layout());
util::apply_visitor(serialize_group_layout(sym_node, explicit_defaults), properties->get_layout());
for (auto const& rule : properties->get_rules())
{
@ -384,7 +384,7 @@ void serialize_rule( ptree & style_node, rule const& r, bool explicit_defaults)
rule::symbolizers::const_iterator begin = r.get_symbolizers().begin();
rule::symbolizers::const_iterator end = r.get_symbolizers().end();
serialize_symbolizer serializer( rule_node, explicit_defaults);
std::for_each( begin, end , boost::apply_visitor( serializer ));
std::for_each( begin, end , [&serializer](symbolizer const& sym) { util::apply_visitor( std::ref(serializer), sym);});
}
void serialize_style( ptree & map_node, std::string const& name, feature_type_style const& style, bool explicit_defaults )
@ -482,7 +482,7 @@ void serialize_datasource( ptree & layer_node, datasource_ptr datasource)
}
}
class serialize_type : public boost::static_visitor<>
class serialize_type : public util::static_visitor<>
{
public:
serialize_type( boost::property_tree::ptree & node):
@ -525,7 +525,7 @@ void serialize_parameters( ptree & map_node, mapnik::parameters const& params)
boost::property_tree::ptree()))->second;
param_node.put("<xmlattr>.name", p.first );
param_node.put_value( p.second );
boost::apply_visitor(serialize_type(param_node),p.second);
util::apply_visitor(serialize_type(param_node),p.second);
}
}
}

View File

@ -51,7 +51,7 @@ node_ptr text_node::from_xml(xml_node const& xml, fontset_map const& fontsets)
void text_node::apply(evaluated_format_properties_ptr p, feature_impl const& feature, attributes const& vars, text_layout &output) const
{
mapnik::value_unicode_string text_str = boost::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *text_).to_unicode();
mapnik::value_unicode_string text_str = util::apply_visitor(evaluate<feature_impl,value_type,attributes>(feature,vars), *text_).to_unicode();
if (p->text_transform == UPPERCASE)
{
text_str = text_str.toUpper();

View File

@ -30,7 +30,7 @@
namespace mapnik {
struct transform_node_to_expression_string
: public boost::static_visitor<void>
: public util::static_visitor<void>
{
std::ostringstream& os_;
@ -116,7 +116,7 @@ std::string to_expression_string(transform_node const& node)
{
std::ostringstream os; // FIXME set precision?
transform_node_to_expression_string to_string(os);
boost::apply_visitor(to_string, *node);
util::apply_visitor(to_string, *node);
return os.str();
}
@ -130,7 +130,7 @@ std::string to_expression_string(transform_list const& list)
for (transform_node const& node : list)
{
os.write(" ", first ? (first = 0) : 1);
boost::apply_visitor(to_string, *node);
util::apply_visitor(to_string, *node);
}
return os.str();
}

View File

@ -5,7 +5,6 @@
#include <mapnik/boolean.hpp>
#include <vector>
#include <algorithm>
#include <boost/variant.hpp>
int main(int argc, char** argv)
{

View File

@ -21,10 +21,9 @@
*****************************************************************************/
#include <mapnik/noncopyable.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <memory>
#include <boost/variant.hpp>
//sqlite3
#include <sqlite3.h>
@ -71,12 +70,12 @@ namespace mapnik { namespace sqlite {
unsigned size_;
};
using value_type = boost::variant<int,double,std::string, blob,null_type>;
using value_type = mapnik::util::variant<int,double,std::string, blob,null_type>;
using record_type = std::vector<value_type>;
class prepared_statement : mapnik::noncopyable
{
struct binder : public boost::static_visitor<bool>
struct binder : public mapnik::util::static_visitor<bool>
{
binder(sqlite3_stmt * stmt, unsigned index)
: stmt_(stmt), index_(index) {}
@ -168,7 +167,7 @@ namespace mapnik { namespace sqlite {
for (; itr!=end;++itr)
{
binder op(stmt_,count++);
if (!boost::apply_visitor(op,*itr))
if (!util::apply_visitor(op,*itr))
{
return false;
}