diff --git a/bindings/python/mapnik_feature.cpp b/bindings/python/mapnik_feature.cpp index 97190546f..f6178a6aa 100644 --- a/bindings/python/mapnik_feature.cpp +++ b/bindings/python/mapnik_feature.cpp @@ -196,9 +196,9 @@ void export_feature() // Python to mapnik::value converters // NOTE: order matters here. For example value_null must be listed before // bool otherwise Py_None will be interpreted as bool (false) - implicitly_convertible(); + implicitly_convertible(); implicitly_convertible(); - implicitly_convertible(); + implicitly_convertible(); implicitly_convertible(); implicitly_convertible(); diff --git a/include/mapnik/expression_grammar.hpp b/include/mapnik/expression_grammar.hpp index 678e9f6ff..a0b3614ec 100644 --- a/include/mapnik/expression_grammar.hpp +++ b/include/mapnik/expression_grammar.hpp @@ -121,6 +121,12 @@ struct geometry_types : qi::symbols } }; +template +struct integer_parser +{ + typedef qi::int_parser type; +}; + template struct expression_grammar : qi::grammar { @@ -129,6 +135,7 @@ struct expression_grammar : qi::grammar explicit expression_grammar(mapnik::transcoder const& tr); qi::real_parser > strict_double; + typename integer_parser::type int__; boost::phoenix::function unicode_; boost::phoenix::function regex_match_; boost::phoenix::function regex_replace_; diff --git a/include/mapnik/json/feature_generator_grammar.hpp b/include/mapnik/json/feature_generator_grammar.hpp index 432fa9a9c..7968d3716 100644 --- a/include/mapnik/json/feature_generator_grammar.hpp +++ b/include/mapnik/json/feature_generator_grammar.hpp @@ -186,8 +186,8 @@ struct feature_generator_grammar: using boost::spirit::karma::lit; using boost::spirit::karma::uint_; using boost::spirit::karma::bool_; - using boost::spirit::karma::int_; - using boost::spirit::karma::long_long; + //using boost::spirit::karma::int_; + //using boost::spirit::karma::long_long; using boost::spirit::karma::double_; using boost::spirit::karma::_val; using boost::spirit::karma::_1; @@ -213,7 +213,7 @@ struct feature_generator_grammar: << value(phoenix::at_c<1>(_val)) ; - value = (value_null_| bool_ | long_long | double_ | ustring)[_1 = value_base_(_r1)] + value = (value_null_| bool_ | int__ | double_ | ustring)[_1 = value_base_(_r1)] ; value_null_ = string[_1 = "null"] @@ -232,6 +232,7 @@ struct feature_generator_grammar: karma::rule value; karma::rule value_null_; karma::rule ustring; + typename karma::int_generator int__; // phoenix functions phoenix::function id_; phoenix::function value_base_; diff --git a/include/mapnik/json/feature_grammar.hpp b/include/mapnik/json/feature_grammar.hpp index 06a4c0311..84175342d 100644 --- a/include/mapnik/json/feature_grammar.hpp +++ b/include/mapnik/json/feature_grammar.hpp @@ -111,6 +111,7 @@ struct feature_grammar : qi::rule value; qi::symbols unesc_char; qi::uint_parser< unsigned, 16, 4, 4 > hex4 ; + qi::int_parser int__; qi::rule string_; qi::rule key_value; qi::rule value_type operator() (value_bool lhs, value_bool rhs) const { - return 0LL; + return value_integer(lhs + rhs); } }; @@ -454,7 +455,7 @@ struct sub : public boost::static_visitor value_type operator() (value_bool lhs, value_bool rhs) const { - return 0LL; + return value_integer(lhs - rhs); } }; @@ -491,7 +492,7 @@ struct mult : public boost::static_visitor value_type operator() (value_bool lhs, value_bool rhs) const { - return 0LL; + return value_integer(0); } }; @@ -599,7 +600,7 @@ struct negate : public boost::static_visitor value_type operator() (value_bool val) const { - return val ? -1LL : 0LL; + return val ? value_integer(-1) : value_integer(0); } value_type operator() (value_unicode_string const& ustr) const @@ -783,9 +784,9 @@ struct to_int : public boost::static_visitor value_integer operator() (std::string const& val) const { value_integer result; - if (util::string2longlong(val,result)) + if (util::string2int(val,result)) return result; - return 0LL; + return value_integer(0); } value_integer operator() (value_unicode_string const& val) const @@ -798,7 +799,7 @@ struct to_int : public boost::static_visitor value_integer operator() (value_null const& val) const { boost::ignore_unused_variable_warning(val); - return 0LL; + return value_integer(0); } }; @@ -886,13 +887,12 @@ public: value_double to_double() const { - return 0.0; - //return boost::apply_visitor(impl::to_double(),base_); + return boost::apply_visitor(impl::to_double(),base_); } value_integer to_int() const { - return 0LL; + return value_integer(0); //return boost::apply_visitor(impl::to_int(),base_); } diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index 5d150064f..c4d7695cf 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -173,7 +173,7 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, Feature & f) } else { - mapnik::value_integer val = 0LL; + mapnik::value_integer val = 0; const char *itr = record_+fields_[col].offset_; const char *end = itr + fields_[col].length_; if (qi::phrase_parse(itr,end,int_,ascii::space,val)) diff --git a/src/expression_grammar.cpp b/src/expression_grammar.cpp index 7f1a6e8db..28d9b0444 100644 --- a/src/expression_grammar.cpp +++ b/src/expression_grammar.cpp @@ -63,13 +63,12 @@ expression_grammar::expression_grammar(mapnik::transcoder const& tr) using qi::lexeme; using qi::_val; using qi::lit; - //using qi::int_; - using qi::long_long; using qi::double_; using qi::hex; using qi::omit; using standard_wide::char_; using standard_wide::no_case; + expr = logical_expr.alias(); logical_expr = not_expr [_val = _1] @@ -139,7 +138,7 @@ expression_grammar::expression_grammar(mapnik::transcoder const& tr) ; primary_expr = strict_double [_val = _1] - | long_long [_val = _1] + | int__[_val = _1] | no_case[lit("true")] [_val = true] | no_case[lit("false")] [_val = false] | no_case[lit("null")] [_val = value_null() ] diff --git a/src/json/feature_grammar.cpp b/src/json/feature_grammar.cpp index f388d032a..4fca07c59 100644 --- a/src/json/feature_grammar.cpp +++ b/src/json/feature_grammar.cpp @@ -90,7 +90,7 @@ feature_grammar::feature_grammar(mapnik::transcoder const& #else number = strict_double #endif - //| long_long + | int__ | lit("true") [_val = true] | lit ("false") [_val = false] | lit("null")[_val = construct()]