From 545b32eaf55a9d8db689fad3f547ddbb2accea3d Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 15 Sep 2016 15:41:31 +0200 Subject: [PATCH] refactor path_expression_grammar --- include/mapnik/path_expression_grammar_x3.hpp | 6 +++- .../mapnik/path_expression_grammar_x3_def.hpp | 2 +- src/build.py | 1 + src/parse_path.cpp | 13 ++------ src/path_expression_grammar_x3.cpp | 32 +++++++++++++++++++ 5 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 src/path_expression_grammar_x3.cpp diff --git a/include/mapnik/path_expression_grammar_x3.hpp b/include/mapnik/path_expression_grammar_x3.hpp index 86e811fea..60bfd2bb4 100644 --- a/include/mapnik/path_expression_grammar_x3.hpp +++ b/include/mapnik/path_expression_grammar_x3.hpp @@ -39,6 +39,10 @@ using path_expression_grammar_type = x3::rule #include -#include // stl #include -namespace mapnik { namespace grammar { - -namespace x3 = boost::spirit::x3; -using iterator_type = std::string::const_iterator; -using context_type = x3::phrase_parse_context::type; - -BOOST_SPIRIT_INSTANTIATE(path_expression_grammar_type, iterator_type, context_type); - -} +namespace mapnik { path_expression_ptr parse_path(std::string const& str) { diff --git a/src/path_expression_grammar_x3.cpp b/src/path_expression_grammar_x3.cpp new file mode 100644 index 000000000..fe3bf276d --- /dev/null +++ b/src/path_expression_grammar_x3.cpp @@ -0,0 +1,32 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2016 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 + * + *****************************************************************************/ + +#include + +namespace mapnik { namespace grammar { + +namespace x3 = boost::spirit::x3; +using iterator_type = std::string::const_iterator; +using context_type = x3::phrase_parse_context::type; +BOOST_SPIRIT_INSTANTIATE(path_expression_grammar_type, iterator_type, context_type); + +}}