]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/vmd/doc/vmd_get_type.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / vmd / doc / vmd_get_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_convert_sequence Getting the type of data]
9
10 VMD has the ability to retrieve the type of any data which it can
11 parse, which means any VMD sequence. The macro to do this is called
12 BOOST_VMD_GET_TYPE and it takes a single required parameter, which
13 is a VMD sequence.
14
15 It returns one of the types previously discussed when introducing
16 v-types as an identifier subset. As explained previously in that
17 topic a v-type is fully recognized by VMD macros and can be part
18 of a sequence and passed as VMD data just like all the other data types
19 VMD recognizes.
20
21 When BOOST_VMD_GET_TYPE returns the type of data it returns by default
22 the most specific type that the data can be. This means that non-empty
23 lists and arrays are returned as such, not as tuples, and numbers
24 and types and empty lists are returned as such, not as identifiers.
25
26 #include <boost/vmd/get_type.hpp>
27
28 #define BOOST_VMD_REGISTER_ANID (ANID)
29 #define SEQUENCE_EMPTY
30 #define SEQUENCE_MULTI (1,2,3) 88
31 #define SEQUENCE1 (3,(1,2,3))
32 #define SEQUENCE2 ANID
33 #define SEQUENCE3 (1,(2,(3,BOOST_PP_NIL)))
34 #define SEQUENCE4 1
35 #define SEQUENCE5 (1)(2)(3)
36 #define SEQUENCE6 (1,2,3)
37 #define SEQUENCE7 BOOST_VMD_TYPE_NUMBER
38
39 BOOST_VMD_GET_TYPE(SEQUENCE_EMPTY) will return BOOST_VMD_TYPE_EMPTY
40 BOOST_VMD_GET_TYPE(SEQUENCE_MULTI) will return BOOST_VMD_TYPE_SEQUENCE
41 BOOST_VMD_GET_TYPE(SEQUENCE1) will return BOOST_VMD_TYPE_ARRAY
42 BOOST_VMD_GET_TYPE(SEQUENCE2) will return BOOST_VMD_TYPE_IDENTIFIER
43 BOOST_VMD_GET_TYPE(SEQUENCE3) will return BOOST_VMD_TYPE_LIST
44 BOOST_VMD_GET_TYPE(SEQUENCE4) will return BOOST_VMD_TYPE_NUMBER
45 BOOST_VMD_GET_TYPE(SEQUENCE5) will return BOOST_VMD_TYPE_SEQ
46 BOOST_VMD_GET_TYPE(SEQUENCE6) will return BOOST_VMD_TYPE_TUPLE
47 BOOST_VMD_GET_TYPE(SEQUENCE7) will return BOOST_VMD_TYPE_TYPE
48
49 [heading Usage]
50
51 You can use the general header file:
52
53 #include <boost/vmd/vmd.hpp>
54
55 or you can use the individual header file:
56
57 #include <boost/vmd/get_type.hpp>
58
59 for the BOOST_VMD_GET_TYPE macro.
60
61 [endsect]