Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions middle-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ using namespace std;
#include <cstring>
#include <ctime>
#include <boost/format.hpp>
#include <boost/foreach.hpp>
#include <boost/unordered_map.hpp>

enum table_id {
Expand Down Expand Up @@ -131,7 +130,7 @@ char *pgsql_store_nodes(const idlist_t &nds) {
// Special escape routine for escaping strings in array constants: double quote, backslash,newline, tab*/
inline char *escape_tag( char *ptr, const std::string &in, bool escape )
{
BOOST_FOREACH(const char c, in)
for (const char c: in)
{
switch(c)
{
Expand Down
31 changes: 15 additions & 16 deletions osmdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "middle.hpp"
#include "node-ram-cache.hpp"

#include <boost/foreach.hpp>
#include <boost/thread/thread.hpp>
#include <boost/unordered_map.hpp>
#include <boost/thread.hpp>
Expand Down Expand Up @@ -38,7 +37,7 @@ int osmdata_t::node_add(osmid_t id, double lat, double lon, const taglist_t &tag
ramNode n(lon, lat);

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->node_add(id, n.lat(), n.lon(), tags);
}
return status;
Expand All @@ -48,7 +47,7 @@ int osmdata_t::way_add(osmid_t id, const idlist_t &nodes, const taglist_t &tags)
mid->ways_set(id, nodes, tags);

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->way_add(id, nodes, tags);
}
return status;
Expand All @@ -58,7 +57,7 @@ int osmdata_t::relation_add(osmid_t id, const memberlist_t &members, const tagli
mid->relations_set(id, members, tags);

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->relation_add(id, members, tags);
}
return status;
Expand All @@ -74,7 +73,7 @@ int osmdata_t::node_modify(osmid_t id, double lat, double lon, const taglist_t &
ramNode n(lon, lat);

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->node_modify(id, n.lat(), n.lon(), tags);
}

Expand All @@ -90,7 +89,7 @@ int osmdata_t::way_modify(osmid_t id, const idlist_t &nodes, const taglist_t &ta
slim->ways_set(id, nodes, tags);

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->way_modify(id, nodes, tags);
}

Expand All @@ -106,7 +105,7 @@ int osmdata_t::relation_modify(osmid_t id, const memberlist_t &members, const ta
slim->relations_set(id, members, tags);

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->relation_modify(id, members, tags);
}

Expand All @@ -119,7 +118,7 @@ int osmdata_t::node_delete(osmid_t id) {
slim_middle_t *slim = dynamic_cast<slim_middle_t *>(mid.get());

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->node_delete(id);
}

Expand All @@ -132,7 +131,7 @@ int osmdata_t::way_delete(osmid_t id) {
slim_middle_t *slim = dynamic_cast<slim_middle_t *>(mid.get());

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->way_delete(id);
}

Expand All @@ -145,7 +144,7 @@ int osmdata_t::relation_delete(osmid_t id) {
slim_middle_t *slim = dynamic_cast<slim_middle_t *>(mid.get());

int status = 0;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
status |= out->relation_delete(id);
}

Expand All @@ -155,7 +154,7 @@ int osmdata_t::relation_delete(osmid_t id) {
}

void osmdata_t::start() {
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
out->start();
}
mid->start(outs[0]->get_options());
Expand Down Expand Up @@ -213,7 +212,7 @@ struct pending_threaded_processor : public middle_t::pending_processor {

//clone the outs
output_vec_t out_clones;
BOOST_FOREACH(const std::shared_ptr<output_t>& out, outs) {
for (const auto& out: outs) {
out_clones.push_back(out->clone(mid_clone.get()));
}

Expand Down Expand Up @@ -261,7 +260,7 @@ struct pending_threaded_processor : public middle_t::pending_processor {

//collect all the new rels that became pending from each
//output in each thread back to their respective main outputs
BOOST_FOREACH(const clone_t& clone, clones) {
for (const auto& clone: clones) {
//for each clone/original output
for(output_vec_t::const_iterator original_output = outs.begin(), clone_output = clone.second.begin();
original_output != outs.end() && clone_output != clone.second.end(); ++original_output, ++clone_output) {
Expand Down Expand Up @@ -307,7 +306,7 @@ struct pending_threaded_processor : public middle_t::pending_processor {
ids_done = 0;

//collect all expiry tree informations together into one
BOOST_FOREACH(const clone_t& clone, clones) {
for (const auto& clone: clones) {
//for each clone/original output
for(output_vec_t::const_iterator original_output = outs.begin(), clone_output = clone.second.begin();
original_output != outs.end() && clone_output != clone.second.end(); ++original_output, ++clone_output) {
Expand Down Expand Up @@ -347,7 +346,7 @@ void osmdata_t::stop() {
*/
size_t pending_count = mid->pending_count();
mid->commit();
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
//TODO: each of the outs can be in parallel
out->commit();
pending_count += out->pending_count();
Expand All @@ -374,7 +373,7 @@ void osmdata_t::stop() {
//Clustering, index creation, and cleanup.
//All the intensive parts of this are long-running PostgreSQL commands
boost::thread_group threads;
BOOST_FOREACH(std::shared_ptr<output_t>& out, outs) {
for (auto& out: outs) {
threads.add_thread(new boost::thread(boost::bind( &output_t::stop, out.get() )));
}
threads.add_thread(new boost::thread(boost::bind( &middle_t::stop, mid.get() )));
Expand Down
8 changes: 4 additions & 4 deletions output-gazetteer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ void place_tag_processor::copy_out(char osm_type, osmid_t osm_id,
const std::string &wkt,
std::string &buffer)
{
BOOST_FOREACH(const tag &place, places) {
for (const tag &place: places) {
std::string name;
if (place.key == "bridge" || place.key == "tunnel") {
name = domain_name(place.key);
Expand Down Expand Up @@ -410,7 +410,7 @@ void place_tag_processor::copy_out(char osm_type, osmid_t osm_id,
bool shop = (place.key == "shop") ||
(place.key == "amenity") ||
(place.key == "tourism");
BOOST_FOREACH(const tag *entry, names) {
for (const tag *entry: names) {
if (!shop && (entry->key == "operator"))
continue;

Expand Down Expand Up @@ -439,7 +439,7 @@ void place_tag_processor::copy_out(char osm_type, osmid_t osm_id,
copy_opt_string(addr_place, buffer);
// isin
if (!address.empty()) {
BOOST_FOREACH(const tag *entry, address) {
for (const tag *entry: address) {
if (entry->key == "tiger:county") {
escape(std::string(entry->value, 0, entry->value.find(",")),
buffer);
Expand All @@ -461,7 +461,7 @@ void place_tag_processor::copy_out(char osm_type, osmid_t osm_id,
buffer += "\\N\t";
} else {
bool first = true;
BOOST_FOREACH(const tag *entry, extratags) {
for (const tag *entry: extratags) {
if (first)
first = false;
else
Expand Down
5 changes: 2 additions & 3 deletions output-gazetteer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "pgsql.hpp"
#include "util.hpp"

#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/algorithm/string/predicate.hpp>

Expand Down Expand Up @@ -37,7 +36,7 @@ class place_tag_processor

bool has_place(const std::string &cls)
{
BOOST_FOREACH(const tag &item, places) {
for (const tag &item: places) {
if (cls == item.key)
return true;
}
Expand Down Expand Up @@ -91,7 +90,7 @@ class place_tag_processor

void escape_array_record(const std::string &in, std::string &out)
{
BOOST_FOREACH(const char c, in) {
for (const char c: in) {
switch(c) {
case '\\': out += "\\\\\\\\\\\\\\\\"; break;
case '\n':
Expand Down
1 change: 0 additions & 1 deletion output-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

#include <boost/bind.hpp>
#include <boost/format.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/exception_ptr.hpp>
#include <iostream>
Expand Down
7 changes: 3 additions & 4 deletions output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <stdexcept>

#include <boost/format.hpp>
#include <boost/foreach.hpp>
#include <boost/functional/hash.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
Expand Down Expand Up @@ -51,7 +50,7 @@ std::shared_ptr<output_t> parse_multi_single(const pt::ptree &conf,
hstores_t hstore_columns;
boost::optional<const pt::ptree &> hstores = conf.get_child_optional("hstores");
if (hstores) {
BOOST_FOREACH(const pt::ptree::value_type &val, *hstores) {
for (const pt::ptree::value_type &val: *hstores) {
hstore_columns.push_back(val.second.get_value<std::string>());
}
}
Expand All @@ -66,7 +65,7 @@ std::shared_ptr<output_t> parse_multi_single(const pt::ptree &conf,

export_list columns;
const pt::ptree &tags = conf.get_child("tags");
BOOST_FOREACH(const pt::ptree::value_type &val, tags) {
for (const pt::ptree::value_type &val: tags) {
const pt::ptree &tag = val.second;
taginfo info;
info.name = tag.get<std::string>("name");
Expand All @@ -92,7 +91,7 @@ std::vector<std::shared_ptr<output_t> > parse_multi_config(const middle_query_t
pt::ptree conf;
pt::read_json(file_name, conf);

BOOST_FOREACH(const pt::ptree::value_type &val, conf) {
for (const pt::ptree::value_type &val: conf) {
outputs.push_back(parse_multi_single(val.second, mid, options));
}

Expand Down
4 changes: 1 addition & 3 deletions pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
#include <cstdarg>
#include <memory>
#include <boost/format.hpp>
#include <boost/foreach.hpp>

void escape(const std::string &src, std::string &dst)
{
BOOST_FOREACH(const char c, src)
{
for (const char c: src) {
switch(c) {
case '\\': dst.append("\\\\"); break;
//case 8: dst.append("\\\b"); break;
Expand Down