adapt build to use BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
This commit is contained in:
parent
7b58b26df1
commit
87e0ae8124
36 changed files with 198 additions and 140 deletions
|
@ -1715,6 +1715,9 @@ if not preconfigured:
|
|||
debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG']
|
||||
ndebug_defines = ['-DNDEBUG']
|
||||
|
||||
# faster compile
|
||||
# http://www.boost.org/doc/libs/1_47_0/libs/spirit/doc/html/spirit/what_s_new/spirit_2_5.html#spirit.what_s_new.spirit_2_5.breaking_changes
|
||||
env.Append(CPPDEFINES = '-DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1 -DBOOST_PHOENIX_NO_PREDEFINED_TERMINALS=1')
|
||||
# c++11 support / https://github.com/mapnik/mapnik/issues/1683
|
||||
# - upgrade to PHOENIX_V3 since that is needed for c++11 compile
|
||||
env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
|
||||
|
|
|
@ -342,9 +342,9 @@ void box2d<T>::pad(T padding)
|
|||
template <typename T>
|
||||
bool box2d<T>::from_string(std::string const& str)
|
||||
{
|
||||
using boost::spirit::qi::lit;
|
||||
using boost::spirit::qi::double_;
|
||||
using boost::spirit::ascii::space;
|
||||
boost::spirit::qi::lit_type lit;
|
||||
boost::spirit::qi::double_type double_;
|
||||
boost::spirit::ascii::space_type space;
|
||||
bool r = boost::spirit::qi::phrase_parse(str.begin(),
|
||||
str.end(),
|
||||
double_ >> -lit(',') >> double_ >> -lit(',')
|
||||
|
|
|
@ -44,20 +44,20 @@ color::color(std::string const& str)
|
|||
std::string color::to_string() const
|
||||
{
|
||||
namespace karma = boost::spirit::karma;
|
||||
using boost::spirit::karma::_1;
|
||||
using boost::spirit::karma::eps;
|
||||
using boost::spirit::karma::double_;
|
||||
using boost::spirit::karma::string;
|
||||
boost::spirit::karma::_1_type _1;
|
||||
boost::spirit::karma::eps_type eps;
|
||||
boost::spirit::karma::double_type double_;
|
||||
boost::spirit::karma::string_type kstring;
|
||||
boost::spirit::karma::uint_generator<uint8_t,10> color_generator;
|
||||
std::string str;
|
||||
std::back_insert_iterator<std::string> sink(str);
|
||||
karma::generate(sink,
|
||||
// begin grammar
|
||||
string[ phoenix::if_(alpha()==255) [_1="rgb("].else_[_1="rgba("]]
|
||||
kstring[ phoenix::if_(alpha()==255) [_1="rgb("].else_[_1="rgba("]]
|
||||
<< color_generator[_1 = red()] << ','
|
||||
<< color_generator[_1 = green()] << ','
|
||||
<< color_generator[_1 = blue()]
|
||||
<< string[ phoenix::if_(alpha()==255) [_1 = ')'].else_[_1 =',']]
|
||||
<< kstring[ phoenix::if_(alpha()==255) [_1 = ')'].else_[_1 =',']]
|
||||
<< eps(alpha()<255) << double_ [_1 = alpha()/255.0]
|
||||
<< ')'
|
||||
// end grammar
|
||||
|
@ -68,10 +68,10 @@ std::string color::to_string() const
|
|||
std::string color::to_hex_string() const
|
||||
{
|
||||
namespace karma = boost::spirit::karma;
|
||||
using boost::spirit::karma::_1;
|
||||
using boost::spirit::karma::hex;
|
||||
using boost::spirit::karma::eps;
|
||||
using boost::spirit::karma::right_align;
|
||||
boost::spirit::karma::_1_type _1;
|
||||
boost::spirit::karma::hex_type hex;
|
||||
boost::spirit::karma::eps_type eps;
|
||||
boost::spirit::karma::right_align_type right_align;
|
||||
std::string str;
|
||||
std::back_insert_iterator<std::string> sink(str);
|
||||
karma::generate(sink,
|
||||
|
|
|
@ -29,10 +29,6 @@
|
|||
// boost
|
||||
#include <boost/version.hpp>
|
||||
|
||||
// stl
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
color parse_color(std::string const& str)
|
||||
|
@ -45,19 +41,18 @@ color parse_color(std::string const& str,
|
|||
css_color_grammar<std::string::const_iterator> const& g)
|
||||
{
|
||||
color c;
|
||||
|
||||
std::string::const_iterator first = str.begin();
|
||||
std::string::const_iterator last = str.end();
|
||||
|
||||
boost::spirit::ascii::space_type space;
|
||||
// boost 1.41 -> 1.44 compatibility, to be removed in mapnik 2.1 (dane)
|
||||
#if BOOST_VERSION >= 104500
|
||||
bool result = boost::spirit::qi::phrase_parse(first, last, g,
|
||||
boost::spirit::ascii::space,
|
||||
space,
|
||||
c);
|
||||
#else
|
||||
mapnik::css css_;
|
||||
bool result = boost::spirit::qi::phrase_parse(first, last, g,
|
||||
boost::spirit::ascii::space,
|
||||
space,
|
||||
css_);
|
||||
c.set_red(css_.r);
|
||||
c.set_green(css_.g);
|
||||
|
@ -67,9 +62,13 @@ color parse_color(std::string const& str,
|
|||
#endif
|
||||
|
||||
if (result && (first == last))
|
||||
{
|
||||
return c;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw config_error( "Failed to parse color: \"" + str + "\"" );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,12 +58,12 @@ namespace util {
|
|||
|
||||
using namespace boost::spirit;
|
||||
|
||||
BOOST_SPIRIT_AUTO(qi, INTEGER, qi::int_)
|
||||
BOOST_SPIRIT_AUTO(qi, INTEGER, qi::int_type())
|
||||
#ifdef BIGINT
|
||||
BOOST_SPIRIT_AUTO(qi, LONGLONG, qi::long_long)
|
||||
BOOST_SPIRIT_AUTO(qi, LONGLONG, qi::long_long_type())
|
||||
#endif
|
||||
BOOST_SPIRIT_AUTO(qi, FLOAT, qi::float_)
|
||||
BOOST_SPIRIT_AUTO(qi, DOUBLE, qi::double_)
|
||||
BOOST_SPIRIT_AUTO(qi, FLOAT, qi::float_type())
|
||||
BOOST_SPIRIT_AUTO(qi, DOUBLE, qi::double_type())
|
||||
|
||||
struct bool_symbols : qi::symbols<char,bool>
|
||||
{
|
||||
|
@ -82,75 +82,85 @@ struct bool_symbols : qi::symbols<char,bool>
|
|||
|
||||
bool string2bool(const char * iter, const char * end, bool & result)
|
||||
{
|
||||
using boost::spirit::qi::no_case;
|
||||
bool r = qi::phrase_parse(iter,end, no_case[bool_symbols()] ,ascii::space,result);
|
||||
boost::spirit::qi::no_case_type no_case;
|
||||
ascii::space_type space;
|
||||
bool r = qi::phrase_parse(iter,end,no_case[bool_symbols()],space,result);
|
||||
return r && (iter == end);
|
||||
}
|
||||
|
||||
bool string2bool(std::string const& value, bool & result)
|
||||
{
|
||||
using boost::spirit::qi::no_case;
|
||||
boost::spirit::qi::no_case_type no_case;
|
||||
ascii::space_type space;
|
||||
std::string::const_iterator str_beg = value.begin();
|
||||
std::string::const_iterator str_end = value.end();
|
||||
bool r = qi::phrase_parse(str_beg,str_end,no_case[bool_symbols()],ascii::space,result);
|
||||
bool r = qi::phrase_parse(str_beg,str_end,no_case[bool_symbols()],space,result);
|
||||
return r && (str_beg == str_end);
|
||||
}
|
||||
|
||||
bool string2int(const char * iter, const char * end, int & result)
|
||||
{
|
||||
bool r = qi::phrase_parse(iter,end,INTEGER,ascii::space,result);
|
||||
ascii::space_type space;
|
||||
bool r = qi::phrase_parse(iter,end,INTEGER,space,result);
|
||||
return r && (iter == end);
|
||||
}
|
||||
|
||||
bool string2int(std::string const& value, int & result)
|
||||
{
|
||||
ascii::space_type space;
|
||||
std::string::const_iterator str_beg = value.begin();
|
||||
std::string::const_iterator str_end = value.end();
|
||||
bool r = qi::phrase_parse(str_beg,str_end,INTEGER,ascii::space,result);
|
||||
bool r = qi::phrase_parse(str_beg,str_end,INTEGER,space,result);
|
||||
return r && (str_beg == str_end);
|
||||
}
|
||||
|
||||
#ifdef BIGINT
|
||||
bool string2int(const char * iter, const char * end, mapnik::value_integer & result)
|
||||
{
|
||||
bool r = qi::phrase_parse(iter,end,LONGLONG,ascii::space,result);
|
||||
ascii::space_type space;
|
||||
bool r = qi::phrase_parse(iter,end,LONGLONG,space,result);
|
||||
return r && (iter == end);
|
||||
}
|
||||
|
||||
bool string2int(std::string const& value, mapnik::value_integer & result)
|
||||
{
|
||||
ascii::space_type space;
|
||||
std::string::const_iterator str_beg = value.begin();
|
||||
std::string::const_iterator str_end = value.end();
|
||||
bool r = qi::phrase_parse(str_beg,str_end,LONGLONG,ascii::space,result);
|
||||
bool r = qi::phrase_parse(str_beg,str_end,LONGLONG,space,result);
|
||||
return r && (str_beg == str_end);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool string2double(std::string const& value, double & result)
|
||||
{
|
||||
ascii::space_type space;
|
||||
std::string::const_iterator str_beg = value.begin();
|
||||
std::string::const_iterator str_end = value.end();
|
||||
bool r = qi::phrase_parse(str_beg,str_end,DOUBLE,ascii::space,result);
|
||||
bool r = qi::phrase_parse(str_beg,str_end,DOUBLE,space,result);
|
||||
return r && (str_beg == str_end);
|
||||
}
|
||||
|
||||
bool string2double(const char * iter, const char * end, double & result)
|
||||
{
|
||||
bool r = qi::phrase_parse(iter,end,DOUBLE,ascii::space,result);
|
||||
ascii::space_type space;
|
||||
bool r = qi::phrase_parse(iter,end,DOUBLE,space,result);
|
||||
return r && (iter == end);
|
||||
}
|
||||
|
||||
bool string2float(std::string const& value, float & result)
|
||||
{
|
||||
ascii::space_type space;
|
||||
std::string::const_iterator str_beg = value.begin();
|
||||
std::string::const_iterator str_end = value.end();
|
||||
bool r = qi::phrase_parse(str_beg,str_end,FLOAT,ascii::space,result);
|
||||
bool r = qi::phrase_parse(str_beg,str_end,FLOAT,space,result);
|
||||
return r && (str_beg == str_end);
|
||||
}
|
||||
|
||||
bool string2float(const char * iter, const char * end, float & result)
|
||||
{
|
||||
bool r = qi::phrase_parse(iter,end,FLOAT,ascii::space,result);
|
||||
ascii::space_type space;
|
||||
bool r = qi::phrase_parse(iter,end,FLOAT,space,result);
|
||||
return r && (iter == end);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,11 @@ expression_ptr parse_expression(std::string const& str, std::string const& encod
|
|||
expression_ptr parse_expression(std::string const& str,
|
||||
mapnik::expression_grammar<std::string::const_iterator> const& g)
|
||||
{
|
||||
boost::spirit::standard_wide::space_type space;
|
||||
expression_ptr node = std::make_shared<expr_node>();
|
||||
std::string::const_iterator itr = str.begin();
|
||||
std::string::const_iterator end = str.end();
|
||||
bool r = boost::spirit::qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, *node);
|
||||
bool r = boost::spirit::qi::phrase_parse(itr, end, g, space, *node);
|
||||
if (r && itr == end)
|
||||
{
|
||||
return node;
|
||||
|
|
|
@ -21,6 +21,16 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#if defined(SVG_RENDERER)
|
||||
// FIXME: workaround incompatibility of karma with -DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1
|
||||
/*
|
||||
boost/spirit/repository/home/karma/directive/confix.hpp:49:23: error: no member named
|
||||
'confix' in namespace 'boost::spirit::repository'
|
||||
using repository::confix;
|
||||
*/
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#endif
|
||||
|
||||
#include <mapnik/feature_style_processor_impl.hpp>
|
||||
#include <mapnik/agg_renderer.hpp>
|
||||
#include <mapnik/graphics.hpp>
|
||||
|
|
|
@ -38,28 +38,26 @@ template <typename Iterator, typename ContType>
|
|||
image_filter_grammar<Iterator,ContType>::image_filter_grammar()
|
||||
: image_filter_grammar::base_type(start)
|
||||
{
|
||||
using qi::lit;
|
||||
using qi::_val;
|
||||
using qi::_1;
|
||||
using qi::_a;
|
||||
using qi::_b;
|
||||
using qi::_c;
|
||||
using qi::_d;
|
||||
using qi::_e;
|
||||
using qi::_f;
|
||||
using qi::_g;
|
||||
using qi::_h;
|
||||
using qi::_r1;
|
||||
using qi::eps;
|
||||
using qi::char_;
|
||||
using qi::lexeme;
|
||||
using qi::double_;
|
||||
using boost::spirit::ascii::string;
|
||||
qi::lit_type lit;
|
||||
qi::_val_type _val;
|
||||
qi::_1_type _1;
|
||||
qi::_a_type _a;
|
||||
qi::_b_type _b;
|
||||
qi::_c_type _c;
|
||||
qi::_d_type _d;
|
||||
qi::_e_type _e;
|
||||
qi::_f_type _f;
|
||||
qi::_g_type _g;
|
||||
qi::_h_type _h;
|
||||
qi::_r1_type _r1;
|
||||
qi::eps_type eps;
|
||||
qi::char_type char_;
|
||||
qi::double_type double_;
|
||||
using phoenix::push_back;
|
||||
using phoenix::construct;
|
||||
using phoenix::at_c;
|
||||
#if BOOST_VERSION >= 104700
|
||||
using qi::no_skip;
|
||||
qi::no_skip_type no_skip;
|
||||
start = -(filter % no_skip[*char_(", ")])
|
||||
;
|
||||
#else
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace filter {
|
|||
|
||||
bool generate_image_filters(std::back_insert_iterator<std::string>& sink, std::vector<filter_type> const& filters)
|
||||
{
|
||||
using boost::spirit::karma::stream;
|
||||
boost::spirit::karma::stream_type stream;
|
||||
using boost::spirit::karma::generate;
|
||||
bool r = generate(sink, stream % ' ', filters);
|
||||
return r;
|
||||
|
@ -48,9 +48,10 @@ bool parse_image_filters(std::string const& filters, std::vector<filter_type>& i
|
|||
std::string::const_iterator end = filters.end();
|
||||
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,
|
||||
filter_grammar,
|
||||
boost::spirit::qi::ascii::space,
|
||||
space,
|
||||
image_filters);
|
||||
return r && itr==end;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ namespace mapnik { namespace json {
|
|||
{
|
||||
#if BOOST_VERSION >= 104700
|
||||
using namespace boost::spirit;
|
||||
return qi::phrase_parse(first, last, *grammar_, standard_wide::space, features);
|
||||
standard_wide::space_type space;
|
||||
return qi::phrase_parse(first, last, *grammar_, space, features);
|
||||
#else
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
|
|
|
@ -38,30 +38,26 @@ feature_grammar<Iterator,FeatureType>::feature_grammar(generic_json<Iterator> &
|
|||
json_(json),
|
||||
put_property_(put_property(tr))
|
||||
{
|
||||
using qi::lit;
|
||||
using qi::long_long;
|
||||
using qi::double_;
|
||||
qi::lit_type lit;
|
||||
qi::long_long_type long_long;
|
||||
qi::double_type double_;
|
||||
#if BOOST_VERSION > 104200
|
||||
using qi::no_skip;
|
||||
qi::no_skip_type no_skip;
|
||||
#else
|
||||
using qi::lexeme;
|
||||
qi::lexeme_type lexeme;
|
||||
#endif
|
||||
using standard_wide::char_;
|
||||
using qi::_val;
|
||||
using qi::_1;
|
||||
using qi::_2;
|
||||
using qi::_3;
|
||||
using qi::_4;
|
||||
using qi::_a;
|
||||
using qi::_b;
|
||||
using qi::_r1;
|
||||
using qi::_r2;
|
||||
standard_wide::char_type char_;
|
||||
qi::_val_type _val;
|
||||
qi::_1_type _1;
|
||||
qi::_2_type _2;
|
||||
qi::_3_type _3;
|
||||
qi::_4_type _4;
|
||||
qi::_a_type _a;
|
||||
qi::_r1_type _r1;
|
||||
qi::eps_type eps;
|
||||
|
||||
using qi::fail;
|
||||
using qi::on_error;
|
||||
using qi::_pass;
|
||||
using qi::eps;
|
||||
using qi::raw;
|
||||
|
||||
using phoenix::new_;
|
||||
using phoenix::push_back;
|
||||
using phoenix::construct;
|
||||
|
|
|
@ -47,7 +47,8 @@ namespace mapnik { namespace json {
|
|||
{
|
||||
#if BOOST_VERSION >= 104700
|
||||
using namespace boost::spirit;
|
||||
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(f)), standard_wide::space);
|
||||
standard_wide::space_type space;
|
||||
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(f)), space);
|
||||
#else
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
|
|
|
@ -41,20 +41,18 @@ geometry_grammar<Iterator>::geometry_grammar()
|
|||
: geometry_grammar::base_type(geometry,"geometry")
|
||||
{
|
||||
|
||||
using qi::lit;
|
||||
using qi::int_;
|
||||
using qi::double_;
|
||||
using qi::_val;
|
||||
using qi::_1;
|
||||
using qi::_2;
|
||||
using qi::_3;
|
||||
using qi::_4;
|
||||
using qi::_a;
|
||||
using qi::_b;
|
||||
using qi::_r1;
|
||||
using qi::_r2;
|
||||
using qi::eps;
|
||||
using qi::_pass;
|
||||
qi::lit_type lit;
|
||||
qi::int_type int_;
|
||||
qi::double_type double_;
|
||||
qi::_1_type _1;
|
||||
qi::_2_type _2;
|
||||
qi::_3_type _3;
|
||||
qi::_4_type _4;
|
||||
qi::_a_type _a;
|
||||
qi::_r1_type _r1;
|
||||
qi::_r2_type _r2;
|
||||
qi::eps_type eps;
|
||||
qi::_pass_type _pass;
|
||||
using qi::fail;
|
||||
using qi::on_error;
|
||||
using boost::phoenix::new_;
|
||||
|
|
|
@ -50,7 +50,8 @@ bool geometry_parser<Iterator>::parse(iterator_type first, iterator_type last, b
|
|||
{
|
||||
#if BOOST_VERSION >= 104700
|
||||
using namespace boost::spirit;
|
||||
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(path)), standard_wide::space);
|
||||
standard_wide::space_type space;
|
||||
return qi::phrase_parse(first, last, (*grammar_)(boost::phoenix::ref(path)), space);
|
||||
#else
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
|
|
|
@ -471,9 +471,10 @@ void map_parser::parse_style(Map & map, xml_node const& sty)
|
|||
std::string filter_str = *direct_filters;
|
||||
std::string::const_iterator itr = filter_str.begin();
|
||||
std::string::const_iterator end = filter_str.end();
|
||||
boost::spirit::qi::ascii::space_type space;
|
||||
bool result = boost::spirit::qi::phrase_parse(itr,end,
|
||||
sty.get_tree().image_filters_grammar,
|
||||
boost::spirit::qi::ascii::space,
|
||||
space,
|
||||
style.direct_image_filters());
|
||||
if (!result || itr!=end)
|
||||
{
|
||||
|
|
|
@ -48,10 +48,10 @@ path_expression_ptr parse_path(std::string const& str,
|
|||
path_expression_grammar<std::string::const_iterator> const& g)
|
||||
{
|
||||
path_expression path;
|
||||
|
||||
boost::spirit::standard_wide::space_type space;
|
||||
std::string::const_iterator itr = str.begin();
|
||||
std::string::const_iterator end = str.end();
|
||||
bool r = qi::phrase_parse(itr, end, g, boost::spirit::standard_wide::space, path);
|
||||
bool r = qi::phrase_parse(itr, end, g, space, path);
|
||||
if (r && itr == end)
|
||||
{
|
||||
return std::make_shared<path_expression>(path); //path;
|
||||
|
|
|
@ -36,13 +36,13 @@ template <typename Iterator>
|
|||
path_expression_grammar<Iterator>::path_expression_grammar()
|
||||
: path_expression_grammar::base_type(expr)
|
||||
{
|
||||
using boost::phoenix::construct;
|
||||
using standard_wide::char_;
|
||||
using qi::_1;
|
||||
using qi::_val;
|
||||
using qi::lit;
|
||||
using qi::lexeme;
|
||||
standard_wide::char_type char_;
|
||||
qi::_1_type _1;
|
||||
qi::_val_type _val;
|
||||
qi::lit_type lit;
|
||||
qi::lexeme_type lexeme;
|
||||
using phoenix::push_back;
|
||||
using boost::phoenix::construct;
|
||||
|
||||
expr =
|
||||
* (
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_generator.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
|
@ -42,6 +43,7 @@ namespace mapnik { namespace svg {
|
|||
template <typename OutputIterator>
|
||||
void svg_generator<OutputIterator>::generate_header()
|
||||
{
|
||||
karma::lit_type lit;
|
||||
karma::generate(output_iterator_, lit("<?xml version=\"1.0\" standalone=\"no\"?>\n"));
|
||||
karma::generate(output_iterator_, lit("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"));
|
||||
}
|
||||
|
@ -50,12 +52,14 @@ namespace mapnik { namespace svg {
|
|||
void svg_generator<OutputIterator>::generate_opening_root(root_output_attributes const& root_attributes)
|
||||
{
|
||||
root_attributes_grammar attributes_grammar;
|
||||
karma::lit_type lit;
|
||||
karma::generate(output_iterator_, lit("<svg ") << attributes_grammar << lit(">\n"), root_attributes);
|
||||
}
|
||||
|
||||
template <typename OutputIterator>
|
||||
void svg_generator<OutputIterator>::generate_closing_root()
|
||||
{
|
||||
karma::lit_type lit;
|
||||
karma::generate(output_iterator_, lit("</svg>"));
|
||||
}
|
||||
|
||||
|
@ -63,6 +67,7 @@ namespace mapnik { namespace svg {
|
|||
void svg_generator<OutputIterator>::generate_rect(rect_output_attributes const& rect_attributes)
|
||||
{
|
||||
rect_attributes_grammar attributes_grammar;
|
||||
karma::lit_type lit;
|
||||
karma::generate(output_iterator_, lit("<rect ") << attributes_grammar << lit("/>\n"), rect_attributes);
|
||||
}
|
||||
|
||||
|
@ -70,6 +75,7 @@ namespace mapnik { namespace svg {
|
|||
void svg_generator<OutputIterator>::generate_opening_group(mapnik::value_integer val)
|
||||
{
|
||||
std::string string_val;
|
||||
karma::lit_type lit;
|
||||
mapnik::util::to_string(string_val,val);
|
||||
karma::generate(output_iterator_, lit("<g id=\"")
|
||||
<< lit(string_val)
|
||||
|
@ -84,6 +90,7 @@ namespace mapnik { namespace svg {
|
|||
template <typename OutputIterator>
|
||||
void svg_generator<OutputIterator>::generate_opening_group(std::string const& val)
|
||||
{
|
||||
karma::lit_type lit;
|
||||
karma::generate(output_iterator_, lit("<g id=\"")
|
||||
<< lit(val)
|
||||
<< lit("\"")
|
||||
|
@ -97,6 +104,7 @@ namespace mapnik { namespace svg {
|
|||
template <typename OutputIterator>
|
||||
void svg_generator<OutputIterator>::generate_closing_group()
|
||||
{
|
||||
karma::lit_type lit;
|
||||
karma::generate(output_iterator_, lit("</g>\n"));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
#include <mapnik/svg/output/svg_output_attributes.hpp>
|
||||
|
||||
namespace mapnik { namespace svg {
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
// FIXME: workaround incompatibility of karma with -DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1
|
||||
/*
|
||||
boost/spirit/repository/home/karma/directive/confix.hpp:49:23: error: no member named
|
||||
'confix' in namespace 'boost::spirit::repository'
|
||||
using repository::confix;
|
||||
*/
|
||||
#undef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/svg/output/svg_renderer.hpp>
|
||||
|
|
|
@ -80,10 +80,12 @@ struct key_value_sequence_ordered
|
|||
key_value_sequence_ordered()
|
||||
: key_value_sequence_ordered::base_type(query)
|
||||
{
|
||||
query = pair >> *( qi::lit(';') >> pair);
|
||||
qi::lit_type lit;
|
||||
qi::char_type char_;
|
||||
query = pair >> *( lit(';') >> pair);
|
||||
pair = key >> -(':' >> value);
|
||||
key = qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9-");
|
||||
value = +(qi::char_ - qi::lit(';'));
|
||||
key = char_("a-zA-Z_") >> *char_("a-zA-Z_0-9-");
|
||||
value = +(char_ - lit(';'));
|
||||
}
|
||||
|
||||
qi::rule<Iterator, pairs_type(), SkipType> query;
|
||||
|
@ -108,6 +110,7 @@ agg::rgba8 parse_color(const char* str)
|
|||
double parse_double(const char* str)
|
||||
{
|
||||
using namespace boost::spirit::qi;
|
||||
qi::double_type double_;
|
||||
double val = 0.0;
|
||||
parse(str, str + std::strlen(str),double_,val);
|
||||
return val;
|
||||
|
@ -121,7 +124,9 @@ double parse_double_optional_percent(const char* str, bool &percent)
|
|||
{
|
||||
using namespace boost::spirit::qi;
|
||||
using boost::phoenix::ref;
|
||||
using qi::_1;
|
||||
qi::_1_type _1;
|
||||
qi::double_type double_;
|
||||
qi::char_type char_;
|
||||
|
||||
double val = 0.0;
|
||||
char unit='\0';
|
||||
|
|
|
@ -39,9 +39,7 @@ namespace mapnik
|
|||
namespace qi = boost::spirit::qi;
|
||||
namespace phoenix = boost::phoenix;
|
||||
using phoenix::push_back;
|
||||
using boost::spirit::ascii::space;
|
||||
using phoenix::ref;
|
||||
using qi::_1;
|
||||
|
||||
bool text_placement_info_simple::next()
|
||||
{
|
||||
|
@ -140,10 +138,13 @@ void text_placements_simple::set_positions(std::string positions)
|
|||
}
|
||||
|
||||
} direction_name;
|
||||
boost::spirit::ascii::space_type space;
|
||||
qi::_1_type _1;
|
||||
qi::float_type float_;
|
||||
|
||||
std::string::iterator first = positions.begin(), last = positions.end();
|
||||
qi::phrase_parse(first, last,
|
||||
(direction_name[push_back(phoenix::ref(direction_), _1)] % ',') >> *(',' >> qi::float_[push_back(phoenix::ref(text_sizes_), _1)]),
|
||||
(direction_name[push_back(phoenix::ref(direction_), _1)] % ',') >> *(',' >> float_[push_back(phoenix::ref(text_sizes_), _1)]),
|
||||
space
|
||||
);
|
||||
if (first != last)
|
||||
|
|
|
@ -39,14 +39,17 @@ transform_expression_grammar<Iterator>::transform_expression_grammar(expression_
|
|||
: transform_expression_grammar::base_type(start)
|
||||
{
|
||||
using boost::phoenix::construct;
|
||||
using qi::_a; using qi::_1; using qi::_4;
|
||||
using qi::_b; using qi::_2; using qi::_5;
|
||||
using qi::_c; using qi::_3; using qi::_6;
|
||||
using qi::_val;
|
||||
using qi::char_;
|
||||
using qi::double_;
|
||||
using qi::lit;
|
||||
using qi::no_case;
|
||||
qi::_1_type _1;
|
||||
qi::_4_type _4;
|
||||
qi::_2_type _2;
|
||||
qi::_5_type _5;
|
||||
qi::_3_type _3;
|
||||
qi::_6_type _6;
|
||||
qi::_val_type _val;
|
||||
qi::char_type char_;
|
||||
qi::double_type double_;
|
||||
qi::lit_type lit;
|
||||
qi::no_case_type no_case;
|
||||
|
||||
// [http://www.w3.org/TR/SVG/coords.html#TransformAttribute]
|
||||
|
||||
|
@ -56,10 +59,10 @@ transform_expression_grammar<Iterator>::transform_expression_grammar(expression_
|
|||
// separated by whitespace and/or a comma.
|
||||
|
||||
#if BOOST_VERSION > 104200
|
||||
using qi::no_skip;
|
||||
qi::no_skip_type no_skip;
|
||||
start = transform_ % no_skip[char_(", ")] ;
|
||||
#else
|
||||
using qi::lexeme;
|
||||
qi::lexeme_type lexeme;
|
||||
start = transform_ % lexeme[char_(", ")] ;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,9 +44,10 @@ wkt_parser::wkt_parser()
|
|||
bool wkt_parser::parse(std::string const& wkt, boost::ptr_vector<geometry_type> & paths)
|
||||
{
|
||||
using namespace boost::spirit;
|
||||
ascii::space_type space;
|
||||
iterator_type first = wkt.begin();
|
||||
iterator_type last = wkt.end();
|
||||
return qi::phrase_parse(first, last, *grammar_, ascii::space, paths);
|
||||
return qi::phrase_parse(first, last, *grammar_, space, paths);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -58,35 +58,35 @@ template <typename OutputIterator, typename Geometry>
|
|||
wkt_generator<OutputIterator, Geometry>::wkt_generator(bool single)
|
||||
: wkt_generator::base_type(wkt)
|
||||
{
|
||||
using boost::spirit::karma::uint_;
|
||||
using boost::spirit::karma::_val;
|
||||
using boost::spirit::karma::_1;
|
||||
using boost::spirit::karma::lit;
|
||||
using boost::spirit::karma::_a;
|
||||
using boost::spirit::karma::_b;
|
||||
using boost::spirit::karma::_c;
|
||||
using boost::spirit::karma::_r1;
|
||||
using boost::spirit::karma::eps;
|
||||
using boost::spirit::karma::string;
|
||||
boost::spirit::karma::uint_type uint_;
|
||||
boost::spirit::karma::_val_type _val;
|
||||
boost::spirit::karma::_1_type _1;
|
||||
boost::spirit::karma::lit_type lit;
|
||||
boost::spirit::karma::_a_type _a;
|
||||
boost::spirit::karma::_b_type _b;
|
||||
boost::spirit::karma::_c_type _c;
|
||||
boost::spirit::karma::_r1_type _r1;
|
||||
boost::spirit::karma::eps_type eps;
|
||||
boost::spirit::karma::string_type kstring;
|
||||
|
||||
wkt = point | linestring | polygon
|
||||
;
|
||||
|
||||
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
|
||||
<< string[ phoenix::if_ (single) [_1 = "Point("]
|
||||
<< kstring[ phoenix::if_ (single) [_1 = "Point("]
|
||||
.else_[_1 = "("]]
|
||||
<< point_coord [_1 = _first(_val)] << lit(')')
|
||||
;
|
||||
|
||||
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
|
||||
<< string[ phoenix::if_ (single) [_1 = "LineString("]
|
||||
<< kstring[ phoenix::if_ (single) [_1 = "LineString("]
|
||||
.else_[_1 = "("]]
|
||||
<< coords
|
||||
<< lit(')')
|
||||
;
|
||||
|
||||
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
|
||||
<< string[ phoenix::if_ (single) [_1 = "Polygon("]
|
||||
<< kstring[ phoenix::if_ (single) [_1 = "Polygon("]
|
||||
.else_[_1 = "("]]
|
||||
<< coords2
|
||||
<< lit("))")
|
||||
|
@ -97,7 +97,7 @@ wkt_generator<OutputIterator, Geometry>::wkt_generator(bool single)
|
|||
|
||||
polygon_coord %= ( &uint_(mapnik::SEG_MOVETO)
|
||||
<< eps[_r1 += 1][_a = _x(_val)][ _b = _y(_val)]
|
||||
<< string[ if_ (_r1 > 1) [_1 = "),("]
|
||||
<< kstring[ if_ (_r1 > 1) [_1 = "),("]
|
||||
.else_[_1 = "("]]
|
||||
|
|
||||
&uint_(mapnik::SEG_LINETO)
|
||||
|
@ -119,11 +119,11 @@ template <typename OutputIterator, typename GeometryContainer>
|
|||
wkt_multi_generator<OutputIterator, GeometryContainer>::wkt_multi_generator()
|
||||
: wkt_multi_generator::base_type(wkt)
|
||||
{
|
||||
using boost::spirit::karma::lit;
|
||||
using boost::spirit::karma::eps;
|
||||
using boost::spirit::karma::_val;
|
||||
using boost::spirit::karma::_1;
|
||||
using boost::spirit::karma::_a;
|
||||
boost::spirit::karma::lit_type lit;
|
||||
boost::spirit::karma::eps_type eps;
|
||||
boost::spirit::karma::_val_type _val;
|
||||
boost::spirit::karma::_1_type _1;
|
||||
boost::spirit::karma::_a_type _a;
|
||||
|
||||
geometry_types.add
|
||||
(mapnik::geometry_type::types::Point,"Point")
|
||||
|
|
Loading…
Reference in a new issue