Chris@16
|
1
|
Chris@16
|
2 // (C) Copyright Edward Diener 2012,2013
|
Chris@16
|
3 // Use, modification and distribution are subject to the Boost Software License,
|
Chris@16
|
4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 // http://www.boost.org/LICENSE_1_0.txt).
|
Chris@16
|
6
|
Chris@16
|
7 #if !defined(BOOST_TTI_HAS_DATA_HPP)
|
Chris@16
|
8 #define BOOST_TTI_HAS_DATA_HPP
|
Chris@16
|
9
|
Chris@16
|
10 #include <boost/preprocessor/cat.hpp>
|
Chris@16
|
11 #include <boost/type_traits/remove_const.hpp>
|
Chris@16
|
12 #include <boost/tti/gen/has_data_gen.hpp>
|
Chris@16
|
13 #include <boost/tti/detail/ddata.hpp>
|
Chris@16
|
14
|
Chris@16
|
15 /*
|
Chris@16
|
16
|
Chris@16
|
17 The succeeding comments in this file are in doxygen format.
|
Chris@16
|
18
|
Chris@16
|
19 */
|
Chris@16
|
20
|
Chris@16
|
21 /** \file
|
Chris@16
|
22 */
|
Chris@16
|
23
|
Chris@16
|
24 /// Expands to a metafunction which tests whether member data or static member with a particular name and type exists.
|
Chris@16
|
25 /**
|
Chris@16
|
26
|
Chris@16
|
27 trait = the name of the metafunction.
|
Chris@16
|
28
|
Chris@16
|
29 name = the name of the inner member to introspect.
|
Chris@16
|
30
|
Chris@16
|
31 generates a metafunction called "trait" where 'trait' is the macro parameter.
|
Chris@16
|
32
|
Chris@16
|
33 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE>
|
Chris@16
|
34 struct trait
|
Chris@16
|
35 {
|
Chris@16
|
36 static const value = unspecified;
|
Chris@16
|
37 typedef mpl::bool_<true-or-false> type;
|
Chris@16
|
38 };
|
Chris@16
|
39
|
Chris@16
|
40 The metafunction types and return:
|
Chris@16
|
41
|
Chris@16
|
42 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'
|
Chris@16
|
43
|
Chris@16
|
44 BOOST_TTI_TP_TYPE = The type of the member data or static member.
|
Chris@16
|
45
|
Chris@16
|
46 returns = 'value' is true if the 'name' exists, with the correct data type,
|
Chris@16
|
47 otherwise 'value' is false.
|
Chris@16
|
48
|
Chris@16
|
49 */
|
Chris@16
|
50 #define BOOST_TTI_TRAIT_HAS_DATA(trait,name) \
|
Chris@16
|
51 BOOST_TTI_DETAIL_TRAIT_HAS_DATA(trait,name) \
|
Chris@16
|
52 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE> \
|
Chris@16
|
53 struct trait : \
|
Chris@16
|
54 BOOST_PP_CAT(trait,_detail_hd) \
|
Chris@16
|
55 < \
|
Chris@16
|
56 typename boost::remove_const<BOOST_TTI_TP_T>::type, \
|
Chris@16
|
57 BOOST_TTI_TP_TYPE \
|
Chris@16
|
58 > \
|
Chris@16
|
59 { \
|
Chris@16
|
60 }; \
|
Chris@16
|
61 /**/
|
Chris@16
|
62
|
Chris@16
|
63 /// Expands to a metafunction which tests whether member data or static member data with a particular name and type exists.
|
Chris@16
|
64 /**
|
Chris@16
|
65
|
Chris@16
|
66 name = the name of the inner member.
|
Chris@16
|
67
|
Chris@16
|
68 generates a metafunction called "has_data_name" where 'name' is the macro parameter.
|
Chris@16
|
69
|
Chris@16
|
70 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_TYPE>
|
Chris@16
|
71 struct has_data_name
|
Chris@16
|
72 {
|
Chris@16
|
73 static const value = unspecified;
|
Chris@16
|
74 typedef mpl::bool_<true-or-false> type;
|
Chris@16
|
75 };
|
Chris@16
|
76
|
Chris@16
|
77 The metafunction types and return:
|
Chris@16
|
78
|
Chris@16
|
79 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'
|
Chris@16
|
80
|
Chris@16
|
81 BOOST_TTI_TP_TYPE = The type of the member data or static member.
|
Chris@16
|
82
|
Chris@16
|
83 returns = 'value' is true if the 'name' exists, with the correct data type,
|
Chris@16
|
84 otherwise 'value' is false.
|
Chris@16
|
85
|
Chris@16
|
86 */
|
Chris@16
|
87 #define BOOST_TTI_HAS_DATA(name) \
|
Chris@16
|
88 BOOST_TTI_TRAIT_HAS_DATA \
|
Chris@16
|
89 ( \
|
Chris@16
|
90 BOOST_TTI_HAS_DATA_GEN(name), \
|
Chris@16
|
91 name \
|
Chris@16
|
92 ) \
|
Chris@16
|
93 /**/
|
Chris@16
|
94
|
Chris@16
|
95 #endif // BOOST_TTI_HAS_DATA_HPP
|