]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/vmd/doc/vmd_type.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / vmd / doc / vmd_type.qbk
1 [/
2 (C) Copyright Edward Diener 2011-2015
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:vmd_type Types]
9
10 A subset of identifiers is VMD types, called a 'v-type'. These are identifiers
11 which represent all of the preprocessor data types which VMD can parse. This subset of
12 identifiers is automatically registered and pre-detected by VMD. Each identifier
13 type begins with the unique prefix 'BOOST_VMD_TYPE_'.
14
15 The actual types are:
16
17 * BOOST_VMD_TYPE_EMPTY, represents emptiness, ie. "empty data"
18 * BOOST_VMD_TYPE_ARRAY, a Boost PP array
19 * BOOST_VMD_TYPE_LIST, a Boost PP list
20 * BOOST_VMD_TYPE_SEQ, a Boost PP seq
21 * BOOST_VMD_TYPE_TUPLE, a Boost PP tuple
22 * BOOST_VMD_TYPE_IDENTIFIER, identifier
23 * BOOST_BMD_TYPE_NUMBER, a number
24 * BOOST_VMD_TYPE_TYPE, a type itself
25 * BOOST_VMD_TYPE_SEQUENCE, a sequence
26 * BOOST_VMD_TYPE_UNKNOWN, an unknown type
27
28 Since a v-type is itself an identifier the particular constraint on the input
29 to test is exactly the same as for identifiers.
30
31 The constraint is that the beginning input character, ignoring any whitespace, passed
32 as the input to test must be either:
33
34 * an identifier character, ie. an alphanumeric or an underscore
35 * the left parenthesis of a tuple
36
37 and if the first character is not the left parenthesis of a tuple
38 the remaining characters must be alphanumeric or an underscore until a space character
39 or end of input occurs.
40
41 If this is not the case the behavior is undefined, and most likely
42 a preprocessing error will occur.
43
44 The macro used to test for a particular type in VMD is called BOOST_VMD_IS_TYPE.
45 The macro takes a single parameter, the input to test against.
46
47 The macro returns 1 if the parameter is a v-type, otherwise the macro returns 0.
48
49 A v-type is also an identifier, which has been registered and pre-detected,
50 so you can also use the VMD functionality which works with identifiers to work with
51 a v-type as an identifier if you like.
52
53 [heading Example]
54
55 Let us look at an example of how to use BOOST_VMD_IS_TYPE.
56
57 #include <boost/vmd/is_type.hpp>
58
59 BOOST_VMD_IS_TYPE(input)
60
61 returns:
62
63 if input = BOOST_VMD_TYPE_SEQ, 1
64 if input = BOOST_VMD_TYPE_NUMBER, 1
65 if input = SQUARE, 0
66 if input = BOOST_VMD_TYPE_IDENTIFIER DATA, 0 since there are tokens after the type
67 if input = %44, does not meet the constraint therefore undefined behavior
68 if input = ( BOOST_VMD_TYPE_EMPTY ), 0 since the macro begins with a tuple and this can be tested for
69
70 [heading Usage]
71
72 To use the BOOST_VMD_IS_TYPE macro either include the general header:
73
74 #include <boost/vmd/vmd.hpp>
75
76 or include the specific header:
77
78 #include <boost/vmd/is_type.hpp>
79
80 [endsect]