Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2011 Hartmut Kaiser
|
Chris@16
|
3
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 ==============================================================================*/
|
Chris@16
|
7 #if !defined(BOOST_SPIRIT_HANDLES_CONTAINER_DEC_18_2010_0920AM)
|
Chris@16
|
8 #define BOOST_SPIRIT_HANDLES_CONTAINER_DEC_18_2010_0920AM
|
Chris@16
|
9
|
Chris@16
|
10 #if defined(_MSC_VER)
|
Chris@16
|
11 #pragma once
|
Chris@16
|
12 #endif
|
Chris@16
|
13
|
Chris@16
|
14 #include <boost/spirit/home/support/attributes_fwd.hpp>
|
Chris@16
|
15 #include <boost/mpl/bool.hpp>
|
Chris@16
|
16 #include <boost/mpl/or.hpp>
|
Chris@16
|
17 #include <boost/mpl/not.hpp>
|
Chris@16
|
18 #include <boost/mpl/find_if.hpp>
|
Chris@16
|
19 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
20
|
Chris@16
|
21 namespace boost { namespace spirit { namespace traits
|
Chris@16
|
22 {
|
Chris@16
|
23 // Finds out whether a component handles container attributes intrinsically
|
Chris@16
|
24 // (or whether container attributes need to be split up separately).
|
Chris@16
|
25 template <typename T, typename Attribute, typename Context
|
Chris@16
|
26 , typename Iterator, typename Enable>
|
Chris@16
|
27 struct handles_container : mpl::false_ {};
|
Chris@16
|
28
|
Chris@16
|
29 template <typename Subject, typename Attribute, typename Context
|
Chris@16
|
30 , typename Iterator>
|
Chris@16
|
31 struct unary_handles_container
|
Chris@16
|
32 : handles_container<Subject, Attribute, Context, Iterator> {};
|
Chris@16
|
33
|
Chris@16
|
34 template <typename Left, typename Right, typename Attribute
|
Chris@16
|
35 , typename Context, typename Iterator>
|
Chris@16
|
36 struct binary_handles_container
|
Chris@16
|
37 : mpl::or_<
|
Chris@16
|
38 handles_container<Left, Attribute, Context, Iterator>
|
Chris@16
|
39 , handles_container<Right, Attribute, Context, Iterator> >
|
Chris@16
|
40 {};
|
Chris@16
|
41
|
Chris@16
|
42 template <typename Elements, typename Attribute, typename Context
|
Chris@16
|
43 , typename Iterator>
|
Chris@16
|
44 struct nary_handles_container
|
Chris@16
|
45 : mpl::not_<
|
Chris@16
|
46 is_same<
|
Chris@16
|
47 typename mpl::find_if<
|
Chris@16
|
48 Elements, handles_container<mpl::_, Attribute
|
Chris@16
|
49 , Context, Iterator>
|
Chris@16
|
50 >::type
|
Chris@16
|
51 , typename mpl::end<Elements>::type> >
|
Chris@16
|
52 {};
|
Chris@16
|
53 }}}
|
Chris@16
|
54
|
Chris@16
|
55 #endif
|