+ fix phoenix functions to compile on ubuntu 12.04/c++11
+ cleanups
This commit is contained in:
parent
2b9ce83226
commit
80c5452130
8 changed files with 169 additions and 239 deletions
|
@ -23,11 +23,11 @@
|
|||
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
#define MAPNIK_CSS_COLOR_GRAMMAR_HPP
|
||||
|
||||
#define BOOST_SPIRIT_USE_PHOENIX_V3 1
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/color.hpp>
|
||||
|
||||
#define BOOST_SPIRIT_USE_PHOENIX_V3 1
|
||||
|
||||
// spirit2
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/qi_action.hpp>
|
||||
|
@ -99,13 +99,9 @@ inline int clip_int(int val)
|
|||
|
||||
struct percent_conv_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef unsigned type;
|
||||
};
|
||||
typedef unsigned result_type;
|
||||
|
||||
unsigned operator() (double val) const
|
||||
result_type operator() (double val) const
|
||||
{
|
||||
return clip_int<0,255>(int((255.0 * val)/100.0 + 0.5));
|
||||
}
|
||||
|
@ -113,13 +109,9 @@ struct percent_conv_impl
|
|||
|
||||
struct alpha_conv_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef unsigned type;
|
||||
};
|
||||
typedef unsigned result_type;
|
||||
|
||||
unsigned operator() (double val) const
|
||||
result_type operator() (double val) const
|
||||
{
|
||||
return clip_int<0,255>(int((255.0 * val) + 0.5));
|
||||
}
|
||||
|
@ -127,14 +119,10 @@ struct alpha_conv_impl
|
|||
|
||||
struct hsl_conv_impl
|
||||
{
|
||||
template<typename T0,typename T1, typename T2, typename T3>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
typedef void result_type;
|
||||
|
||||
template <typename T0,typename T1, typename T2, typename T3>
|
||||
void operator() (T0 & c, T1 h, T2 s, T3 l) const
|
||||
result_type operator() (T0 & c, T1 h, T2 s, T3 l) const
|
||||
{
|
||||
double m1,m2;
|
||||
// normalize values
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_DEF_HPP
|
||||
#define MAPNIK_CSS_COLOR_GRAMMAR_DEF_HPP
|
||||
|
||||
#define BOOST_SPIRIT_USE_PHOENIX_V3 1
|
||||
|
||||
// boost
|
||||
#include <boost/version.hpp>
|
||||
|
||||
|
|
|
@ -47,11 +47,7 @@ using standard_wide::space_type;
|
|||
|
||||
struct unicode_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef UnicodeString type;
|
||||
};
|
||||
typedef UnicodeString result_type;
|
||||
|
||||
explicit unicode_impl(mapnik::transcoder const& tr)
|
||||
: tr_(tr) {}
|
||||
|
@ -66,34 +62,27 @@ struct unicode_impl
|
|||
|
||||
struct regex_match_impl
|
||||
{
|
||||
template <typename T0, typename T1>
|
||||
struct result
|
||||
{
|
||||
typedef expr_node type;
|
||||
};
|
||||
|
||||
typedef expr_node result_type;
|
||||
|
||||
explicit regex_match_impl(mapnik::transcoder const& tr)
|
||||
: tr_(tr) {}
|
||||
|
||||
template <typename T0,typename T1>
|
||||
expr_node operator() (T0 & node, T1 const& pattern) const;
|
||||
result_type operator() (T0 & node, T1 const& pattern) const;
|
||||
|
||||
mapnik::transcoder const& tr_;
|
||||
};
|
||||
|
||||
struct regex_replace_impl
|
||||
{
|
||||
template <typename T0, typename T1, typename T2>
|
||||
struct result
|
||||
{
|
||||
typedef expr_node type;
|
||||
};
|
||||
typedef expr_node result_type;
|
||||
|
||||
explicit regex_replace_impl(mapnik::transcoder const& tr)
|
||||
: tr_(tr) {}
|
||||
|
||||
template <typename T0,typename T1,typename T2>
|
||||
expr_node operator() (T0 & node, T1 const& pattern, T2 const& format) const;
|
||||
result_type operator() (T0 & node, T1 const& pattern, T2 const& format) const;
|
||||
|
||||
mapnik::transcoder const& tr_;
|
||||
};
|
||||
|
|
|
@ -69,16 +69,14 @@ public:
|
|||
|
||||
struct put_property
|
||||
{
|
||||
template <typename T0,typename T1, typename T2>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
typedef void result_type;
|
||||
|
||||
explicit put_property(mapnik::transcoder const& tr)
|
||||
: tr_(tr) {}
|
||||
|
||||
template <typename T0,typename T1, typename T2>
|
||||
void operator() (T0 & feature, T1 const& key, T2 const& val) const
|
||||
result_type operator() (T0 & feature, T1 const& key, T2 const& val) const
|
||||
{
|
||||
mapnik::value v = boost::apply_visitor(attribute_value_visitor(tr_),val); // TODO: optimize
|
||||
feature.put_new(key, v);
|
||||
|
@ -89,14 +87,10 @@ struct put_property
|
|||
|
||||
struct extract_geometry
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef boost::ptr_vector<mapnik::geometry_type>& type;
|
||||
};
|
||||
typedef boost::ptr_vector<mapnik::geometry_type>& result_type;
|
||||
|
||||
template <typename T>
|
||||
boost::ptr_vector<mapnik::geometry_type>& operator() (T & feature) const
|
||||
result_type operator() (T & feature) const
|
||||
{
|
||||
return feature.paths();
|
||||
}
|
||||
|
|
|
@ -60,10 +60,8 @@ namespace {
|
|||
|
||||
struct get_type
|
||||
{
|
||||
template <typename T>
|
||||
struct result { typedef int type; };
|
||||
|
||||
int operator() (geometry_type const& geom) const
|
||||
typedef int result_type;
|
||||
result_type operator() (geometry_type const& geom) const
|
||||
{
|
||||
return static_cast<int>(geom.type());
|
||||
}
|
||||
|
@ -71,10 +69,8 @@ struct get_type
|
|||
|
||||
struct get_first
|
||||
{
|
||||
template <typename T>
|
||||
struct result { typedef geometry_type::value_type const type; };
|
||||
|
||||
geometry_type::value_type const operator() (geometry_type const& geom) const
|
||||
typedef geometry_type::value_type const result_type;
|
||||
result_type operator() (geometry_type const& geom) const
|
||||
{
|
||||
geometry_type::value_type coord;
|
||||
boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord));
|
||||
|
@ -84,10 +80,8 @@ struct get_first
|
|||
|
||||
struct multi_geometry_type
|
||||
{
|
||||
template <typename T>
|
||||
struct result { typedef boost::tuple<unsigned,bool> type; };
|
||||
|
||||
boost::tuple<unsigned,bool> operator() (geometry_container const& geom) const
|
||||
typedef boost::tuple<unsigned,bool> result_type;
|
||||
result_type operator() (geometry_container const& geom) const
|
||||
{
|
||||
unsigned type = 0u;
|
||||
bool collection = false;
|
||||
|
|
|
@ -41,14 +41,10 @@ using standard_wide::space_type;
|
|||
|
||||
struct push_vertex
|
||||
{
|
||||
template <typename T0,typename T1, typename T2, typename T3>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
typedef void result_type;
|
||||
|
||||
template <typename T0,typename T1, typename T2, typename T3>
|
||||
void operator() (T0 c, T1 path, T2 x, T3 y) const
|
||||
result_type operator() (T0 c, T1 path, T2 x, T3 y) const
|
||||
{
|
||||
BOOST_ASSERT( path!=0 );
|
||||
path->push_vertex(x,y,c);
|
||||
|
@ -57,14 +53,10 @@ struct push_vertex
|
|||
|
||||
struct close_path
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
typedef void result_type;
|
||||
|
||||
template <typename T>
|
||||
void operator() (T path) const
|
||||
result_type operator() (T path) const
|
||||
{
|
||||
BOOST_ASSERT( path!=0 );
|
||||
path->close_path();
|
||||
|
@ -73,12 +65,7 @@ struct close_path
|
|||
|
||||
struct cleanup
|
||||
{
|
||||
template <typename T0>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
typedef void result_type;
|
||||
template <typename T0>
|
||||
void operator() (T0 & path) const
|
||||
{
|
||||
|
|
|
@ -96,10 +96,8 @@ namespace mapnik { namespace util {
|
|||
template <typename Geometry>
|
||||
struct get_type
|
||||
{
|
||||
template <typename T>
|
||||
struct result { typedef int type; };
|
||||
|
||||
int operator() (Geometry const& geom) const
|
||||
typedef int result_type;
|
||||
result_type operator() (Geometry const& geom) const
|
||||
{
|
||||
return static_cast<int>(geom.type());
|
||||
}
|
||||
|
@ -109,11 +107,8 @@ namespace mapnik { namespace util {
|
|||
struct get_first
|
||||
{
|
||||
typedef T geometry_type;
|
||||
|
||||
template <typename U>
|
||||
struct result { typedef typename geometry_type::value_type const type; };
|
||||
|
||||
typename geometry_type::value_type const operator() (geometry_type const& geom) const
|
||||
typedef typename geometry_type::value_type const result_type;
|
||||
result_type const operator() (geometry_type const& geom) const
|
||||
{
|
||||
typename geometry_type::value_type coord;
|
||||
geom.rewind(0);
|
||||
|
|
|
@ -47,14 +47,9 @@ namespace mapnik { namespace wkt {
|
|||
|
||||
struct push_vertex
|
||||
{
|
||||
typedef void result_type;
|
||||
template <typename T0,typename T1, typename T2, typename T3>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename T0,typename T1, typename T2, typename T3>
|
||||
void operator() (T0 c, T1 path, T2 x, T3 y) const
|
||||
result_type operator() (T0 c, T1 path, T2 x, T3 y) const
|
||||
{
|
||||
BOOST_ASSERT( path!=0 );
|
||||
path->push_vertex(x,y,c);
|
||||
|
@ -63,14 +58,9 @@ namespace mapnik { namespace wkt {
|
|||
|
||||
struct close_path
|
||||
{
|
||||
typedef void result_type;
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void operator() (T path) const
|
||||
result_type operator() (T path) const
|
||||
{
|
||||
BOOST_ASSERT( path!=0 );
|
||||
path->close_path();
|
||||
|
@ -79,12 +69,7 @@ namespace mapnik { namespace wkt {
|
|||
|
||||
struct cleanup
|
||||
{
|
||||
template <typename T0>
|
||||
struct result
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
typedef void result_type;
|
||||
template <typename T0>
|
||||
void operator() (T0 & path) const
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue