1 #ifndef BOOST_METAPARSE_V1_TRANSFORM_HPP 2 #define BOOST_METAPARSE_V1_TRANSFORM_HPP 3 4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 // Distributed under the Boost Software License, Version 1.0. 6 // (See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt) 8 9 #include <boost/metaparse/v1/accept.hpp> 10 #include <boost/metaparse/v1/get_result.hpp> 11 #include <boost/metaparse/v1/get_remaining.hpp> 12 #include <boost/metaparse/v1/get_position.hpp> 13 #include <boost/metaparse/v1/unless_error.hpp> 14 15 #include <boost/mpl/eval_if.hpp> 16 17 namespace boost 18 { 19 namespace metaparse 20 { 21 namespace v1 22 { 23 template <class P, class T> 24 struct transform 25 { 26 private: 27 template <class S, class Pos> 28 struct no_error : 29 accept< 30 typename T::template apply< 31 typename get_result<typename P::template apply<S, Pos> >::type 32 >::type, 33 get_remaining<typename P::template apply<S, Pos> >, 34 get_position<typename P::template apply<S, Pos> > 35 > 36 {}; 37 public: 38 typedef transform type; 39 40 template <class S, class Pos> 41 struct apply : 42 unless_error<typename P::template apply<S, Pos>, no_error<S, Pos> > 43 {}; 44 }; 45 } 46 } 47 } 48 49 #endif 50 51