]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_METAPARSE_V1_TRANSFORM_ERROR_MESSAGE_HPP |
2 | #define BOOST_METAPARSE_V1_TRANSFORM_ERROR_MESSAGE_HPP | |
3 | ||
4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. | |
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/is_error.hpp> | |
10 | #include <boost/metaparse/v1/reject.hpp> | |
11 | #include <boost/metaparse/v1/get_position.hpp> | |
12 | #include <boost/metaparse/v1/get_message.hpp> | |
13 | ||
14 | #include <boost/mpl/eval_if.hpp> | |
15 | ||
16 | namespace boost | |
17 | { | |
18 | namespace metaparse | |
19 | { | |
20 | namespace v1 | |
21 | { | |
22 | template <class P, class F> | |
23 | struct transform_error_message | |
24 | { | |
25 | template <class R> | |
26 | struct rejection : | |
27 | reject< | |
28 | typename F::template apply<typename get_message<R>::type>::type, | |
29 | get_position<R> | |
30 | > | |
31 | {}; | |
32 | ||
33 | template <class S, class Pos> | |
34 | struct apply : | |
35 | boost::mpl::eval_if< | |
36 | typename is_error<typename P::template apply<S, Pos> >::type, | |
37 | rejection<typename P::template apply<S, Pos> >, | |
38 | typename P::template apply<S, Pos> | |
39 | > | |
40 | {}; | |
41 | ||
42 | typedef transform_error_message type; | |
43 | }; | |
44 | } | |
45 | } | |
46 | } | |
47 | ||
48 | #endif | |
49 |