diff --git a/include/mapnik/expression_grammar_x3_def.hpp b/include/mapnik/expression_grammar_x3_def.hpp index 690224b8f..7fb82a982 100644 --- a/include/mapnik/expression_grammar_x3_def.hpp +++ b/include/mapnik/expression_grammar_x3_def.hpp @@ -209,14 +209,17 @@ struct unary_function_types_ : x3::symbols { unary_function_types_() { - add("sin", sin_impl()) // - ("cos", cos_impl()) // - ("tan", tan_impl()) // - ("atan", atan_impl()) // - ("exp", exp_impl()) // - ("log", log_impl()) // - ("abs", abs_impl()) // - ("length", length_impl()) // + add("sin", sin_impl()) // + ("cos", cos_impl()) // + ("tan", tan_impl()) // + ("atan", atan_impl()) // + ("exp", exp_impl()) // + ("log", log_impl()) // + ("abs", abs_impl()) // + ("length", length_impl()) // + ("int", int_impl()) // + ("float", float_impl()) // + ("str", str_impl()) // ; } } const unary_func_types; diff --git a/include/mapnik/function_call.hpp b/include/mapnik/function_call.hpp index 62e8a401d..91399e376 100644 --- a/include/mapnik/function_call.hpp +++ b/include/mapnik/function_call.hpp @@ -89,6 +89,25 @@ struct length_impl value_type operator()(value_type const& val) const { return val.to_unicode().length(); } }; +// str +struct str_impl +{ + value_type operator()(value_type const& val) const { return val.to_unicode(); } +}; + +// int +struct int_impl +{ + value_type operator()(value_type const& val) const { return val.to_int(); } +}; + +// float +struct float_impl +{ + value_type operator()(value_type const& val) const { return val.to_double(); } +}; + + // min inline value_type min_impl(value_type const& arg1, value_type const& arg2) {