+ replace BOOST_FOREACH with for( : )
+ remove boost/foreach.hpp
+ fix benchmarks (17,18)
This commit is contained in:
artemp 2013-04-24 16:40:35 +01:00
parent 49fe99ac4f
commit 58927b404c
39 changed files with 157 additions and 273 deletions

View file

@ -410,69 +410,6 @@ struct test8
#include <mapnik/rule_cache.hpp>
class rule_cache_move
{
private:
rule_cache_move(rule_cache_move const& other) = delete; // no copy ctor
rule_cache_move& operator=(rule_cache_move const& other) = delete; // no assignment op
public:
typedef std::vector<rule const*> rule_ptrs;
rule_cache_move()
: if_rules_(),
else_rules_(),
also_rules_() {}
rule_cache_move(rule_cache_move && rhs) // move ctor
: if_rules_(std::move(rhs.if_rules_)),
else_rules_(std::move(rhs.else_rules_)),
also_rules_(std::move(rhs.also_rules_))
{}
rule_cache_move& operator=(rule_cache_move && rhs) // move assign
{
std::swap(if_rules_, rhs.if_rules_);
std::swap(else_rules_,rhs.else_rules_);
std::swap(also_rules_, rhs.also_rules_);
return *this;
}
void add_rule(rule const& r)
{
if (r.has_else_filter())
{
else_rules_.push_back(&r);
}
else if (r.has_also_filter())
{
also_rules_.push_back(&r);
}
else
{
if_rules_.push_back(&r);
}
}
rule_ptrs const& get_if_rules() const
{
return if_rules_;
}
rule_ptrs const& get_else_rules() const
{
return else_rules_;
}
rule_ptrs const& get_also_rules() const
{
return also_rules_;
}
private:
rule_ptrs if_rules_;
rule_ptrs else_rules_;
rule_ptrs also_rules_;
};
struct test9
{
unsigned iter_;
@ -504,10 +441,10 @@ struct test9
void operator()()
{
for (unsigned i=0;i<iter_;++i) {
std::vector<rule_cache_move> rule_caches;
std::vector<rule_cache> rule_caches;
for (unsigned i=0;i<num_styles_;++i)
{
rule_cache_move rc;
rule_cache rc;
for (unsigned i=0;i<num_rules_;++i)
{
rc.add_rule(rules_[i]);
@ -518,52 +455,6 @@ struct test9
}
};
class rule_cache_heap
{
public:
typedef std::vector<rule const*> rule_ptrs;
rule_cache_heap()
: if_rules_(),
else_rules_(),
also_rules_() {}
void add_rule(rule const& r)
{
if (r.has_else_filter())
{
else_rules_.push_back(&r);
}
else if (r.has_also_filter())
{
also_rules_.push_back(&r);
}
else
{
if_rules_.push_back(&r);
}
}
rule_ptrs const& get_if_rules() const
{
return if_rules_;
}
rule_ptrs const& get_else_rules() const
{
return else_rules_;
}
rule_ptrs const& get_also_rules() const
{
return also_rules_;
}
private:
rule_ptrs if_rules_;
rule_ptrs else_rules_;
rule_ptrs also_rules_;
};
struct test10
{
unsigned iter_;
@ -593,9 +484,9 @@ struct test10
void operator()()
{
for (unsigned i=0;i<iter_;++i) {
std::vector<std::unique_ptr<rule_cache_heap> > rule_caches;
std::vector<std::unique_ptr<rule_cache> > rule_caches;
for (unsigned i=0;i<num_styles_;++i) {
std::unique_ptr<rule_cache_heap> rc(new rule_cache_heap);
std::unique_ptr<rule_cache> rc(new rule_cache);
for (unsigned i=0;i<num_rules_;++i) {
rc->add_rule(rules_[i]);
}
@ -646,8 +537,9 @@ struct test11
ps.line_to(extent_.maxx(), extent_.maxy());
ps.line_to(extent_.maxx(), extent_.miny());
ps.close_polygon();
for (unsigned i=0;i<iter_;++i) {
BOOST_FOREACH( geometry_type & geom, paths)
for (unsigned i=0;i<iter_;++i)
{
for (geometry_type & geom : paths)
{
poly_clipper clipped(geom,ps,
agg::clipper_and,
@ -697,7 +589,7 @@ struct test12
}
for (unsigned i=0;i<iter_;++i)
{
BOOST_FOREACH( geometry_type & geom, paths)
for ( geometry_type & geom : paths)
{
poly_clipper clipped(extent_, geom);
unsigned cmd;
@ -732,7 +624,7 @@ struct test13
unsigned long count = 0;
for (unsigned i=0;i<iter_;++i)
{
BOOST_FOREACH( std::string const& name, mapnik::freetype_engine::face_names())
for ( std::string const& name : mapnik::freetype_engine::face_names())
{
mapnik::face_ptr f = engine.create_face(name);
if (f) ++count;

View file

@ -104,7 +104,7 @@ mapnik::box2d<double> envelope_impl(path_type & p)
{
mapnik::box2d<double> b;
bool first = true;
BOOST_FOREACH(mapnik::geometry_type const& geom, p)
for (mapnik::geometry_type const& geom : p)
{
if (first)
{

View file

@ -22,7 +22,7 @@
// boost
#include <boost/python.hpp>
#include <boost/foreach.hpp>
// mapnik
#include <mapnik/query.hpp>
@ -55,7 +55,7 @@ struct names_to_list
static PyObject* convert(std::set<std::string> const& names)
{
boost::python::list l;
BOOST_FOREACH( std::string const& name, names )
for ( std::string const& name : names )
{
l.append(name);
}
@ -86,6 +86,3 @@ void export_query()
return_value_policy<copy_const_reference>()) )
.def("add_property_name", &query::add_property_name);
}

View file

@ -23,7 +23,7 @@
// boost
#include <boost/python.hpp>
#include <boost/scoped_array.hpp>
#include <boost/foreach.hpp>
// mapnik
#include <mapnik/map.hpp>
@ -240,7 +240,7 @@ void write_features(T const& grid_type,
std::set<std::string> const& attributes = grid_type.property_names();
typename T::feature_type::const_iterator feat_end = g_features.end();
BOOST_FOREACH ( std::string const& key_item, key_order )
for ( std::string const& key_item :key_order )
{
if (key_item.empty())
{
@ -256,7 +256,7 @@ void write_features(T const& grid_type,
bool found = false;
boost::python::dict feat;
mapnik::feature_ptr feature = feat_itr->second;
BOOST_FOREACH ( std::string const& attr, attributes )
for ( std::string const& attr : attributes )
{
if (attr == "__id__")
{
@ -300,7 +300,7 @@ void grid_encode_utf(T const& grid_type,
// convert key order to proper python list
boost::python::list keys_a;
BOOST_FOREACH ( typename T::lookup_type const& key_id, key_order )
for ( typename T::lookup_type const& key_id : key_order )
{
keys_a.append(key_id);
}

View file

@ -211,7 +211,7 @@ public:
units_ = grad.get_units();
BOOST_FOREACH ( mapnik::stop_pair const& st, grad.get_stop_array() )
for ( mapnik::stop_pair const& st : grad.get_stop_array() )
{
mapnik::color const& stop_color = st.second;
double r= static_cast<double> (stop_color.red())/255.0;

View file

@ -49,7 +49,6 @@
// boost
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/foreach.hpp>
#include <boost/concept_check.hpp>
// stl
@ -167,7 +166,7 @@ void feature_style_processor<Processor>::apply(double scale_denom)
scale_denom = mapnik::scale_denominator(m_.scale(),proj.is_geographic());
scale_denom *= scale_factor_;
BOOST_FOREACH ( layer const& lyr, m_.layers() )
for ( layer const& lyr : m_.layers() )
{
if (lyr.visible(scale_denom))
{
@ -341,7 +340,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
{
// check for styles needing compositing operations applied
// https://github.com/mapnik/mapnik/issues/1477
BOOST_FOREACH(std::string const& style_name, style_names)
for (std::string const& style_name : style_names)
{
boost::optional<feature_type_style const&> style=m_.find_style(style_name);
if (!style)
@ -403,7 +402,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
std::vector<rule_cache> rule_caches;
// iterate through all named styles collecting active styles and attribute names
BOOST_FOREACH(std::string const& style_name, style_names)
for (std::string const& style_name : style_names)
{
boost::optional<feature_type_style const&> style=m_.find_style(style_name);
if (!style)
@ -444,29 +443,29 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
if (p.attribute_collection_policy() == COLLECT_ALL)
{
layer_descriptor lay_desc = ds->get_descriptor();
BOOST_FOREACH(attribute_descriptor const& desc, lay_desc.get_descriptors())
for (attribute_descriptor const& desc : lay_desc.get_descriptors())
{
q.add_property_name(desc.get_name());
}
}
else
{
BOOST_FOREACH(std::string const& name, names)
for (std::string const& name : names)
{
q.add_property_name(name);
}
}
// Update filter_factor for all enabled raster layers.
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
BOOST_FOREACH(rule const& r, style->get_rules())
for (rule const& r : style->get_rules())
{
if (r.active(scale_denom) &&
ds->type() == datasource::Raster &&
ds->params().get<double>("filter_factor",0.0) == 0.0)
{
BOOST_FOREACH (rule::symbolizers::value_type sym, r.get_symbolizers())
for (rule::symbolizers::value_type sym : r.get_symbolizers())
{
// if multiple raster symbolizers, last will be respected
// should we warn or throw?
@ -503,7 +502,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
// We're at a value boundary, so render what we have
// up to this point.
int i = 0;
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
render_style(lay, p, style, rule_caches[i], style_names[i],
cache.features(q), prj_trans);
@ -516,7 +515,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
}
int i = 0;
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
render_style(lay, p, style, rule_caches[i], style_names[i],
cache.features(q), prj_trans);
@ -537,18 +536,18 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
}
}
int i = 0;
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
render_style(lay, p, style, rule_caches[i], style_names[i],
cache.features(q), prj_trans);
i++;
++i;
}
}
// We only have a single style and no grouping.
else
{
int i = 0;
BOOST_FOREACH (feature_type_style const* style, active_styles)
for (feature_type_style const* style : active_styles)
{
render_style(lay, p, style, rule_caches[i], style_names[i],
ds->features(q), prj_trans);
@ -603,7 +602,7 @@ void feature_style_processor<Processor>::render_style(
bool do_else = true;
bool do_also = false;
BOOST_FOREACH(rule const* r, rc.get_if_rules() )
for (rule const* r : rc.get_if_rules() )
{
expression_ptr const& expr=r->get_filter();
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(*feature),*expr);
@ -624,7 +623,7 @@ void feature_style_processor<Processor>::render_style(
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
for (symbolizer const& sym : symbols)
{
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}
@ -639,7 +638,7 @@ void feature_style_processor<Processor>::render_style(
}
if (do_else)
{
BOOST_FOREACH( rule const* r, rc.get_else_rules() )
for (rule const* r : rc.get_else_rules() )
{
#if defined(RENDERING_STATS)
feat_processed = true;
@ -652,7 +651,7 @@ void feature_style_processor<Processor>::render_style(
// process one by one.
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
for (symbolizer const& sym : symbols)
{
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}
@ -661,7 +660,7 @@ void feature_style_processor<Processor>::render_style(
}
if (do_also)
{
BOOST_FOREACH( rule const* r, rc.get_also_rules() )
for ( rule const* r : rc.get_also_rules() )
{
#if defined(RENDERING_STATS)
feat_processed = true;
@ -674,7 +673,7 @@ void feature_style_processor<Processor>::render_style(
// process one by one.
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
for (symbolizer const& sym : symbols)
{
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}

View file

@ -42,7 +42,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp>
#ifdef MAPNIK_THREADSAFE
#include <boost/thread/mutex.hpp>
#endif
@ -194,7 +194,7 @@ public:
{
std::vector<std::string> const& names = fset.get_face_names();
face_set_ptr face_set = boost::make_shared<font_face_set>();
BOOST_FOREACH( std::string const& name, names)
for ( std::string const& name : names)
{
face_ptr face = get_face(name);
if (face)

View file

@ -27,7 +27,7 @@
#include <mapnik/feature.hpp>
#include <mapnik/geom_util.hpp>
// boost
#include <boost/foreach.hpp>
namespace mapnik {
class hit_test_filter
@ -40,7 +40,7 @@ public:
bool pass(Feature & feature)
{
BOOST_FOREACH(geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
if (label::hit_test(geom, x_,y_,tol_))
return true;

View file

@ -32,7 +32,7 @@
#include <boost/variant/static_visitor.hpp>
#include <boost/gil/gil_all.hpp>
#include <boost/concept_check.hpp>
#include <boost/foreach.hpp>
// agg
#include "agg_basics.h"
@ -417,7 +417,7 @@ void apply_filter(Src & src, colorize_alpha const& op)
double step = 1.0/(size-1);
double offset = 0.0;
BOOST_FOREACH( mapnik::filter::color_stop const& stop, op)
for ( mapnik::filter::color_stop const& stop : op)
{
mapnik::color const& c = stop.color;
double stop_offset = stop.offset;

View file

@ -490,7 +490,7 @@ void apply_markers_multi(feature_impl & feature, Converter& converter, markers_s
// TODO: consider using true area for polygon types
double maxarea = 0;
geometry_type* largest = 0;
BOOST_FOREACH(geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
const box2d<double>& env = geom.envelope();
double area = env.width() * env.height();
@ -511,7 +511,7 @@ void apply_markers_multi(feature_impl & feature, Converter& converter, markers_s
{
MAPNIK_LOG_WARN(marker_symbolizer) << "marker_multi_policy != 'each' has no effect with marker_placement != 'point'";
}
BOOST_FOREACH(geometry_type & path, feature.paths())
for (geometry_type & path : feature.paths())
{
converter.apply(path);
}

View file

@ -31,7 +31,7 @@
#include <mapnik/geometry.hpp>
// boost
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
@ -189,10 +189,10 @@ private:
std::cerr << ex.what() << std::endl;
}
BOOST_FOREACH(polygon_2d const& poly, clipped_polygons)
for (polygon_2d const& poly : clipped_polygons)
{
bool move_to = true;
BOOST_FOREACH(point_2d const& c, boost::geometry::exterior_ring(poly))
for (point_2d const& c : boost::geometry::exterior_ring(poly))
{
if (move_to)
{
@ -206,10 +206,10 @@ private:
}
output_.close_path();
// interior rings
BOOST_FOREACH(polygon_2d::inner_container_type::value_type const& ring, boost::geometry::interior_rings(poly))
for (polygon_2d::inner_container_type::value_type const& ring : boost::geometry::interior_rings(poly))
{
move_to = true;
BOOST_FOREACH(point_2d const& c, ring)
for (point_2d const& c : ring)
{
if (move_to)
{

View file

@ -31,7 +31,7 @@
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/foreach.hpp>
// agg
#include "agg_path_storage.h"
@ -138,7 +138,7 @@ public:
grad.get_control_points(x1,y1,x2,y2,radius);
m_gradient_lut.remove_all();
BOOST_FOREACH ( mapnik::stop_pair const& st, grad.get_stop_array() )
for ( mapnik::stop_pair const& st : grad.get_stop_array() )
{
mapnik::color const& stop_color = st.second;
unsigned r = stop_color.red();

View file

@ -33,10 +33,10 @@
#include <mapnik/expression_evaluator.hpp>
// boost
#include <boost/foreach.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/range/adaptor/reversed.hpp>
// agg
#include <agg_trans_affine.h>
@ -190,7 +190,7 @@ struct transform_processor
{
attribute_collector<Container> collect(names);
BOOST_FOREACH (transform_node const& node, list)
for (transform_node const& node : list)
{
boost::apply_visitor(collect, *node);
}
@ -205,7 +205,7 @@ struct transform_processor
MAPNIK_LOG_DEBUG(transform) << "transform: begin with " << to_string(matrix_node(tr));
#endif
BOOST_REVERSE_FOREACH (transform_node const& node, list)
for (transform_node const& node : boost::adaptors::reverse(list))
{
boost::apply_visitor(eval, *node);
#ifdef MAPNIK_LOG

View file

@ -43,7 +43,7 @@
#include <boost/fusion/include/at_c.hpp>
#include <boost/fusion/include/make_vector.hpp>
#include <boost/foreach.hpp>
#include <boost/array.hpp>
// mapnik

View file

@ -31,7 +31,7 @@
#include <boost/make_shared.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/spirit/include/support_multi_pass.hpp>
#include <boost/foreach.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry.hpp>
@ -123,7 +123,7 @@ geojson_datasource::geojson_datasource(parameters const& params)
bool first = true;
std::size_t count=0;
BOOST_FOREACH (mapnik::feature_ptr f, features_)
for (mapnik::feature_ptr f : features_)
{
mapnik::box2d<double> const& box = f->envelope();
if (first)

View file

@ -7,7 +7,7 @@
#include <vector>
// boost
#include <boost/foreach.hpp>
#include <boost/make_shared.hpp>
#include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp>
@ -26,7 +26,7 @@ python_datasource::python_datasource(parameters const& params)
factory_(*params.get<std::string>("factory", ""))
{
// extract any remaining parameters as keyword args for the factory
BOOST_FOREACH(const mapnik::parameters::value_type& kv, params)
for (const mapnik::parameters::value_type& kv : params)
{
if((kv.first != "type") && (kv.first != "factory"))
{
@ -73,7 +73,7 @@ python_datasource::python_datasource(parameters const& params)
// prepare the arguments
boost::python::dict kwargs;
typedef std::map<std::string, std::string>::value_type kv_type;
BOOST_FOREACH(const kv_type& kv, kwargs_)
for (kv_type const& kv : kwargs_)
{
kwargs[boost::python::str(kv.first)] = boost::python::str(kv.second);
}

View file

@ -265,7 +265,7 @@ void agg_renderer<T>::end_style_processing(feature_type_style const& st)
{
blend_from = true;
mapnik::filter::filter_visitor<image_32> visitor(*current_buffer_);
BOOST_FOREACH(mapnik::filter::filter_type const& filter_tag, st.image_filters())
for (mapnik::filter::filter_type const& filter_tag : st.image_filters())
{
boost::apply_visitor(visitor, filter_tag);
}
@ -282,7 +282,7 @@ void agg_renderer<T>::end_style_processing(feature_type_style const& st)
}
// apply any 'direct' image filters
mapnik::filter::filter_visitor<image_32> visitor(pixmap_);
BOOST_FOREACH(mapnik::filter::filter_type const& filter_tag, st.direct_image_filters())
for (mapnik::filter::filter_type const& filter_tag : st.direct_image_filters())
{
boost::apply_visitor(visitor, filter_tag);
}

View file

@ -49,7 +49,7 @@
#include "agg_conv_clip_polyline.h"
// boost
#include <boost/foreach.hpp>
namespace {
@ -150,7 +150,7 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH(geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
if (geom.size() > 1)
{

View file

@ -44,7 +44,7 @@
#include "agg_rasterizer_outline_aa.h"
// boost
#include <boost/foreach.hpp>
// stl
#include <string>
@ -129,7 +129,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
if (geom.size() > 1)
{
@ -152,7 +152,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
if (stroke_.has_dash()) converter.set<dash_tag>();
converter.set<stroke_tag>(); //always stroke
BOOST_FOREACH( geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
if (geom.size() > 1)
{

View file

@ -21,7 +21,7 @@
*****************************************************************************/
// boost
#include <boost/foreach.hpp>
// mapnik
#include <mapnik/feature.hpp>
@ -157,7 +157,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature.paths())
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{

View file

@ -21,7 +21,7 @@
*****************************************************************************/
// boost
#include <boost/foreach.hpp>
// mapnik
#include <mapnik/feature.hpp>
@ -68,7 +68,7 @@ void agg_renderer<T>::process(polygon_symbolizer const& sym,
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{

View file

@ -332,7 +332,7 @@ void cairo_renderer_base::process(polygon_symbolizer const& sym,
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature.paths())
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{
@ -495,7 +495,7 @@ void cairo_renderer_base::process(line_symbolizer const& sym,
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature.paths())
for (geometry_type & geom : feature.paths())
{
if (geom.size() > 1)
{
@ -869,7 +869,7 @@ void cairo_renderer_base::process(polygon_pattern_symbolizer const& sym,
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature.paths())
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{

View file

@ -44,7 +44,7 @@
// boost
#include <boost/optional.hpp>
#include <boost/foreach.hpp>
namespace mapnik { namespace util {
@ -98,12 +98,12 @@ namespace mapnik { namespace util {
// fontsets
typedef std::map<std::string,font_set> fontsets;
BOOST_FOREACH ( fontsets::value_type const& kv,map_in.fontsets())
for (fontsets::value_type const& kv : map_in.fontsets())
{
map_out.insert_fontset(kv.first,kv.second);
}
BOOST_FOREACH ( layer const& lyr_in, map_in.layers())
for ( layer const& lyr_in : map_in.layers())
{
layer lyr_out(lyr_in);
datasource_ptr ds_in = lyr_in.datasource();
@ -124,7 +124,7 @@ namespace mapnik { namespace util {
typedef style_cont::value_type value_type;
style_cont const& styles = map_in.styles();
BOOST_FOREACH ( value_type const& kv, styles )
for ( value_type const& kv : styles )
{
feature_type_style const& style_in = kv.second;
feature_type_style style_out(style_in,true); // deep copy

View file

@ -24,7 +24,7 @@
#include <mapnik/rule.hpp>
// boost
#include <boost/foreach.hpp>
namespace mapnik
{
@ -91,7 +91,7 @@ rules& feature_type_style::get_rules_nonconst()
bool feature_type_style::active(double scale_denom) const
{
BOOST_FOREACH(rule const& r, rules_)
for (rule const& r : rules_)
{
if (r.active(scale_denom))
{

View file

@ -280,7 +280,7 @@ font_face_set::size_type font_face_set::size() const
glyph_ptr font_face_set::get_glyph(unsigned c) const
{
BOOST_FOREACH ( face_ptr const& face, faces_)
for ( face_ptr const& face : faces_)
{
FT_UInt g = face->get_char(c);
if (g) return boost::make_shared<font_glyph>(face, g);
@ -387,7 +387,7 @@ void font_face_set::get_string_info(string_info & info, UnicodeString const& ust
void font_face_set::set_pixel_sizes(unsigned size)
{
BOOST_FOREACH ( face_ptr const& face, faces_)
for ( face_ptr const& face : faces_)
{
face->set_pixel_sizes(size);
}
@ -395,7 +395,7 @@ void font_face_set::set_pixel_sizes(unsigned size)
void font_face_set::set_character_sizes(double size)
{
BOOST_FOREACH ( face_ptr const& face, faces_)
for ( face_ptr const& face : faces_)
{
face->set_character_sizes(size);
}

View file

@ -25,7 +25,7 @@
#include <mapnik/feature.hpp>
// boost
#include <boost/foreach.hpp>
#include <boost/property_tree/ptree.hpp>
namespace mapnik {
@ -36,7 +36,7 @@ namespace formatting {
void list_node::to_xml(boost::property_tree::ptree & xml) const
{
BOOST_FOREACH(node_ptr const& node, children_)
for (node_ptr const& node : children_)
{
node->to_xml(xml);
}
@ -44,17 +44,17 @@ void list_node::to_xml(boost::property_tree::ptree & xml) const
void list_node::apply(char_properties const& p, feature_impl const& feature, processed_text &output) const
{
BOOST_FOREACH(node_ptr const& node, children_)
{
for (node_ptr const& node : children_)
{
node->apply(p, feature, output);
}
}
}
void list_node::add_expressions(expression_set &output) const
{
BOOST_FOREACH(node_ptr const& node, children_)
for (node_ptr const& node : children_)
{
node->add_expressions(output);
}
@ -81,4 +81,3 @@ std::vector<node_ptr> const& list_node::get_children() const
}
} // ns mapnik
} // ns formatting

View file

@ -38,7 +38,7 @@
#include "agg_conv_dash.h"
// boost
#include <boost/foreach.hpp>
// stl
#include <string>
@ -96,7 +96,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
if (stroke_.has_dash()) converter.set<dash_tag>();
converter.set<stroke_tag>(); //always stroke
BOOST_FOREACH( geometry_type & geom, feature.paths())
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 1)
{
@ -119,4 +119,3 @@ template void grid_renderer<grid>::process(line_symbolizer const&,
proj_transform const&);
}

View file

@ -21,7 +21,7 @@
*****************************************************************************/
// boost
#include <boost/foreach.hpp>
// mapnik
#include <mapnik/feature.hpp>
@ -64,7 +64,7 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature.paths())
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{
@ -96,4 +96,3 @@ template void grid_renderer<grid>::process(polygon_pattern_symbolizer const&,
proj_transform const&);
}

View file

@ -21,7 +21,7 @@
*****************************************************************************/
// boost
#include <boost/foreach.hpp>
// mapnik
#include <mapnik/feature.hpp>
@ -69,7 +69,7 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature.paths())
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{
@ -98,4 +98,3 @@ template void grid_renderer<grid>::process(polygon_symbolizer const&,
proj_transform const&);
}

View file

@ -68,7 +68,7 @@ extern "C"
#endif
// boost
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
// stl
@ -149,7 +149,7 @@ void handle_png_options(std::string const& type,
if (type.length() > 6){
boost::char_separator<char> sep(":");
boost::tokenizer< boost::char_separator<char> > tokens(type, sep);
BOOST_FOREACH(std::string t, tokens)
for (std::string const& t : tokens)
{
if (t == "png" || t == "png24" || t == "png32")
{

View file

@ -30,7 +30,7 @@
// boost
#include <boost/variant.hpp>
#include <boost/foreach.hpp>
#include <boost/make_shared.hpp>
namespace mapnik {
@ -44,8 +44,8 @@ path_expression_ptr parse_path(std::string const& str)
path_expression_ptr parse_path(std::string const& str,
path_expression_grammar<std::string::const_iterator> const& g)
{
path_expression path;
path_expression path;
std::string::const_iterator itr = str.begin();
std::string::const_iterator end = str.end();
bool r = qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, path);
@ -125,7 +125,7 @@ std::string path_processor::evaluate(path_expression const& path,feature_impl co
{
std::string out;
path_processor_detail::path_visitor_ eval(out,f);
BOOST_FOREACH( mapnik::path_component const& token, path)
for ( mapnik::path_component const& token : path)
boost::apply_visitor(eval,token);
return out;
}
@ -134,7 +134,7 @@ std::string path_processor::to_string(path_expression const& path)
{
std::string str;
path_processor_detail::to_string_ visitor(str);
BOOST_FOREACH( mapnik::path_component const& token, path)
for ( mapnik::path_component const& token : path)
boost::apply_visitor(visitor,token);
return str;
}
@ -142,7 +142,7 @@ std::string path_processor::to_string(path_expression const& path)
void path_processor::collect_attributes(path_expression const& path, std::set<std::string>& names)
{
path_processor_detail::collect_ visitor(names);
BOOST_FOREACH( mapnik::path_component const& token, path)
for ( mapnik::path_component const& token : path)
boost::apply_visitor(visitor,token);
}

View file

@ -36,7 +36,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
//stl
#include <string>
@ -501,7 +501,7 @@ void placement_finder<DetectorT>::find_point_placement(double label_x,
// check the placement of any additional envelopes
if (!p.allow_overlap && !additional_boxes_.empty())
{
BOOST_FOREACH(box2d<double> const& box, additional_boxes_)
for (box2d<double> const& box : additional_boxes_)
{
box2d<double> pt(box.minx() + current_placement->center.x,
box.miny() + current_placement->center.y,

View file

@ -36,7 +36,7 @@ bool svg_renderer<OutputIterator>::process(rule::symbolizers const& syms,
// process each symbolizer to collect its (path) information.
// path information (attributes from line_ and polygon_ symbolizers)
// is collected with the path_attributes_ data member.
BOOST_FOREACH(symbolizer const& sym, syms)
for (symbolizer const& sym : syms)
{
boost::apply_visitor(symbol_dispatch(*this, feature, prj_trans), sym);
}

View file

@ -34,7 +34,7 @@
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/fusion/include/std_pair.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <string>
@ -213,7 +213,7 @@ void start_element(svg_parser & parser, xmlTextReaderPtr reader)
if (xmlStrEqual(name, BAD_CAST "path"))
{
parse_path(parser,reader);
}
}
else if (xmlStrEqual(name, BAD_CAST "polygon") )
{
parse_polygon(parser,reader);
@ -227,7 +227,7 @@ void start_element(svg_parser & parser, xmlTextReaderPtr reader)
parse_line(parser,reader);
}
else if (xmlStrEqual(name, BAD_CAST "rect"))
{
{
parse_rect(parser,reader);
}
else if (xmlStrEqual(name, BAD_CAST "circle"))
@ -416,7 +416,7 @@ void parse_attr(svg_parser & parser, const xmlChar * name, const xmlChar * value
void parse_attr(svg_parser & parser, xmlTextReaderPtr reader)
{
const xmlChar *name, *value;
if (xmlTextReaderMoveToFirstAttribute(reader) == 1)
{
do
@ -430,7 +430,7 @@ void parse_attr(svg_parser & parser, xmlTextReaderPtr reader)
typedef cont_type::value_type value_type;
cont_type vec;
parse_style((const char*)value, vec);
BOOST_FOREACH(value_type kv , vec )
for (value_type kv : vec )
{
parse_attr(parser,BAD_CAST kv.first.c_str(),BAD_CAST kv.second.c_str());
}
@ -550,33 +550,33 @@ void parse_line(svg_parser & parser, xmlTextReaderPtr reader)
double y2 = 0.0;
value = xmlTextReaderGetAttribute(reader, BAD_CAST "x1");
if (value)
if (value)
{
x1 = parse_double((const char*)value);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "y1");
if (value)
if (value)
{
y1 = parse_double((const char*)value);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "x2");
if (value)
if (value)
{
x2 = parse_double((const char*)value);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "y2");
if (value)
if (value)
{
y2 = parse_double((const char*)value);
xmlFree(value);
}
parser.path_.begin_path();
parser.path_.move_to(x1, y1);
parser.path_.line_to(x2, y2);
@ -591,26 +591,26 @@ void parse_circle(svg_parser & parser, xmlTextReaderPtr reader)
double cy = 0.0;
double r = 0.0;
value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx");
if (value)
if (value)
{
cx = parse_double((const char*)value);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy");
if (value)
if (value)
{
cy = parse_double((const char*)value);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "r");
if (value)
if (value)
{
r = parse_double((const char*)value);
xmlFree(value);
}
parser.path_.begin_path();
if(r != 0.0)
@ -632,33 +632,33 @@ void parse_ellipse(svg_parser & parser, xmlTextReaderPtr reader)
double ry = 0.0;
value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx");
if (value)
if (value)
{
cx = parse_double((const char*)value);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy");
if (value)
if (value)
{
cy = parse_double((const char*)value);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "rx");
if (value)
if (value)
{
rx = parse_double((const char*)value);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "ry");
if (value)
if (value)
{
ry = parse_double((const char*)value);
xmlFree(value);
}
parser.path_.begin_path();
if(rx != 0.0 && ry != 0.0)
@ -742,7 +742,7 @@ void parse_rect(svg_parser & parser, xmlTextReaderPtr reader)
if(rx < 0.0) throw std::runtime_error("parse_rect: Invalid rx");
if(ry < 0.0) throw std::runtime_error("parse_rect: Invalid ry");
parser.path_.begin_path();
if(rounded)
{
agg::rounded_rect r;
@ -778,7 +778,7 @@ void parse_gradient_stop(svg_parser & parser, xmlTextReaderPtr reader)
double opacity = 1.0;
value = xmlTextReaderGetAttribute(reader, BAD_CAST "offset");
if (value)
if (value)
{
offset = parse_double((const char*)value);
xmlFree(value);
@ -792,7 +792,7 @@ void parse_gradient_stop(svg_parser & parser, xmlTextReaderPtr reader)
cont_type vec;
parse_style((const char*)value, vec);
BOOST_FOREACH(value_type kv , vec )
for (value_type kv : vec )
{
if (kv.first == "stop-color")
{
@ -870,7 +870,7 @@ bool parse_common_gradient(svg_parser & parser, xmlTextReaderPtr reader)
// check if we should inherit from another tag
value = xmlTextReaderGetAttribute(reader, BAD_CAST "xlink:href");
if (value)
if (value)
{
if (value[0] == '#')
{
@ -886,7 +886,7 @@ bool parse_common_gradient(svg_parser & parser, xmlTextReaderPtr reader)
}
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "gradientUnits");
if (value)
{
@ -900,7 +900,7 @@ bool parse_common_gradient(svg_parser & parser, xmlTextReaderPtr reader)
}
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "gradientTransform");
if (value)
{
@ -939,14 +939,14 @@ void parse_radial_gradient(svg_parser & parser, xmlTextReaderPtr reader)
bool has_percent=true;
value = xmlTextReaderGetAttribute(reader, BAD_CAST "cx");
if (value)
if (value)
{
cx = parse_double_optional_percent((const char*)value, has_percent);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "cy");
if (value)
if (value)
{
cy = parse_double_optional_percent((const char*)value, has_percent);
xmlFree(value);
@ -1003,28 +1003,28 @@ void parse_linear_gradient(svg_parser & parser, xmlTextReaderPtr reader)
bool has_percent=true;
value = xmlTextReaderGetAttribute(reader, BAD_CAST "x1");
if (value)
if (value)
{
x1 = parse_double_optional_percent((const char*)value, has_percent);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "x2");
if (value)
if (value)
{
x2 = parse_double_optional_percent((const char*)value, has_percent);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "y1");
if (value)
if (value)
{
y1 = parse_double_optional_percent((const char*)value, has_percent);
xmlFree(value);
}
value = xmlTextReaderGetAttribute(reader, BAD_CAST "y2");
if (value)
if (value)
{
y2 = parse_double_optional_percent((const char*)value, has_percent);
xmlFree(value);

View file

@ -25,7 +25,7 @@
#include <mapnik/transform_expression.hpp>
// boost
#include <boost/foreach.hpp>
// stl
#include <sstream>
@ -132,7 +132,7 @@ std::string to_expression_string(transform_list const& list)
std::streamsize first = 1;
transform_node_to_expression_string to_string(os);
BOOST_FOREACH (transform_node const& node, list)
for (transform_node const& node : list)
{
os.write(" ", first ? (first = 0) : 1);
boost::apply_visitor(to_string, *node);

View file

@ -6,7 +6,7 @@
// boost
#include <boost/detail/lightweight_test.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
// stl
#include <exception>
@ -52,7 +52,7 @@ void parse_geom(mapnik::geometry_type & geom,
std::string const& geom_string) {
std::vector<std::string> vertices;
boost::split(vertices, geom_string, boost::is_any_of(","));
BOOST_FOREACH(std::string const& vert, vertices)
for (std::string const& vert : vertices)
{
std::vector<std::string> commands;
boost::split(commands, vert, boost::is_any_of(" "));

View file

@ -68,7 +68,7 @@ boost::optional<std::string> linestring_bbox_clipping(mapnik::box2d<double> bbox
throw std::runtime_error("Failed to parse WKT");
}
BOOST_FOREACH( geometry_type & geom, p)
for (geometry_type & geom : p)
{
converter.apply(geom);
}
@ -108,7 +108,7 @@ boost::optional<std::string> polygon_bbox_clipping(mapnik::box2d<double> bbox,
throw std::runtime_error("Failed to parse WKT");
}
BOOST_FOREACH( geometry_type & geom, p)
for (geometry_type & geom : p)
{
converter.apply(geom);
}

View file

@ -17,7 +17,7 @@
#include <mapnik/image_reader.hpp>
#include <mapnik/scale_denominator.hpp>
#include <mapnik/feature_style_processor.hpp>
#include <boost/foreach.hpp>
bool compare_images(std::string const& src_fn,std::string const& dest_fn)
{
@ -100,7 +100,7 @@ int main( int, char*[] )
mapnik::projection map_proj(m.srs(),true);
double scale_denom = mapnik::scale_denominator(req.scale(),map_proj.is_geographic());
scale_denom *= scale_factor;
BOOST_FOREACH ( mapnik::layer const& lyr, m.layers() )
for (mapnik::layer const& lyr : m.layers() )
{
if (lyr.visible(scale_denom))
{

View file

@ -29,7 +29,7 @@
#include <mapnik/datasource_cache.hpp>
#include <mapnik/util/geometry_to_wkb.hpp>
#include <boost/foreach.hpp>
int main (int argc, char ** argv )
@ -70,7 +70,7 @@ int main (int argc, char ** argv )
mapnik::query q(ds->envelope());
mapnik::layer_descriptor layer_desc = ds->get_descriptor();
BOOST_FOREACH ( mapnik::attribute_descriptor const& attr_desc, layer_desc.get_descriptors())
for (mapnik::attribute_descriptor const& attr_desc : layer_desc.get_descriptors())
{
q.add_property_name(attr_desc.get_name());
}
@ -82,7 +82,7 @@ int main (int argc, char ** argv )
{
std::cerr << *f << std::endl;
boost::ptr_vector<mapnik::geometry_type> & paths = f->paths();
BOOST_FOREACH ( mapnik::geometry_type const& geom, paths)
for (mapnik::geometry_type const& geom : paths)
{
// NDR
{