2012-07-24 22:43:32 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
2014-11-20 14:25:50 +00:00
|
|
|
* Copyright (C) 2014 Artem Pavlenko
|
2012-07-24 22:43:32 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
// mapnik
|
|
|
|
#include <mapnik/path_expression_grammar.hpp>
|
|
|
|
#include <mapnik/attribute.hpp>
|
|
|
|
|
|
|
|
// boost
|
|
|
|
#include <boost/spirit/include/phoenix_core.hpp>
|
|
|
|
#include <boost/spirit/include/phoenix_object.hpp>
|
|
|
|
#include <boost/spirit/include/phoenix_stl.hpp>
|
|
|
|
|
|
|
|
namespace mapnik
|
|
|
|
{
|
|
|
|
|
|
|
|
template <typename Iterator>
|
|
|
|
path_expression_grammar<Iterator>::path_expression_grammar()
|
|
|
|
: path_expression_grammar::base_type(expr)
|
|
|
|
{
|
2014-01-26 22:00:58 +00:00
|
|
|
standard_wide::char_type char_;
|
|
|
|
qi::_1_type _1;
|
|
|
|
qi::_val_type _val;
|
|
|
|
qi::lit_type lit;
|
|
|
|
qi::lexeme_type lexeme;
|
2012-07-24 22:43:32 +00:00
|
|
|
using phoenix::push_back;
|
2014-01-26 22:00:58 +00:00
|
|
|
using boost::phoenix::construct;
|
2014-11-20 14:25:50 +00:00
|
|
|
|
2012-07-24 22:43:32 +00:00
|
|
|
expr =
|
|
|
|
* (
|
|
|
|
str [ push_back(_val, _1)]
|
|
|
|
|
|
|
|
|
( '[' >> attr [ push_back(_val, construct<mapnik::attribute>( _1 )) ] >> ']')
|
|
|
|
)
|
|
|
|
;
|
2014-11-20 14:25:50 +00:00
|
|
|
|
2012-07-24 22:43:32 +00:00
|
|
|
attr %= +(char_ - ']');
|
|
|
|
str %= lexeme[+(char_ -'[')];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|