diff --git a/include/mapnik/xml_tree.hpp b/include/mapnik/xml_tree.hpp index 29a1f02cb..68d980b28 100644 --- a/include/mapnik/xml_tree.hpp +++ b/include/mapnik/xml_tree.hpp @@ -26,11 +26,9 @@ // mapnik #include #include -#include //stl #include -#include namespace mapnik { @@ -46,10 +44,8 @@ public: private: xml_node node_; std::string file_; - transcoder tr_; public: mutable std::map expr_cache_; - }; } //ns mapnik diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 86d5d9847..fe78abad3 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -423,8 +423,6 @@ void csv_datasource::parse_csv(T & stream, } mapnik::transcoder tr(desc_.get_encoding()); - //mapnik::wkt_parser parse_wkt; - //mapnik::json::geometry_parser parse_json; // handle rare case of a single line of data and user-provided headers // where a lack of a newline will mean that std::getline returns false diff --git a/src/color_factory.cpp b/src/color_factory.cpp index b23e6be37..28945a20c 100644 --- a/src/color_factory.cpp +++ b/src/color_factory.cpp @@ -30,7 +30,7 @@ namespace mapnik { color parse_color(std::string const& str) { - static css_color_grammar g; + static const css_color_grammar g; return parse_color(str, g); } diff --git a/src/expression.cpp b/src/expression.cpp index f32f9448e..3067b3251 100644 --- a/src/expression.cpp +++ b/src/expression.cpp @@ -35,7 +35,7 @@ namespace mapnik expression_ptr parse_expression(std::string const& str, std::string const& encoding) { - static expression_grammar g; + static const expression_grammar g; return parse_expression(str, g); } diff --git a/src/image_filter_types.cpp b/src/image_filter_types.cpp index 201564dc6..eb53b1661 100644 --- a/src/image_filter_types.cpp +++ b/src/image_filter_types.cpp @@ -46,7 +46,7 @@ bool parse_image_filters(std::string const& filters, std::vector& i { std::string::const_iterator itr = filters.begin(); std::string::const_iterator end = filters.end(); - static mapnik::image_filter_grammar > filter_grammar; boost::spirit::qi::ascii::space_type space; bool r = boost::spirit::qi::phrase_parse(itr,end, diff --git a/src/json/geometry_parser.cpp b/src/json/geometry_parser.cpp index fbf9076c0..68ae65d8c 100644 --- a/src/json/geometry_parser.cpp +++ b/src/json/geometry_parser.cpp @@ -42,20 +42,21 @@ template geometry_parser::~geometry_parser() {} template -bool geometry_parser::parse(iterator_type first, iterator_type last, boost::ptr_vector& path) +bool geometry_parser::parse(iterator_type first, iterator_type last, boost::ptr_vector& paths) { using namespace boost::spirit; standard_wide::space_type space; - return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(path)), space); + return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(paths)), space); } - bool from_geojson(std::string const& json, boost::ptr_vector & paths) { - static geometry_parser parser; + using namespace boost::spirit; + static const geometry_grammar g; + standard_wide::space_type space; std::string::const_iterator start = json.begin(); std::string::const_iterator end = json.end(); - return parser.parse(start, end ,paths); + return qi::phrase_parse(start, end, (g)(boost::phoenix::ref(paths)), space); } template class geometry_parser ; diff --git a/src/parse_path.cpp b/src/parse_path.cpp index 582ce4fab..7de8c2b3b 100644 --- a/src/parse_path.cpp +++ b/src/parse_path.cpp @@ -40,7 +40,7 @@ namespace mapnik { path_expression_ptr parse_path(std::string const& str) { - static path_expression_grammar g; + static const path_expression_grammar g; return parse_path(str,g); } diff --git a/src/parse_transform.cpp b/src/parse_transform.cpp index 58fa617e6..0cc5e8af9 100644 --- a/src/parse_transform.cpp +++ b/src/parse_transform.cpp @@ -36,7 +36,7 @@ transform_list_ptr parse_transform(std::string const& str) transform_list_ptr parse_transform(std::string const& str, std::string const& encoding) { transform_list_ptr tl = std::make_shared(); - static transform_expression_grammar_string gte; + static const transform_expression_grammar_string gte; if (!parse_transform(*tl, str, gte)) { tl.reset(); @@ -47,7 +47,7 @@ transform_list_ptr parse_transform(std::string const& str, std::string const& en bool parse_transform(transform_list& tl, std::string const& str) { - static transform_expression_grammar_string gte; + static const transform_expression_grammar_string gte; return parse_transform(tl, str, gte); } diff --git a/src/wkt/wkt_factory.cpp b/src/wkt/wkt_factory.cpp index 75368a893..f4963a5ec 100644 --- a/src/wkt/wkt_factory.cpp +++ b/src/wkt/wkt_factory.cpp @@ -47,8 +47,12 @@ bool wkt_parser::parse(std::string const& wkt, boost::ptr_vector bool from_wkt(std::string const& wkt, boost::ptr_vector & paths) { - static wkt_parser parser; - return parser.parse(wkt,paths); + using namespace boost::spirit; + static const mapnik::wkt::wkt_collection_grammar g; + ascii::space_type space; + std::string::const_iterator first = wkt.begin(); + std::string::const_iterator last = wkt.end(); + return qi::phrase_parse(first, last, g, space, paths); } } diff --git a/src/xml_tree.cpp b/src/xml_tree.cpp index 7b46e6573..34bc273d3 100644 --- a/src/xml_tree.cpp +++ b/src/xml_tree.cpp @@ -99,8 +99,7 @@ struct name_trait< mapnik::enumeration > xml_tree::xml_tree(std::string const& encoding) : node_(*this, ""), - file_(), - tr_(encoding) + file_() { node_.set_processed(true); //root node is always processed }