diff --git a/include/mapnik/attribute_collector.hpp b/include/mapnik/attribute_collector.hpp index 9ad579c5f..9ff8b56cc 100644 --- a/include/mapnik/attribute_collector.hpp +++ b/include/mapnik/attribute_collector.hpp @@ -32,7 +32,6 @@ #include // stl #include -#include namespace mapnik { diff --git a/include/mapnik/config_error.hpp b/include/mapnik/config_error.hpp index b2f13e930..c37d5617c 100644 --- a/include/mapnik/config_error.hpp +++ b/include/mapnik/config_error.hpp @@ -23,12 +23,13 @@ #ifndef MAPNIK_CONFIG_ERROR_HPP #define MAPNIK_CONFIG_ERROR_HPP -#include -#include +#include +#include namespace mapnik { class xml_node; + class config_error : public std::exception { public: diff --git a/include/mapnik/hextree.hpp b/include/mapnik/hextree.hpp index 50102a812..9d399188c 100644 --- a/include/mapnik/hextree.hpp +++ b/include/mapnik/hextree.hpp @@ -38,7 +38,6 @@ // stl #include -#include #include #include #include diff --git a/include/mapnik/json/feature_collection_grammar.hpp b/include/mapnik/json/feature_collection_grammar.hpp index 54c749dd4..6bd86590b 100644 --- a/include/mapnik/json/feature_collection_grammar.hpp +++ b/include/mapnik/json/feature_collection_grammar.hpp @@ -33,9 +33,6 @@ #include #include -// stl -#include - namespace mapnik { namespace json { namespace qi = boost::spirit::qi; diff --git a/include/mapnik/json/feature_grammar.hpp b/include/mapnik/json/feature_grammar.hpp index 13c11e836..f8e710579 100644 --- a/include/mapnik/json/feature_grammar.hpp +++ b/include/mapnik/json/feature_grammar.hpp @@ -34,9 +34,6 @@ #include #include -// stl -#include - namespace mapnik { namespace json { namespace qi = boost::spirit::qi; diff --git a/include/mapnik/json/geometry_grammar.hpp b/include/mapnik/json/geometry_grammar.hpp index 6792725d0..64a776f3e 100644 --- a/include/mapnik/json/geometry_grammar.hpp +++ b/include/mapnik/json/geometry_grammar.hpp @@ -33,9 +33,6 @@ #include #include -// stl -#include - namespace mapnik { namespace json { namespace qi = boost::spirit::qi; diff --git a/include/mapnik/memory.hpp b/include/mapnik/memory.hpp index 1da40bd44..9cdda0337 100644 --- a/include/mapnik/memory.hpp +++ b/include/mapnik/memory.hpp @@ -23,8 +23,6 @@ #ifndef MAPNIK_MEMORY_HPP #define MAPNIK_MEMORY_HPP -// stl -#include #include namespace mapnik diff --git a/include/mapnik/octree.hpp b/include/mapnik/octree.hpp index c9d4211af..35b64c0d1 100644 --- a/include/mapnik/octree.hpp +++ b/include/mapnik/octree.hpp @@ -32,7 +32,6 @@ // stl #include -#include #include #include diff --git a/include/mapnik/palette.hpp b/include/mapnik/palette.hpp index ed94fd07e..703e38c02 100644 --- a/include/mapnik/palette.hpp +++ b/include/mapnik/palette.hpp @@ -34,7 +34,6 @@ // stl #include #include -#include #include #include #include diff --git a/include/mapnik/pool.hpp b/include/mapnik/pool.hpp index e7f96cb7e..efe338ce9 100644 --- a/include/mapnik/pool.hpp +++ b/include/mapnik/pool.hpp @@ -35,7 +35,6 @@ #endif // stl -#include #include #include #include diff --git a/include/mapnik/projection.hpp b/include/mapnik/projection.hpp index a1578eba4..0e5aba2dc 100644 --- a/include/mapnik/projection.hpp +++ b/include/mapnik/projection.hpp @@ -37,7 +37,6 @@ // stl #include -#include #include namespace mapnik { diff --git a/include/mapnik/svg/output/svg_output_grammars.hpp b/include/mapnik/svg/output/svg_output_grammars.hpp index 818624c05..8ff11f3aa 100644 --- a/include/mapnik/svg/output/svg_output_grammars.hpp +++ b/include/mapnik/svg/output/svg_output_grammars.hpp @@ -40,9 +40,6 @@ #include #include -// std -#include - /*! * mapnik::svg::path_output_attributes is adapted as a fusion sequence * in order to be used directly by the svg_path_attributes_grammar (below). diff --git a/include/mapnik/utils.hpp b/include/mapnik/utils.hpp index 73e68e551..24a5d3d54 100644 --- a/include/mapnik/utils.hpp +++ b/include/mapnik/utils.hpp @@ -33,8 +33,6 @@ #include #include #include -#include -#include #include #include diff --git a/include/mapnik/value.hpp b/include/mapnik/value.hpp index cfe807d7a..8d986582f 100644 --- a/include/mapnik/value.hpp +++ b/include/mapnik/value.hpp @@ -35,6 +35,7 @@ // stl #include +#include #include #include diff --git a/include/mapnik/value_error.hpp b/include/mapnik/value_error.hpp index 1e234e208..d95d7e8ae 100644 --- a/include/mapnik/value_error.hpp +++ b/include/mapnik/value_error.hpp @@ -23,8 +23,8 @@ #ifndef MAPNIK_VALUE_ERROR_HPP #define MAPNIK_VALUE_ERROR_HPP -#include -#include +#include +#include namespace mapnik { diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 1101108ae..2723488de 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -159,9 +159,8 @@ void csv_datasource::parse_csv(T & stream, if (file_mb > filesize_max_) { std::ostringstream s; - s << "CSV Plugin: csv file is greater than " << filesize_max_ << "MB " - << " - you should use a more efficient data format like sqlite, postgis or a shapefile " - << " to render this data (set 'filesize_max=0' to disable this restriction if you have lots of memory)"; + s << "CSV Plugin: csv file is greater than "; + s << filesize_max_ << "MB - you should use a more efficient data format like sqlite, postgis or a shapefile to render this data (set 'filesize_max=0' to disable this restriction if you have lots of memory)"; throw mapnik::datasource_exception(s.str()); } } @@ -258,9 +257,9 @@ void csv_datasource::parse_csv(T & stream, } catch(std::exception const& ex) { - std::ostringstream s; - s << "CSV Plugin: " << ex.what(); - throw mapnik::datasource_exception(s.str()); + std::string s("CSV Plugin: "); + s += ex.what(); + throw mapnik::datasource_exception(s); } typedef boost::tokenizer< escape_type > Tokenizer; @@ -345,10 +344,10 @@ void csv_datasource::parse_csv(T & stream, if (strict_) { std::ostringstream s; - s << "CSV Plugin: expected a column header at line " - << line_number << ", column " << idx - << " - ensure this row contains valid header fields: '" - << csv_line << "'\n"; + s << "CSV Plugin: expected a column header at line "; + s << line_number << ", column " << idx; + s << " - ensure this row contains valid header fields: '"; + s << csv_line << "'\n"; throw mapnik::datasource_exception(s.str()); } else @@ -398,18 +397,16 @@ void csv_datasource::parse_csv(T & stream, } catch(const std::exception & ex) { - std::ostringstream s; - s << "CSV Plugin: error parsing headers: " << ex.what(); - throw mapnik::datasource_exception(s.str()); + std::string s("CSV Plugin: error parsing headers: "); + s += ex.what(); + throw mapnik::datasource_exception(s); } } } if (!has_wkt_field && !has_json_field && (!has_lon_field || !has_lat_field) ) { - std::ostringstream s; - s << "CSV Plugin: could not detect column headers with the name of wkt, geojson, x/y, or latitude/longitude - this is required for reading geometry data"; - throw mapnik::datasource_exception(s.str()); + throw mapnik::datasource_exception("CSV Plugin: could not detect column headers with the name of wkt, geojson, x/y, or latitude/longitude - this is required for reading geometry data"); } int feature_count(0); @@ -948,10 +945,8 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const if (! found_name) { std::ostringstream s; - s << "CSV Plugin: no attribute '" << *pos << "'. Valid attributes are: " << boost::algorithm::join(headers_, ",") << "."; - throw mapnik::datasource_exception(s.str()); } ++pos; diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index a118bd088..60f63b0b7 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -24,7 +24,6 @@ #include "geojson_featureset.hpp" #include -#include #include // boost diff --git a/plugins/input/geos/geos_datasource.cpp b/plugins/input/geos/geos_datasource.cpp index e13e563c3..4cd780941 100644 --- a/plugins/input/geos/geos_datasource.cpp +++ b/plugins/input/geos/geos_datasource.cpp @@ -24,7 +24,7 @@ #include "geos_featureset.hpp" // stl -#include +#include #include #include #include diff --git a/plugins/input/geos/geos_featureset.cpp b/plugins/input/geos/geos_featureset.cpp index da5f88d4a..8c8fba58a 100644 --- a/plugins/input/geos/geos_featureset.cpp +++ b/plugins/input/geos/geos_featureset.cpp @@ -20,10 +20,6 @@ * *****************************************************************************/ -// stl -#include -#include - // mapnik #include #include diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index b3b31d548..1125f9091 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -37,8 +37,8 @@ #include // stl -#include #include +#include #include using mapnik::datasource; @@ -174,11 +174,8 @@ void ogr_datasource::bind() const const unsigned num_layers = dataset_->GetLayerCount(); if (*layer_by_index >= num_layers) { - std::ostringstream s; - s << "OGR Plugin: only "; - s << num_layers; - s << " layer(s) exist, cannot find layer by index '" << *layer_by_index << "'"; - + std::ostringstream s("OGR Plugin: only "); + s << num_layers << " layer(s) exist, cannot find layer by index '" << *layer_by_index << "'"; throw datasource_exception(s.str()); } @@ -196,9 +193,7 @@ void ogr_datasource::bind() const } else { - std::ostringstream s; - s << "OGR Plugin: missing or or " - << "parameter, available layers are: "; + std::string s("OGR Plugin: missing or or parameter, available layers are: "); unsigned num_layers = dataset_->GetLayerCount(); bool layer_found = false; @@ -216,14 +211,14 @@ void ogr_datasource::bind() const if (! layer_found) { - s << "None (no layers were found in dataset)"; + s += "None (no layers were found in dataset)"; } else { - s << boost::algorithm::join(layer_names,", "); + s += boost::algorithm::join(layer_names,", "); } - throw datasource_exception(s.str()); + throw datasource_exception(s); } if (! layer_.is_valid()) @@ -465,10 +460,10 @@ void validate_attribute_names(query const& q, std::vector if (! found_name) { - std::ostringstream s; + std::ostringstream s("OGR Plugin: no attribute '"); + s << *pos << "'. Valid attributes are: "; std::vector::const_iterator itr = names.begin(); std::vector::const_iterator end = names.end(); - s << "OGR Plugin: no attribute '" << *pos << "'. Valid attributes are: "; for ( ;itr!=end;++itr) { s << itr->get_name() << std::endl; diff --git a/plugins/input/ogr/ogr_layer_ptr.hpp b/plugins/input/ogr/ogr_layer_ptr.hpp index 62da2a027..26588aeef 100644 --- a/plugins/input/ogr/ogr_layer_ptr.hpp +++ b/plugins/input/ogr/ogr_layer_ptr.hpp @@ -27,8 +27,6 @@ #include // stl -#include -#include #include // ogr diff --git a/plugins/input/osm/dataset_deliverer.h b/plugins/input/osm/dataset_deliverer.h index 82ea029cf..217eb674f 100644 --- a/plugins/input/osm/dataset_deliverer.h +++ b/plugins/input/osm/dataset_deliverer.h @@ -25,7 +25,6 @@ #include "osm.h" #include -#include using namespace std; diff --git a/plugins/input/osm/osm_datasource.cpp b/plugins/input/osm/osm_datasource.cpp index ba5b4d08c..b2ba7ff5b 100644 --- a/plugins/input/osm/osm_datasource.cpp +++ b/plugins/input/osm/osm_datasource.cpp @@ -21,9 +21,6 @@ *****************************************************************************/ // stl -#include -#include -#include #include #include @@ -91,9 +88,9 @@ void osm_datasource::bind() const // if we supplied a filename, load from file if ((osm_data_ = dataset_deliverer::load_from_file(osm_filename, parser)) == NULL) { - std::ostringstream s; - s << "OSM Plugin: Error loading from file '" << osm_filename << "'"; - throw datasource_exception(s.str()); + std::string s("OSM Plugin: Error loading from file '"); + s += osm_filename + "'"; + throw datasource_exception(s); } } else diff --git a/plugins/input/osm/osm_featureset.cpp b/plugins/input/osm/osm_featureset.cpp index 568384f2d..42abad4f1 100644 --- a/plugins/input/osm/osm_featureset.cpp +++ b/plugins/input/osm/osm_featureset.cpp @@ -21,9 +21,6 @@ * *****************************************************************************/ -// stl -#include - // mapnik #include #include diff --git a/plugins/input/osm/osmparser.cpp b/plugins/input/osm/osmparser.cpp index d92ae54fd..ec9ed3047 100644 --- a/plugins/input/osm/osmparser.cpp +++ b/plugins/input/osm/osmparser.cpp @@ -5,8 +5,6 @@ #include #include -using std::endl; - osm_item* osmparser::cur_item=NULL; long osmparser::curID=0; bool osmparser::in_node=false, osmparser::in_way=false; diff --git a/plugins/input/osm/osmparser.h b/plugins/input/osm/osmparser.h index 5cc00e24a..21dffd7e9 100644 --- a/plugins/input/osm/osmparser.h +++ b/plugins/input/osm/osmparser.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "osm.h" #include diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 736f7e913..b7f3833d4 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -41,7 +41,6 @@ #include // stl -#include #include #include diff --git a/plugins/input/shape/shape_utils.cpp b/plugins/input/shape/shape_utils.cpp index a2685e67c..b62f38aaf 100644 --- a/plugins/input/shape/shape_utils.cpp +++ b/plugins/input/shape/shape_utils.cpp @@ -23,14 +23,11 @@ // mapnik #include #include +#include #include "shape_utils.hpp" // boost #include -// stl -#include -#include - void setup_attributes(mapnik::context_ptr const& ctx, std::set const& names, @@ -56,19 +53,17 @@ void setup_attributes(mapnik::context_ptr const& ctx, if (! found_name) { - std::ostringstream s; - - s << "no attribute '" << *pos << "' in '" - << shape_name << "'. Valid attributes are: "; - + std::string s("no attribute '"); + std::string pos_string; + s += *pos + "' in '" + shape_name + "'. Valid attributes are: "; std::vector list; for (int i = 0; i < shape.dbf().num_fields(); ++i) { list.push_back(shape.dbf().descriptor(i).name_); } - s << boost::algorithm::join(list, ",") << "."; + s += boost::algorithm::join(list, ",") + "."; - throw mapnik::datasource_exception("Shape Plugin: " + s.str()); + throw mapnik::datasource_exception("Shape Plugin: " + s); } } } diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 04bfe209a..5d5d63616 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -35,8 +35,6 @@ // stl #include -#include -#include #include namespace mapnik { @@ -74,17 +72,17 @@ datasource_ptr datasource_cache::create(const parameters& params, bool bind) std::map >::iterator itr=plugins_.find(*type); if ( itr == plugins_.end() ) { - std::ostringstream s; - s << "Could not create datasource for type: '" << *type << "'"; + std::string s("Could not create datasource for type: '"); + s += *type + "'"; if (plugin_directories_.empty()) { - s << " (no datasource plugin directories have been successfully registered)"; + s + " (no datasource plugin directories have been successfully registered)"; } else { - s << " (searched for datasource plugins in '" << plugin_directories() << "')"; + s + " (searched for datasource plugins in '" + plugin_directories() + "')"; } - throw config_error(s.str()); + throw config_error(s); } if ( ! itr->second->handle()) diff --git a/src/font_set.cpp b/src/font_set.cpp index 06daf5b42..fdd04229a 100644 --- a/src/font_set.cpp +++ b/src/font_set.cpp @@ -25,7 +25,6 @@ //stl #include -#include namespace mapnik { diff --git a/src/gradient.cpp b/src/gradient.cpp index 28452b8da..d8f6276f3 100644 --- a/src/gradient.cpp +++ b/src/gradient.cpp @@ -21,7 +21,6 @@ *****************************************************************************/ #include -#include namespace mapnik { diff --git a/src/graphics.cpp b/src/graphics.cpp index 64f3721c3..0a73eb47f 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -39,9 +39,6 @@ // boost #include -// stl -#include - namespace mapnik { image_32::image_32(int width,int height) diff --git a/src/layer.cpp b/src/layer.cpp index 44abff6fb..0e8539747 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -27,8 +27,6 @@ // stl #include -#include - namespace mapnik { diff --git a/src/shield_symbolizer.cpp b/src/shield_symbolizer.cpp index 17238953b..f7b7d0f53 100644 --- a/src/shield_symbolizer.cpp +++ b/src/shield_symbolizer.cpp @@ -28,9 +28,6 @@ // boost #include -// stl -#include - namespace mapnik { diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index 6b049ce63..f745108fa 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -37,7 +37,6 @@ #include #include -#include #include #include #include diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 8cf5f89ae..43a3beac1 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -27,9 +27,6 @@ #include #include -// stl -#include - extern "C" { #include