remove static_visitor usage and rely on automatic result type deduction

(NOTE: expression_evaluator requires  ```using result_type = T1;``` )

Conflicts:
	src/image.cpp
This commit is contained in:
artemp 2015-01-07 11:35:21 +01:00
parent affc5ee7c1
commit 18554ec0b1
44 changed files with 98 additions and 98 deletions

View file

@ -105,7 +105,7 @@ std::shared_ptr<mapnik::symbolizer_base::value_type> numeric_wrapper(const objec
return result;
}
struct extract_python_object : public mapnik::util::static_visitor<boost::python::object>
struct extract_python_object
{
using result_type = boost::python::object;
@ -153,7 +153,7 @@ std::size_t hash_impl_2(T const& sym)
return mapnik::symbolizer_hash::value<T>(sym);
}
struct extract_underlying_type_visitor : mapnik::util::static_visitor<boost::python::object>
struct extract_underlying_type_visitor
{
template <typename T>
boost::python::object operator() (T const& sym) const

View file

@ -31,7 +31,7 @@
namespace boost { namespace python {
struct value_converter : public mapnik::util::static_visitor<PyObject*>
struct value_converter
{
PyObject * operator() (mapnik::value_integer val) const
{

View file

@ -122,7 +122,7 @@ private:
};
struct symbolizer_info : public mapnik::util::static_visitor<QString>
struct symbolizer_info
{
QString operator() (mapnik::point_symbolizer const& sym) const
{
@ -185,7 +185,7 @@ struct symbolizer_info : public mapnik::util::static_visitor<QString>
}
};
struct symbolizer_icon : public mapnik::util::static_visitor<QIcon>
struct symbolizer_icon
{
QIcon operator() (mapnik::polygon_symbolizer const& sym) const
{

View file

@ -52,7 +52,7 @@
namespace mapnik {
template <typename Container>
struct expression_attributes : util::static_visitor<void>
struct expression_attributes
{
explicit expression_attributes(Container& names)
: names_(names) {}
@ -107,7 +107,7 @@ public:
};
template <typename Container>
struct extract_attribute_names : util::static_visitor<void>
struct extract_attribute_names
{
explicit extract_attribute_names(Container& names)
: names_(names),
@ -159,7 +159,7 @@ private:
expression_attributes<std::set<std::string> > f_attr_;
};
struct symbolizer_attributes : public util::static_visitor<>
struct symbolizer_attributes
{
symbolizer_attributes(std::set<std::string>& names,
double & filter_factor)

View file

@ -39,7 +39,7 @@ namespace mapnik {
namespace {
template <typename T, typename Attributes>
struct evaluate_expression : util::static_visitor<T>
struct evaluate_expression
{
using value_type = T;
@ -133,7 +133,7 @@ struct evaluate_expression : util::static_visitor<T>
};
template <typename T>
struct evaluate_expression<T, boost::none_t> : util::static_visitor<T>
struct evaluate_expression<T, boost::none_t>
{
using value_type = T;
@ -274,7 +274,7 @@ std::tuple<T,bool> pre_evaluate_expression (expression_ptr const& expr)
struct evaluate_global_attributes : mapnik::noncopyable
{
template <typename Attributes>
struct evaluator : util::static_visitor<>
struct evaluator
{
evaluator(symbolizer_base::cont_type::value_type & prop, Attributes const& attributes)
: prop_(prop),
@ -296,7 +296,7 @@ struct evaluate_global_attributes : mapnik::noncopyable
};
template <typename Attributes>
struct extract_symbolizer : util::static_visitor<>
struct extract_symbolizer
{
extract_symbolizer(Attributes const& attributes)
: attributes_(attributes) {}

View file

@ -35,12 +35,12 @@ namespace mapnik
{
template <typename T0, typename T1, typename T2>
struct evaluate : util::static_visitor<T1>
struct evaluate
{
using feature_type = T0;
using value_type = T1;
using variable_type = T2;
using result_type = T1; // we need this because automatic result_type deduction fails
explicit evaluate(feature_type const& f, variable_type const& v)
: feature_(f),
vars_(v) {}

View file

@ -40,7 +40,7 @@ using image_data_base = util::variant<image_data_null, image_data_rgba8, image_d
namespace detail {
struct get_bytes_visitor : util::static_visitor<unsigned char*>
struct get_bytes_visitor
{
template <typename T>
unsigned char* operator()(T & data)
@ -49,7 +49,7 @@ struct get_bytes_visitor : util::static_visitor<unsigned char*>
}
};
struct get_bytes_visitor_const : util::static_visitor<unsigned char const*>
struct get_bytes_visitor_const
{
template <typename T>
unsigned char const* operator()(T const& data) const
@ -58,7 +58,7 @@ struct get_bytes_visitor_const : util::static_visitor<unsigned char const*>
}
};
struct get_width_visitor : util::static_visitor<std::size_t>
struct get_width_visitor
{
template <typename T>
std::size_t operator()(T const& data) const
@ -67,7 +67,7 @@ struct get_width_visitor : util::static_visitor<std::size_t>
}
};
struct get_height_visitor : util::static_visitor<std::size_t>
struct get_height_visitor
{
template <typename T>
std::size_t operator()(T const& data) const

View file

@ -761,7 +761,7 @@ void apply_filter(Src & src, invert const& /*op*/)
}
template <typename Src>
struct filter_visitor : util::static_visitor<void>
struct filter_visitor
{
filter_visitor(Src & src)
: src_(src) {}
@ -775,7 +775,7 @@ struct filter_visitor : util::static_visitor<void>
Src & src_;
};
struct filter_radius_visitor : util::static_visitor<void>
struct filter_radius_visitor
{
int & radius_;
filter_radius_visitor(int & radius)

View file

@ -267,7 +267,7 @@ inline std::ostream& operator<< (std::ostream& os, colorize_alpha const& filter)
template <typename Out>
struct to_string_visitor : util::static_visitor<void>
struct to_string_visitor
{
to_string_visitor(Out & out)
: out_(out) {}

View file

@ -46,7 +46,7 @@ namespace standard_wide = boost::spirit::standard_wide;
using standard_wide::space_type;
class attribute_value_visitor
: public mapnik::util::static_visitor<mapnik::value>
{
public:
attribute_value_visitor(mapnik::transcoder const& tr)

View file

@ -31,7 +31,7 @@ namespace mapnik { namespace json {
// geometries
template <typename Path>
struct create_point : util::static_visitor<>
struct create_point
{
explicit create_point(Path & path)
: path_(path) {}
@ -49,7 +49,7 @@ struct create_point : util::static_visitor<>
};
template <typename Path>
struct create_linestring : util::static_visitor<>
struct create_linestring
{
explicit create_linestring(Path & path)
: path_(path) {}
@ -77,7 +77,7 @@ struct create_linestring : util::static_visitor<>
};
template <typename Path>
struct create_polygon : util::static_visitor<>
struct create_polygon
{
explicit create_polygon(Path & path)
: path_(path) {}
@ -111,7 +111,7 @@ struct create_polygon : util::static_visitor<>
// multi-geometries
template <typename Path>
struct create_multipoint : util::static_visitor<>
struct create_multipoint
{
explicit create_multipoint(Path & path)
: path_(path) {}
@ -133,7 +133,7 @@ struct create_multipoint : util::static_visitor<>
};
template <typename Path>
struct create_multilinestring : util::static_visitor<>
struct create_multilinestring
{
explicit create_multilinestring(Path & path)
: path_(path) {}
@ -163,7 +163,7 @@ struct create_multilinestring : util::static_visitor<>
};
template <typename Path>
struct create_multipolygon : util::static_visitor<>
struct create_multipolygon
{
explicit create_multipolygon(Path & path)
: path_(path) {}

View file

@ -45,7 +45,7 @@ namespace standard_wide = boost::spirit::standard_wide;
using standard_wide::space_type;
template <typename Symbolizer>
struct json_value_visitor : mapnik::util::static_visitor<>
struct json_value_visitor
{
json_value_visitor(Symbolizer & sym, mapnik::keys key)
: sym_(sym), key_(key) {}
@ -82,7 +82,7 @@ struct json_value_visitor : mapnik::util::static_visitor<>
};
template <typename T>
struct put_property_visitor : mapnik::util::static_visitor<>
struct put_property_visitor
{
using value_type = T;

View file

@ -30,7 +30,7 @@
namespace mapnik { namespace topojson {
struct bounding_box_visitor : public mapnik::util::static_visitor<box2d<double> >
struct bounding_box_visitor
{
bounding_box_visitor(topology const& topo)
: topo_(topo) {}

View file

@ -44,7 +44,7 @@ public:
markers_vertex_first_placement<Locator, Detector>,
markers_vertex_last_placement<Locator, Detector>>;
class get_point_visitor : public util::static_visitor<bool>
class get_point_visitor
{
public:
get_point_visitor(double &x, double &y, double &angle, bool ignore_placement)

View file

@ -121,7 +121,7 @@ boost::optional<T> param_cast(std::string const& source)
} // end namespace detail
template <typename T>
struct value_extractor_visitor : public util::static_visitor<>
struct value_extractor_visitor
{
value_extractor_visitor(boost::optional<T> & var)

View file

@ -154,7 +154,7 @@ using render_thunk_list = std::list<render_thunk_ptr>;
// The bounding boxes can be used for layout, and the thunks are
// used to re-render at locations according to the group layout.
struct render_thunk_extractor : public util::static_visitor<>
struct render_thunk_extractor
{
render_thunk_extractor(box2d<double> & box,
render_thunk_list & thunks,

View file

@ -44,7 +44,7 @@ namespace mapnik {
namespace detail {
template <typename F>
struct image_data_dispatcher : util::static_visitor<void>
struct image_data_dispatcher
{
using composite_function = F;
image_data_dispatcher(int start_x, int start_y,
@ -105,7 +105,7 @@ private:
};
template <typename F>
struct image_data_warp_dispatcher : util::static_visitor<void>
struct image_data_warp_dispatcher
{
using composite_function = F;
image_data_warp_dispatcher(proj_transform const& prj_trans,

View file

@ -339,7 +339,7 @@ struct evaluate_expression_wrapper<mapnik::font_feature_settings>
};
template <typename T>
struct extract_value : public util::static_visitor<T>
struct extract_value
{
using result_type = T;
@ -379,7 +379,7 @@ struct extract_value : public util::static_visitor<T>
};
template <typename T1>
struct extract_raw_value : public util::static_visitor<T1>
struct extract_raw_value
{
using result_type = T1;

View file

@ -67,7 +67,7 @@ struct process_impl<false>
* \param sym Symbolizer object
*/
template <typename Processor>
struct symbolizer_dispatch : public util::static_visitor<>
struct symbolizer_dispatch
{
symbolizer_dispatch(Processor & output,
mapnik::feature_impl & f,

View file

@ -33,7 +33,7 @@
namespace mapnik {
struct property_value_hash_visitor : util::static_visitor<std::size_t>
struct property_value_hash_visitor
{
std::size_t operator() (color const& val) const
{
@ -82,7 +82,7 @@ struct symbolizer_hash
}
};
struct symbolizer_hash_visitor : util::static_visitor<std::size_t>
struct symbolizer_hash_visitor
{
template <typename Symbolizer>
std::size_t operator() (Symbolizer const& sym) const

View file

@ -129,7 +129,7 @@ struct symbolizer_traits<dot_symbolizer>
// symbolizer name impl
namespace detail {
struct symbolizer_name_impl : public util::static_visitor<std::string>
struct symbolizer_name_impl
{
public:
template <typename Symbolizer>
@ -150,7 +150,7 @@ inline std::string symbolizer_name(symbolizer const& sym)
/*
template <typename Meta>
class symbolizer_property_value_string : public util::static_visitor<std::string>
class symbolizer_property_value_string
{
public:
symbolizer_property_value_string (Meta const& meta)
@ -237,7 +237,7 @@ private:
Meta const& meta_;
};
struct symbolizer_to_json : public util::static_visitor<std::string>
struct symbolizer_to_json
{
using result_type = std::string;

View file

@ -179,7 +179,7 @@ struct tiff_config
};
struct tag_setter : public mapnik::util::static_visitor<>
struct tag_setter
{
tag_setter(TIFF * output, tiff_config & config)
: output_(output),

View file

@ -192,7 +192,7 @@ inline void clear(transform_node& val)
namespace {
struct is_null_transform_node : public mapnik::util::static_visitor<bool>
struct is_null_transform_node
{
bool operator() (value const& val) const
{

View file

@ -46,7 +46,7 @@ struct transform_processor
using transform_type = agg::trans_affine;
template <typename Container>
struct attribute_collector : util::static_visitor<void>
struct attribute_collector
{
expression_attributes<Container> collect_;
@ -97,7 +97,7 @@ struct transform_processor
}
};
struct node_evaluator : util::static_visitor<void>
struct node_evaluator
{
node_evaluator(transform_type& tr,
feature_type const& feat,

View file

@ -72,7 +72,7 @@ using value_base = util::variant<value_null, value_bool, value_integer,value_dou
namespace impl {
struct equals
: public util::static_visitor<bool>
{
bool operator() (value_integer lhs, value_double rhs) const
{
@ -124,7 +124,7 @@ struct equals
};
struct not_equals
: public util::static_visitor<bool>
{
template <typename T, typename U>
bool operator() (const T &, const U &) const
@ -186,7 +186,7 @@ struct not_equals
};
struct greater_than
: public util::static_visitor<bool>
{
template <typename T, typename U>
bool operator()(const T &, const U &) const
@ -222,7 +222,7 @@ struct greater_than
};
struct greater_or_equal
: public util::static_visitor<bool>
{
template <typename T, typename U>
bool operator()(const T &, const U &) const
@ -258,7 +258,7 @@ struct greater_or_equal
};
struct less_than
: public util::static_visitor<bool>
{
template <typename T, typename U>
bool operator()(const T &, const U &) const
@ -295,7 +295,7 @@ struct less_than
};
struct less_or_equal
: public util::static_visitor<bool>
{
template <typename T, typename U>
bool operator()(const T &, const U &) const
@ -332,7 +332,7 @@ struct less_or_equal
};
template <typename V>
struct add : public util::static_visitor<V>
struct add
{
using value_type = V;
value_type operator() (value_unicode_string const& lhs ,
@ -398,7 +398,7 @@ struct add : public util::static_visitor<V>
};
template <typename V>
struct sub : public util::static_visitor<V>
struct sub
{
using value_type = V;
template <typename T1, typename T2>
@ -436,7 +436,7 @@ struct sub : public util::static_visitor<V>
};
template <typename V>
struct mult : public util::static_visitor<V>
struct mult
{
using value_type = V;
template <typename T1, typename T2>
@ -473,7 +473,7 @@ struct mult : public util::static_visitor<V>
};
template <typename V>
struct div: public util::static_visitor<V>
struct div
{
using value_type = V;
template <typename T1, typename T2>
@ -514,7 +514,7 @@ struct div: public util::static_visitor<V>
};
template <typename V>
struct mod: public util::static_visitor<V>
struct mod
{
using value_type = V;
template <typename T1, typename T2>
@ -558,7 +558,7 @@ struct mod: public util::static_visitor<V>
};
template <typename V>
struct negate : public util::static_visitor<V>
struct negate
{
using value_type = V;
@ -589,7 +589,7 @@ template <typename T>
struct convert {};
template <>
struct convert<value_bool> : public util::static_visitor<value_bool>
struct convert<value_bool>
{
value_bool operator() (value_bool val) const
{
@ -614,7 +614,7 @@ struct convert<value_bool> : public util::static_visitor<value_bool>
};
template <>
struct convert<value_double> : public util::static_visitor<value_double>
struct convert<value_double>
{
value_double operator() (value_double val) const
{
@ -653,7 +653,7 @@ struct convert<value_double> : public util::static_visitor<value_double>
};
template <>
struct convert<value_integer> : public util::static_visitor<value_integer>
struct convert<value_integer>
{
value_integer operator() (value_integer val) const
{
@ -692,7 +692,7 @@ struct convert<value_integer> : public util::static_visitor<value_integer>
};
template <>
struct convert<std::string> : public util::static_visitor<std::string>
struct convert<std::string>
{
template <typename T>
std::string operator() (T val) const
@ -723,7 +723,7 @@ struct convert<std::string> : public util::static_visitor<std::string>
}
};
struct to_unicode : public util::static_visitor<value_unicode_string>
struct to_unicode
{
template <typename T>
@ -753,7 +753,7 @@ struct to_unicode : public util::static_visitor<value_unicode_string>
}
};
struct to_expression_string : public util::static_visitor<std::string>
struct to_expression_string
{
explicit to_expression_string(char quote = '\'')
: quote_(quote) {}
@ -947,7 +947,7 @@ using value_adl_barrier::operator<<;
namespace detail {
struct is_null_visitor : public util::static_visitor<bool>
struct is_null_visitor
{
bool operator() (value const& val) const
{

View file

@ -42,7 +42,7 @@ inline void hash_combine(std::size_t & seed, T const& v)
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
struct value_hasher: public util::static_visitor<std::size_t>
struct value_hasher
{
std::size_t operator() (value_null val) const
{

View file

@ -38,7 +38,7 @@ using gdal_query = mapnik::util::variant<mapnik::query, mapnik::coord2d>;
class gdal_featureset : public mapnik::Featureset
{
struct query_dispatch : public mapnik::util::static_visitor<mapnik::feature_ptr>
struct query_dispatch
{
query_dispatch( gdal_featureset & featureset)
: featureset_(featureset) {}

View file

@ -53,7 +53,7 @@ using mapnik::parameters;
DATASOURCE_PLUGIN(geojson_datasource)
struct attr_value_converter : public mapnik::util::static_visitor<mapnik::eAttributeType>
struct attr_value_converter
{
mapnik::eAttributeType operator() (mapnik::value_integer) const
{

View file

@ -35,7 +35,7 @@ using rasterlite_query = mapnik::util::variant<mapnik::query,mapnik::coord2d>;
class rasterlite_featureset : public mapnik::Featureset
{
struct query_dispatch : public mapnik::util::static_visitor<mapnik::feature_ptr>
struct query_dispatch
{
query_dispatch( rasterlite_featureset & featureset)
: featureset_(featureset) {}

View file

@ -44,7 +44,7 @@ using mapnik::parameters;
DATASOURCE_PLUGIN(topojson_datasource)
struct attr_value_converter : public mapnik::util::static_visitor<mapnik::eAttributeType>
struct attr_value_converter
{
mapnik::eAttributeType operator() (mapnik::value_integer /*val*/) const
{
@ -82,7 +82,7 @@ struct attr_value_converter : public mapnik::util::static_visitor<mapnik::eAttri
}
};
struct geometry_type_visitor : public mapnik::util::static_visitor<int>
struct geometry_type_visitor
{
int operator() (mapnik::topojson::point const&) const
{
@ -114,7 +114,7 @@ struct geometry_type_visitor : public mapnik::util::static_visitor<int>
}
};
struct collect_attributes_visitor : public mapnik::util::static_visitor<void>
struct collect_attributes_visitor
{
mapnik::layer_descriptor & desc_;
collect_attributes_visitor(mapnik::layer_descriptor & desc):

View file

@ -51,7 +51,7 @@ BOOST_GEOMETRY_REGISTER_LINESTRING(std::vector<mapnik::topojson::coordinate>)
namespace mapnik { namespace topojson {
struct attribute_value_visitor
: mapnik::util::static_visitor<mapnik::value>
{
public:
attribute_value_visitor(mapnik::transcoder const& tr)
@ -84,7 +84,7 @@ void assign_properties(mapnik::feature_impl & feature, T const& geom, mapnik::tr
}
template <typename Context>
struct feature_generator : public mapnik::util::static_visitor<mapnik::feature_ptr>
struct feature_generator
{
feature_generator(Context & ctx, mapnik::transcoder const& tr, topology const& topo, std::size_t feature_id)
: ctx_(ctx),

View file

@ -43,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 util::static_visitor<>
struct thunk_renderer
{
using renderer_type = agg_renderer<image_32>;
using buffer_type = renderer_type::buffer_type;

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 util::static_visitor<>
struct thunk_renderer
{
using renderer_type = cairo_renderer<T>;

View file

@ -33,7 +33,7 @@
namespace mapnik
{
struct expression_string : util::static_visitor<void>
struct expression_string
{
explicit expression_string(std::string & str)
: str_(str) {}

View file

@ -53,7 +53,7 @@ namespace mapnik {
* in the detector from the placement_finder.
*/
template <typename T0>
struct thunk_renderer : public util::static_visitor<>
struct thunk_renderer
{
using renderer_type = grid_renderer<T0>;
using buffer_type = typename renderer_type::buffer_type;

View file

@ -31,7 +31,7 @@ namespace mapnik
{
// This visitor will process offsets for the given layout
struct process_layout : public util::static_visitor<>
struct process_layout
{
// The vector containing the existing, centered item bounding boxes
vector<bound_box> const& member_boxes_;

View file

@ -53,7 +53,7 @@ path_expression_ptr parse_path(std::string const& str)
namespace path_processor_detail
{
struct path_visitor_ : util::static_visitor<void>
struct path_visitor_
{
path_visitor_ (std::string & filename, feature_impl const& f)
: filename_(filename),
@ -75,7 +75,7 @@ namespace path_processor_detail
feature_impl const& feature_;
};
struct to_string_ : util::static_visitor<void>
struct to_string_
{
to_string_ (std::string & str)
: str_(str) {}
@ -95,7 +95,7 @@ namespace path_processor_detail
std::string & str_;
};
struct collect_ : util::static_visitor<void>
struct collect_
{
collect_ (std::set<std::string> & cont)
: cont_(cont) {}

View file

@ -135,7 +135,7 @@ void serialize_group_symbolizer_properties(ptree & sym_node,
bool explicit_defaults);
template <typename Meta>
class serialize_symbolizer_property : public util::static_visitor<>
class serialize_symbolizer_property
{
public:
serialize_symbolizer_property(Meta const& meta,
@ -225,7 +225,7 @@ private:
bool explicit_defaults_;
};
class serialize_symbolizer : public util::static_visitor<>
class serialize_symbolizer
{
public:
serialize_symbolizer( ptree & r , bool explicit_defaults)
@ -255,7 +255,7 @@ private:
bool explicit_defaults_;
};
class serialize_group_layout : public util::static_visitor<>
class serialize_group_layout
{
public:
serialize_group_layout(ptree & parent_node, bool explicit_defaults)

View file

@ -37,7 +37,7 @@
namespace mapnik {
struct symbol_type_dispatch : public util::static_visitor<bool>
struct symbol_type_dispatch
{
template <typename Symbolizer>
bool operator()(Symbolizer const&) const

View file

@ -169,7 +169,7 @@ text_placements_simple::text_placements_simple(symbolizer_base::value_type const
positions_(positions) { }
namespace detail {
struct serialize_positions : public util::static_visitor<std::string>
struct serialize_positions
{
serialize_positions() {}

View file

@ -28,7 +28,7 @@
namespace mapnik { namespace detail {
struct property_serializer : public util::static_visitor<>
struct property_serializer
{
property_serializer(std::string const& name, boost::property_tree::ptree & node)
: name_(name),

View file

@ -30,7 +30,7 @@
namespace mapnik {
struct transform_node_to_expression_string
: public util::static_visitor<void>
{
std::ostringstream& os_;

View file

@ -158,7 +158,7 @@ MAPNIK_DECL void warp_image (T & target, T const& source, proj_transform const&
namespace detail {
struct warp_image_visitor : util::static_visitor<void>
struct warp_image_visitor
{
warp_image_visitor (raster & target_raster, proj_transform const& prj_trans, box2d<double> const& source_ext,
double offset_x, double offset_y, unsigned mesh_size,

View file

@ -77,7 +77,7 @@ namespace mapnik { namespace sqlite {
class prepared_statement : mapnik::noncopyable
{
struct binder : public mapnik::util::static_visitor<bool>
struct binder
{
binder(sqlite3_stmt * stmt, unsigned index)
: stmt_(stmt), index_(index) {}