re-use evaluator object
This commit is contained in:
parent
a1c2bd0d86
commit
06592cedc3
1 changed files with 11 additions and 10 deletions
|
@ -38,6 +38,7 @@
|
|||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T0, typename T1>
|
||||
struct evaluate : boost::static_visitor<T1>
|
||||
{
|
||||
|
@ -79,7 +80,7 @@ struct evaluate : boost::static_visitor<T1>
|
|||
|
||||
value_type operator() (global_attribute const& attr) const
|
||||
{
|
||||
return value_type();// shouldn't get here ? //attr.value<value_type,feature_type>(feature_);
|
||||
return value_type();// shouldn't get here
|
||||
}
|
||||
|
||||
value_type operator() (geometry_type_attribute const& geom) const
|
||||
|
@ -89,22 +90,22 @@ struct evaluate : boost::static_visitor<T1>
|
|||
|
||||
value_type operator() (binary_node<tags::logical_and> const & x) const
|
||||
{
|
||||
return (boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.left).to_bool())
|
||||
&& (boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.right).to_bool());
|
||||
return (boost::apply_visitor(*this, x.left).to_bool())
|
||||
&& (boost::apply_visitor(*this, x.right).to_bool());
|
||||
}
|
||||
|
||||
value_type operator() (binary_node<tags::logical_or> const & x) const
|
||||
{
|
||||
return (boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.left).to_bool())
|
||||
|| (boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.right).to_bool());
|
||||
return (boost::apply_visitor(*this,x.left).to_bool())
|
||||
|| (boost::apply_visitor(*this,x.right).to_bool());
|
||||
}
|
||||
|
||||
template <typename Tag>
|
||||
value_type operator() (binary_node<Tag> const& x) const
|
||||
{
|
||||
typename make_op<Tag>::type operation;
|
||||
return operation(boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.left),
|
||||
boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.right));
|
||||
return operation(boost::apply_visitor(*this, x.left),
|
||||
boost::apply_visitor(*this, x.right));
|
||||
}
|
||||
|
||||
template <typename Tag>
|
||||
|
@ -116,12 +117,12 @@ struct evaluate : boost::static_visitor<T1>
|
|||
|
||||
value_type operator() (unary_node<tags::logical_not> const& x) const
|
||||
{
|
||||
return ! (boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr).to_bool());
|
||||
return ! (boost::apply_visitor(*this,x.expr).to_bool());
|
||||
}
|
||||
|
||||
value_type operator() (regex_match_node const& x) const
|
||||
{
|
||||
value_type v = boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr);
|
||||
value_type v = boost::apply_visitor(*this, x.expr);
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
return boost::u32regex_match(v.to_unicode(),x.pattern);
|
||||
#else
|
||||
|
@ -132,7 +133,7 @@ struct evaluate : boost::static_visitor<T1>
|
|||
|
||||
value_type operator() (regex_replace_node const& x) const
|
||||
{
|
||||
value_type v = boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr);
|
||||
value_type v = boost::apply_visitor(*this, x.expr);
|
||||
#if defined(BOOST_REGEX_HAS_ICU)
|
||||
return boost::u32regex_replace(v.to_unicode(),x.pattern,x.format);
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue