]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | (C) Copyright Edward Diener 2011,2012 | |
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt). | |
6 | ] | |
7 | ||
8 | [section:tti_detail Macro Metafunctions] | |
9 | ||
10 | The TTI library uses macros to create metafunctions, in the current scope, | |
11 | for introspecting an inner element by name. Each macro for a particular type of inner | |
12 | element has two forms, the simple one where the first macro parameter designating the | |
13 | 'name' of the inner element is used to create the name of the metafunction, and the | |
14 | complex one where the first macro parameter, called 'trait', designates | |
15 | the name of the metafunction and the second macro parameter designates the 'name' to be | |
16 | introspected. Other than that difference, the two forms of the macro create metafunctions | |
17 | which have the exact same functionality. | |
18 | ||
19 | To use these metafunctions you can include the main general header file 'boost/tti/tti.hpp', | |
20 | unless otherwise noted. Alternatively you can include a specific header file as | |
21 | given in the table below. | |
22 | ||
23 | A table of these macros is given, based on the inner element whose | |
24 | existence the metaprogrammer is introspecting. More detailed explanations | |
25 | and examples for each of the macro metafunctions will follow this | |
26 | section in the documentation. The actual syntax for each macro metafunction | |
27 | can be found in the reference section, and examples of usage for all the | |
28 | macro metafunctions can be found in the | |
29 | [link sectti_usingMM "Using the Macro Metafunctions"] section. | |
30 | ||
31 | In the Template column only the name generated by the simple form | |
32 | of the template is given since the name generated by the complex form is always 'trait' | |
33 | where 'trait' is the first parameter to the corresponding complex form macro. | |
34 | ||
35 | All of the introspecting metafunctions in the table below return a boolean constant | |
36 | called 'value', which specifies whether or not the inner element exists. All of the | |
37 | metafunctions also have a nested type called 'type', which for each one is the type | |
38 | of the boolean constant value. This is always boost::mpl::bool_. | |
39 | ||
40 | [table:tbmacros TTI Macro Metafunctions | |
41 | [ | |
42 | [Inner Element] | |
43 | [Macro] | |
44 | [Template] | |
45 | [Specific Header File] | |
46 | ] | |
47 | [ | |
48 | [Type] | |
49 | [ | |
50 | [macroref BOOST_TTI_HAS_TYPE](name) | |
51 | ] | |
52 | [ | |
53 | `has_type_'name'` | |
54 | ||
55 | class TTI_T = enclosing type | |
56 | ] | |
57 | [[headerref boost/tti/has_type.hpp `has_type.hpp`]] | |
58 | ] | |
59 | [ | |
60 | [Type with lambda expression] | |
61 | [ | |
62 | [macroref BOOST_TTI_HAS_TYPE](name) | |
63 | ] | |
64 | [ | |
65 | `has_type_'name'` | |
66 | ||
67 | class TTI_T = enclosing type | |
68 | ||
69 | class TTI_U = lambda expression invoked with the inner type and returning a boolean constant | |
70 | ] | |
71 | [[headerref boost/tti/has_type.hpp `has_type.hpp`]] | |
72 | ] | |
73 | [ | |
74 | [Class Template ( using variadic macros )] | |
75 | [ | |
76 | [macroref BOOST_TTI_HAS_TEMPLATE](name) | |
77 | ] | |
78 | [ | |
79 | `has_template_'name'` | |
80 | ||
81 | class TTI_T = enclosing type | |
82 | ||
83 | All of the template parameters must be template type parameters ( 'class' or 'typename' parameters ) | |
84 | ] | |
85 | [[headerref boost/tti/has_template.hpp `has_template.hpp`]] | |
86 | ] | |
87 | [ | |
88 | [Class Template ( not using variadic macros )] | |
89 | [ | |
90 | [macroref BOOST_TTI_HAS_TEMPLATE](name,BOOST_PP_NIL) | |
91 | ] | |
92 | [ | |
93 | `has_template_'name'` | |
94 | ||
95 | class TTI_T = enclosing type | |
96 | ||
97 | All of the template parameters must be template type parameters ( 'class' or 'typename' parameters ) | |
98 | ] | |
99 | [[headerref boost/tti/has_template.hpp `has_template.hpp`]] | |
100 | ] | |
101 | [ | |
102 | [Class Template with params ( using variadic macros )] | |
103 | [ | |
104 | [macroref BOOST_TTI_HAS_TEMPLATE](name,...[footnote The template parameters as variadic data.]) | |
105 | ] | |
106 | [ | |
107 | `has_template_'name'` | |
108 | ||
109 | class TTI_T = enclosing type | |
110 | ] | |
111 | [[headerref boost/tti/has_template.hpp `has_template.hpp`]] | |
112 | ] | |
113 | [ | |
114 | [Class Template with params] | |
115 | [ | |
116 | [macroref BOOST_TTI_HAS_TEMPLATE](name,ppArray[footnote The template parameters as the tuple part of the PP array.]) | |
117 | ] | |
118 | [ | |
119 | `has_template_'name'` | |
120 | ||
121 | class TTI_T = enclosing type | |
122 | ] | |
123 | [[headerref boost/tti/has_template.hpp `has_template.hpp`]] | |
124 | ] | |
125 | [ | |
126 | [Member data] | |
127 | [ | |
128 | [macroref BOOST_TTI_HAS_MEMBER_DATA](name) | |
129 | ] | |
130 | [ | |
131 | `has_member_data_'name'` | |
132 | ||
133 | class TTI_T = enclosing type | |
134 | OR | |
135 | pointer to member data ( 'MemberData_Type Enclosing_Type::*' ) | |
136 | ||
137 | class TTI_R = (optional) data type | |
138 | If the first parameter is the pointer to member data this must not be specified. | |
139 | ] | |
140 | [[headerref boost/tti/has_member_data.hpp `has_member_data.hpp`]] | |
141 | ] | |
142 | [ | |
143 | [Member function] | |
144 | [ | |
145 | [macroref BOOST_TTI_HAS_MEMBER_FUNCTION](name) | |
146 | ] | |
147 | [ | |
148 | `has_member_function_'name'` | |
149 | ||
150 | class TTI_T = enclosing type | |
151 | OR | |
152 | pointer to member function | |
153 | ( 'Return_Type Enclosing_Type::* ( Zero or more comma-separated parameter types )' ) | |
154 | ||
155 | class TTI_R = (optional) return type if the first parameter is the enclosing type. | |
156 | If the first parameter is the pointer to member function this must not be specified. | |
157 | ||
158 | class TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. | |
159 | If the first parameter is the pointer to member function this must not be specified. | |
160 | If there are no function parameters this does not have to be specified. | |
161 | Defaults to boost::mpl::vector<>. | |
162 | ||
163 | class TTI_TAG = (optional) Boost `function_types` tag type. | |
164 | If the first parameter is the pointer to member function this must not be specified. | |
165 | Defaults to `boost::function_types::null_tag`. | |
166 | ] | |
167 | [[headerref boost/tti/has_member_function.hpp `has_member_function.hpp`]] | |
168 | ] | |
169 | [ | |
170 | [Static member data] | |
171 | [ | |
172 | [macroref BOOST_TTI_HAS_STATIC_MEMBER_DATA](name) | |
173 | ] | |
174 | [ | |
175 | `has_static_member_data_'name'` | |
176 | ||
177 | class TTI_T = enclosing type | |
178 | ||
179 | class TTI_Type = data type | |
180 | ] | |
181 | [[headerref boost/tti/has_static_member_data.hpp `has_static_member_data.hpp`]] | |
182 | ] | |
183 | [ | |
184 | [Static member function] | |
185 | [ | |
186 | [macroref BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION](name) | |
187 | ] | |
188 | [ | |
189 | `has_static_member_function_'name'` | |
190 | ||
191 | class TTI_T = enclosing type | |
192 | ||
193 | class TTI_R = return type | |
194 | OR | |
195 | function type ( 'Return_Type (Zero or more comma-separated parameter types)' ) | |
196 | ||
197 | class TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. | |
198 | If the second parameter is the function type this must not be specified. | |
199 | If there are no function parameters, this does not have to be specified. | |
200 | Defaults to boost::mpl::vector<>. | |
201 | ||
202 | class TTI_TAG = (optional) Boost `function_types` tag type. | |
203 | If the second parameter is the function type this must not be specified. | |
204 | Defaults to `boost::function_types::null_tag`. | |
205 | ] | |
206 | [[headerref boost/tti/has_static_member_function.hpp `has_static_member_function.hpp`]] | |
207 | ] | |
208 | [ | |
209 | [Data, either member data or static member data] | |
210 | [ | |
211 | [macroref BOOST_TTI_HAS_DATA](name) | |
212 | ] | |
213 | [ | |
214 | `has_data_'name'` | |
215 | ||
216 | class TTI_T = enclosing type | |
217 | ||
218 | class TTI_Type = data type | |
219 | ] | |
220 | [[headerref boost/tti/has_data.hpp `has_data.hpp`]] | |
221 | ] | |
222 | [ | |
223 | [Function, either member function or static member function] | |
224 | [ | |
225 | [macroref BOOST_TTI_HAS_FUNCTION](name) | |
226 | ] | |
227 | [ | |
228 | `has_function_'name'` | |
229 | ||
230 | class TTI_T = enclosing type | |
231 | ||
232 | class TTI_R = return type | |
233 | ||
234 | class TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. | |
235 | If there are no function parameters, this does not have to be specified. | |
236 | Defaults to boost::mpl::vector<>. | |
237 | ||
238 | class TTI_TAG = (optional) Boost `function_types` tag type. | |
239 | Defaults to `boost::function_types::null_tag`. | |
240 | ] | |
241 | [[headerref boost/tti/has_function.hpp `has_function.hpp`]] | |
242 | ] | |
243 | ] | |
244 | ||
245 | [endsect] |