1 // Copyright Daniel Wallin 2006. 2 // Copyright Cromwell D. Enage 2017. 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 #ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_QUALIFIER_HPP 8 #define BOOST_PARAMETER_AUX_PREPROCESSOR_QUALIFIER_HPP 9 10 #define BOOST_PARAMETER_QUALIFIER_EAT_in(x) 11 #define BOOST_PARAMETER_QUALIFIER_EAT_out(x) 12 #define BOOST_PARAMETER_QUALIFIER_EAT_in_out(x) 13 #define BOOST_PARAMETER_QUALIFIER_EAT_consume(x) 14 #define BOOST_PARAMETER_QUALIFIER_EAT_move_from(x) 15 #define BOOST_PARAMETER_QUALIFIER_EAT_forward(x) 16 17 #define BOOST_PARAMETER_GET_QUALIFIER_in(x) in_reference 18 #define BOOST_PARAMETER_GET_QUALIFIER_out(x) out_reference 19 #define BOOST_PARAMETER_GET_QUALIFIER_in_out(x) in_out_reference 20 #define BOOST_PARAMETER_GET_QUALIFIER_consume(x) consume_reference 21 #define BOOST_PARAMETER_GET_QUALIFIER_move_from(x) move_from_reference 22 #define BOOST_PARAMETER_GET_QUALIFIER_forward(x) forward_reference 23 24 #define BOOST_PARAMETER_STRIP_QUALIFIER_in(x) x 25 #define BOOST_PARAMETER_STRIP_QUALIFIER_out(x) x 26 #define BOOST_PARAMETER_STRIP_QUALIFIER_in_out(x) x 27 #define BOOST_PARAMETER_STRIP_QUALIFIER_consume(x) x 28 #define BOOST_PARAMETER_STRIP_QUALIFIER_move_from(x) x 29 #define BOOST_PARAMETER_STRIP_QUALIFIER_forward(x) x 30 31 #include <boost/preprocessor/cat.hpp> 32 33 #define BOOST_PARAMETER_GET_QUALIFIER_GET(x) \ 34 BOOST_PP_CAT(BOOST_PARAMETER_GET_QUALIFIER_, x) 35 /**/ 36 37 #define BOOST_PARAMETER_GET_UNQUALIFIED(x) \ 38 BOOST_PP_CAT(BOOST_PARAMETER_STRIP_QUALIFIER_, x) 39 /**/ 40 41 #include <boost/preprocessor/facilities/is_empty.hpp> 42 43 // Expands to 1 if x is either "in(k)", "out(k)", "in_out(k)", "consume(k)", 44 // "move_from(k)", or "forward(k)"; expands to 0 otherwise. 45 #define BOOST_PARAMETER_IS_QUALIFIER(x) \ 46 BOOST_PP_IS_EMPTY(BOOST_PP_CAT(BOOST_PARAMETER_QUALIFIER_EAT_, x)) 47 /**/ 48 49 #include <boost/preprocessor/control/iif.hpp> 50 51 // Expands to the qualifier of x, 52 // where x is either a keyword qualifier or a keyword. 53 // 54 // k => forward_reference 55 // in(k) => in_reference 56 // out(k) => out_reference 57 // in_out(k) => in_out_reference 58 // forward(k) => forward_reference 59 // consume(k) => consume_reference 60 // move_from(k) => move_from_reference 61 #define BOOST_PARAMETER_GET_QUALIFIER(x) \ 62 BOOST_PP_IIF( \ 63 BOOST_PARAMETER_IS_QUALIFIER(x) \ 64 , BOOST_PARAMETER_GET_QUALIFIER_GET(x) \ 65 , forward_reference \ 66 ) 67 /**/ 68 69 // Expands to the unqualified version of x, 70 // where x is either a keyword qualifier or a keyword. 71 // 72 // k => k 73 // in(k) => k 74 // out(k) => k 75 // in_out(k) => k 76 // forward(k) => k 77 // consume(k) => k 78 // move_from(k) => k 79 #define BOOST_PARAMETER_UNQUALIFIED(x) \ 80 BOOST_PP_IIF( \ 81 BOOST_PARAMETER_IS_QUALIFIER(x) \ 82 , BOOST_PARAMETER_GET_UNQUALIFIED(x) \ 83 , x \ 84 ) 85 /**/ 86 87 #endif // include guard 88 89