From 688e97e1487a17e59da2d76c59856f637ab5ec4e Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 29 Sep 2014 12:07:15 -0700 Subject: [PATCH] move dasharray parser to cpp file - refs #2439 --- include/mapnik/symbolizer.hpp | 2 +- include/mapnik/symbolizer_utils.hpp | 3 ++- include/mapnik/util/dasharray_parser.hpp | 32 +----------------------- include/mapnik/vertex_converters.hpp | 4 --- src/build.py | 1 + 5 files changed, 5 insertions(+), 37 deletions(-) diff --git a/include/mapnik/symbolizer.hpp b/include/mapnik/symbolizer.hpp index c53b91417..c5e4271d0 100644 --- a/include/mapnik/symbolizer.hpp +++ b/include/mapnik/symbolizer.hpp @@ -410,7 +410,7 @@ struct evaluate_expression_wrapper dash_array dash; std::vector buf; std::string str = val.to_string(); - if (util::parse_dasharray(str.begin(),str.end(),buf)) + if (util::parse_dasharray(str,buf)) { util::add_dashes(buf,dash); } diff --git a/include/mapnik/symbolizer_utils.hpp b/include/mapnik/symbolizer_utils.hpp index d6bdd8939..1d094c4c2 100644 --- a/include/mapnik/symbolizer_utils.hpp +++ b/include/mapnik/symbolizer_utils.hpp @@ -37,6 +37,7 @@ #include #include #include +#include #include namespace mapnik { @@ -395,7 +396,7 @@ struct set_symbolizer_property_impl { std::vector buf; dash_array dash; - if (util::parse_dasharray((*str).begin(),(*str).end(),buf) && util::add_dashes(buf,dash)) + if (util::parse_dasharray(*str,buf) && util::add_dashes(buf,dash)) { put(sym,key,dash); } diff --git a/include/mapnik/util/dasharray_parser.hpp b/include/mapnik/util/dasharray_parser.hpp index 0cf0081dc..f22b927e7 100644 --- a/include/mapnik/util/dasharray_parser.hpp +++ b/include/mapnik/util/dasharray_parser.hpp @@ -23,42 +23,12 @@ #ifndef MAPNIK_UTIL_DASHARRAY_PARSER_HPP #define MAPNIK_UTIL_DASHARRAY_PARSER_HPP -#include -#include -#include -#include -#include - #include #include namespace mapnik { namespace util { -template -bool parse_dasharray(Iterator first, Iterator last, std::vector& dasharray) -{ - using namespace boost::spirit; - qi::double_type double_; - qi::_1_type _1; - qi::lit_type lit; - qi::char_type char_; - qi::ascii::space_type space; - qi::no_skip_type no_skip; - // SVG - // dasharray ::= (length | percentage) (comma-wsp dasharray)? - // no support for 'percentage' as viewport is unknown at load_map - // - bool r = qi::phrase_parse(first, last, - (double_[boost::phoenix::push_back(boost::phoenix::ref(dasharray), _1)] % - no_skip[char_(", ")] - | lit("none")), - space); - if (first != last) - { - return false; - } - return r; -} +bool parse_dasharray(std::string const& value, std::vector& dasharray); inline bool add_dashes(std::vector & buf, std::vector > & dash) { diff --git a/include/mapnik/vertex_converters.hpp b/include/mapnik/vertex_converters.hpp index f943075db..f034b91b4 100644 --- a/include/mapnik/vertex_converters.hpp +++ b/include/mapnik/vertex_converters.hpp @@ -38,10 +38,6 @@ #include #include -// fusion -//#include -//#include - // agg #include "agg_math_stroke.h" #include "agg_trans_affine.h" diff --git a/src/build.py b/src/build.py index 7854f6022..3d6d05d59 100644 --- a/src/build.py +++ b/src/build.py @@ -142,6 +142,7 @@ else: # unix, non-macos source = Split( """ + dasharray_parser.cpp expression_grammar.cpp fs.cpp request.cpp