/usr/include/mapnik/expression_grammar.hpp is in libmapnik-dev 2.2.0+ds1-7+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | /*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_EXPRESSIONS_GRAMMAR_HPP
#define MAPNIK_EXPRESSIONS_GRAMMAR_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/expression_node.hpp>
// spirit2
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_locals.hpp>
// phoenix
#include <boost/spirit/include/phoenix_function.hpp>
namespace mapnik
{
using namespace boost;
namespace qi = boost::spirit::qi;
namespace standard_wide = boost::spirit::standard_wide;
using standard_wide::space_type;
struct unicode_impl
{
template <typename T>
struct result
{
typedef UnicodeString type;
};
explicit unicode_impl(mapnik::transcoder const& tr)
: tr_(tr) {}
UnicodeString operator()(std::string const& str) const
{
return tr_.transcode(str.c_str());
}
mapnik::transcoder const& tr_;
};
struct regex_match_impl
{
template <typename T0, typename T1>
struct result
{
typedef expr_node 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;
mapnik::transcoder const& tr_;
};
struct regex_replace_impl
{
template <typename T0, typename T1, typename T2>
struct result
{
typedef expr_node 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;
mapnik::transcoder const& tr_;
};
struct geometry_types : qi::symbols<char,mapnik::value_integer>
{
geometry_types()
{
add
("point",1)
("linestring", 2)
("polygon",3)
("collection",4)
;
}
};
template <typename T>
struct integer_parser
{
typedef qi::int_parser<T,10,1,-1> type;
};
template <typename Iterator>
struct expression_grammar : qi::grammar<Iterator, expr_node(), space_type>
{
typedef qi::rule<Iterator, expr_node(), space_type> rule_type;
explicit expression_grammar(mapnik::transcoder const& tr);
qi::real_parser<double, qi::strict_real_policies<double> > strict_double;
typename integer_parser<mapnik::value_integer>::type int__;
boost::phoenix::function<unicode_impl> unicode_;
boost::phoenix::function<regex_match_impl> regex_match_;
boost::phoenix::function<regex_replace_impl> regex_replace_;
rule_type expr;
rule_type equality_expr;
rule_type cond_expr;
rule_type relational_expr;
rule_type logical_expr;
rule_type additive_expr;
rule_type multiplicative_expr;
rule_type unary_expr;
rule_type not_expr;
rule_type primary_expr;
qi::rule<Iterator, std::string() > regex_match_expr;
qi::rule<Iterator, expr_node(expr_node), qi::locals<std::string,std::string>, space_type> regex_replace_expr;
qi::rule<Iterator, std::string() , space_type> attr;
qi::rule<Iterator, std::string(), qi::locals<char> > ustring;
qi::symbols<char const, char const> unesc_char;
qi::rule<Iterator, char() > quote_char;
geometry_types geom_type;
};
} // namespace
#endif // MAPNIK_EXPRESSIONS_GRAMMAR_HPP
|