/* openDCM, dimensional constraint manager Copyright (C) 2013 Stefan Troeger 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. */ //move the traits specializations outside of the traits definition to avoid the spirit header parsing every //time this module is included and just parse it in externalisation mode when the generator is build #ifndef DCM_PARSER_TRAITS_IMPL_H #define DCM_PARSER_TRAITS_IMPL_H #include "traits.hpp" #include "defines.hpp" #include #include #include #include #include #include #include #include namespace karma = boost::spirit::karma; namespace qi = boost::spirit::qi; namespace boost { namespace spirit { namespace traits { template <> struct create_generator { typedef BOOST_TYPEOF(karma::eps(false)) type; static type call() { return karma::eps(false); } }; } } } namespace dcm { template struct parser_generate : public mpl::true_ {}; template struct parser_generator { typedef karma::rule generator; static void init(generator& r) { r = karma::lit("clustertype\n") << karma::int_ <<""; }; }; template struct parser_generate : public mpl::true_ {}; template struct parser_generator { typedef karma::rule generator; static void init(generator& r) { r = karma::lit("clusterchanged\n") << karma::bool_ <<""; }; }; template struct parser_generate, System> : public mpl::not_ > {}; template struct parser_generator, System, iterator> { typedef karma::rule generator; static void init(generator& r) { r = karma::lit("id\n") << karma::auto_ <<""; }; }; template struct parser_parse : public mpl::true_ {}; template struct parser_parser { typedef qi::rule parser; static void init(parser& r) { r = qi::lit("clustertype") >> ("") >> qi::int_ >>""; }; }; template struct parser_parse : public mpl::true_ {}; template struct parser_parser { typedef qi::rule parser; static void init(parser& r) { r = qi::lit("clusterchanged") >> ("") >> qi::bool_ >>"" ; }; }; template struct parser_parse, System> : public mpl::not_ > {}; template struct parser_parser, System, iterator> { typedef qi::rule parser; static void init(parser& r) { r = qi::lit("id") >> ("") >> qi::auto_ >>""; }; }; /* template struct parser_generate : public mpl::true_ {}; template struct parser_generator { typedef karma::rule generator; static void init(generator& r) { r = karma::lit("id\n") << karma::int_ <<""; }; }; template struct parser_parse : public mpl::true_ {}; template struct parser_parser { typedef qi::rule parser; static void init(parser& r) { r = qi::lit("id") >> ("") >> qi::int_ >>""; }; };*/ } //namespace dcm #endif //DCM_PARSER_TRAITS_IMPL_H