all static grammar usage const + xml_tree cleanups
This commit is contained in:
parent
8c1e69fdb8
commit
97a45f21bb
10 changed files with 19 additions and 21 deletions
|
@ -26,11 +26,9 @@
|
|||
// mapnik
|
||||
#include <mapnik/xml_node.hpp>
|
||||
#include <mapnik/expression.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
|
||||
//stl
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -46,10 +44,8 @@ public:
|
|||
private:
|
||||
xml_node node_;
|
||||
std::string file_;
|
||||
transcoder tr_;
|
||||
public:
|
||||
mutable std::map<std::string,mapnik::expression_ptr> expr_cache_;
|
||||
|
||||
};
|
||||
|
||||
} //ns mapnik
|
||||
|
|
|
@ -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<std::string::const_iterator> 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
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace mapnik {
|
|||
|
||||
color parse_color(std::string const& str)
|
||||
{
|
||||
static css_color_grammar<std::string::const_iterator> g;
|
||||
static const css_color_grammar<std::string::const_iterator> g;
|
||||
return parse_color(str, g);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace mapnik
|
|||
|
||||
expression_ptr parse_expression(std::string const& str, std::string const& encoding)
|
||||
{
|
||||
static expression_grammar<std::string::const_iterator> g;
|
||||
static const expression_grammar<std::string::const_iterator> g;
|
||||
return parse_expression(str, g);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ bool parse_image_filters(std::string const& filters, std::vector<filter_type>& i
|
|||
{
|
||||
std::string::const_iterator itr = filters.begin();
|
||||
std::string::const_iterator end = filters.end();
|
||||
static mapnik::image_filter_grammar<std::string::const_iterator,
|
||||
static const mapnik::image_filter_grammar<std::string::const_iterator,
|
||||
std::vector<mapnik::filter::filter_type> > filter_grammar;
|
||||
boost::spirit::qi::ascii::space_type space;
|
||||
bool r = boost::spirit::qi::phrase_parse(itr,end,
|
||||
|
|
|
@ -42,20 +42,21 @@ template <typename Iterator>
|
|||
geometry_parser<Iterator>::~geometry_parser() {}
|
||||
|
||||
template <typename Iterator>
|
||||
bool geometry_parser<Iterator>::parse(iterator_type first, iterator_type last, boost::ptr_vector<mapnik::geometry_type>& path)
|
||||
bool geometry_parser<Iterator>::parse(iterator_type first, iterator_type last, boost::ptr_vector<mapnik::geometry_type>& 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<geometry_type> & paths)
|
||||
{
|
||||
static geometry_parser<std::string::const_iterator> parser;
|
||||
using namespace boost::spirit;
|
||||
static const geometry_grammar<std::string::const_iterator> 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<std::string::const_iterator> ;
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace mapnik {
|
|||
|
||||
path_expression_ptr parse_path(std::string const& str)
|
||||
{
|
||||
static path_expression_grammar<std::string::const_iterator> g;
|
||||
static const path_expression_grammar<std::string::const_iterator> g;
|
||||
return parse_path(str,g);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<transform_list>();
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,12 @@ bool wkt_parser::parse(std::string const& wkt, boost::ptr_vector<geometry_type>
|
|||
|
||||
bool from_wkt(std::string const& wkt, boost::ptr_vector<geometry_type> & paths)
|
||||
{
|
||||
static wkt_parser parser;
|
||||
return parser.parse(wkt,paths);
|
||||
using namespace boost::spirit;
|
||||
static const mapnik::wkt::wkt_collection_grammar<std::string::const_iterator> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,8 +99,7 @@ struct name_trait< mapnik::enumeration<ENUM, MAX> >
|
|||
|
||||
xml_tree::xml_tree(std::string const& encoding)
|
||||
: node_(*this, "<root>"),
|
||||
file_(),
|
||||
tr_(encoding)
|
||||
file_()
|
||||
{
|
||||
node_.set_processed(true); //root node is always processed
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue