| 1 | /*============================================================================= |
| 2 | Copyright (c) 2001-2011 Hartmut Kaiser |
| 3 | |
| 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 5 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | ==============================================================================*/ |
| 7 | #if !defined(BOOST_SPIRIT_HAS_SEMANTIC_ACTION_SEP_20_2009_0626PM) |
| 8 | #define BOOST_SPIRIT_HAS_SEMANTIC_ACTION_SEP_20_2009_0626PM |
| 9 | |
| 10 | #if defined(_MSC_VER) |
| 11 | #pragma once |
| 12 | #endif |
| 13 | |
| 14 | #include <boost/mpl/bool.hpp> |
| 15 | #include <boost/mpl/or.hpp> |
| 16 | #include <boost/mpl/not.hpp> |
| 17 | #include <boost/mpl/find_if.hpp> |
| 18 | #include <boost/type_traits/is_same.hpp> |
| 19 | |
| 20 | namespace boost { namespace spirit { namespace traits |
| 21 | { |
| 22 | // finding out, whether a component contains a semantic action |
| 23 | template <typename T, typename Enable = void> |
| 24 | struct has_semantic_action |
| 25 | : mpl::false_ {}; |
| 26 | |
| 27 | template <typename Subject> |
| 28 | struct unary_has_semantic_action |
| 29 | : has_semantic_action<Subject> {}; |
| 30 | |
| 31 | template <typename Left, typename Right> |
| 32 | struct binary_has_semantic_action |
| 33 | : mpl::or_<has_semantic_action<Left>, has_semantic_action<Right> > {}; |
| 34 | |
| 35 | template <typename Elements> |
| 36 | struct nary_has_semantic_action |
| 37 | : mpl::not_< |
| 38 | is_same< |
| 39 | typename mpl::find_if< |
| 40 | Elements, has_semantic_action<mpl::_> |
| 41 | >::type |
| 42 | , typename mpl::end<Elements>::type |
| 43 | > |
| 44 | > {}; |
| 45 | }}} |
| 46 | |
| 47 | #endif |
| 48 | |