| 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_NAME_060806_HPP |
| 8 | #define BOOST_PARAMETER_NAME_060806_HPP |
| 9 | |
| 10 | #include <boost/parameter/aux_/name.hpp> |
| 11 | #include <boost/preprocessor/stringize.hpp> |
| 12 | #include <boost/config.hpp> |
| 13 | |
| 14 | #if defined(BOOST_PARAMETER_CAN_USE_MP11) |
| 15 | #define BOOST_PARAMETER_NAME_TAG(tag_namespace, tag, q) \ |
| 16 | namespace tag_namespace \ |
| 17 | { \ |
| 18 | struct tag \ |
| 19 | { \ |
| 20 | static BOOST_CONSTEXPR char const* keyword_name() \ |
| 21 | { \ |
| 22 | return BOOST_PP_STRINGIZE(tag); \ |
| 23 | } \ |
| 24 | using _ = BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE(tag); \ |
| 25 | using _1 = _; \ |
| 26 | BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_BINDING(binding_fn, tag); \ |
| 27 | BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_VALUE(fn, tag); \ |
| 28 | using qualifier = ::boost::parameter::q; \ |
| 29 | }; \ |
| 30 | } |
| 31 | /**/ |
| 32 | #else // !defined(BOOST_PARAMETER_CAN_USE_MP11) |
| 33 | #define BOOST_PARAMETER_NAME_TAG(tag_namespace, tag, q) \ |
| 34 | namespace tag_namespace \ |
| 35 | { \ |
| 36 | struct tag \ |
| 37 | { \ |
| 38 | static BOOST_CONSTEXPR char const* keyword_name() \ |
| 39 | { \ |
| 40 | return BOOST_PP_STRINGIZE(tag); \ |
| 41 | } \ |
| 42 | typedef BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE(tag) _; \ |
| 43 | typedef BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE(tag) _1; \ |
| 44 | typedef ::boost::parameter::q qualifier; \ |
| 45 | }; \ |
| 46 | } |
| 47 | /**/ |
| 48 | #endif // BOOST_PARAMETER_CAN_USE_MP11 |
| 49 | |
| 50 | #include <boost/parameter/keyword.hpp> |
| 51 | |
| 52 | #define BOOST_PARAMETER_NAME_KEYWORD(tag_namespace, tag, name) \ |
| 53 | namespace \ |
| 54 | { \ |
| 55 | ::boost::parameter::keyword<tag_namespace::tag> const& name \ |
| 56 | = ::boost::parameter::keyword<tag_namespace::tag>::instance; \ |
| 57 | } |
| 58 | /**/ |
| 59 | |
| 60 | #define BOOST_PARAMETER_BASIC_NAME(tag_namespace, tag, qualifier, name) \ |
| 61 | BOOST_PARAMETER_NAME_TAG(tag_namespace, tag, qualifier) \ |
| 62 | BOOST_PARAMETER_NAME_KEYWORD(tag_namespace, tag, name) |
| 63 | /**/ |
| 64 | |
| 65 | #define BOOST_PARAMETER_COMPLEX_NAME_TUPLE1(object, namespace) \ |
| 66 | (object, namespace), ~ |
| 67 | /**/ |
| 68 | |
| 69 | #include <boost/preprocessor/tuple/elem.hpp> |
| 70 | |
| 71 | #define BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name) \ |
| 72 | BOOST_PP_TUPLE_ELEM(2, 0, (BOOST_PARAMETER_COMPLEX_NAME_TUPLE1 name)) |
| 73 | /**/ |
| 74 | |
| 75 | #define BOOST_PARAMETER_COMPLEX_NAME_OBJECT(name) \ |
| 76 | BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name)) |
| 77 | /**/ |
| 78 | |
| 79 | #define BOOST_PARAMETER_COMPLEX_NAME_NAMESPACE(name) \ |
| 80 | BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name)) |
| 81 | /**/ |
| 82 | |
| 83 | #include <boost/parameter/aux_/preprocessor/qualifier.hpp> |
| 84 | #include <boost/preprocessor/tuple/eat.hpp> |
| 85 | |
| 86 | #define BOOST_PARAMETER_COMPLEX_NAME(name) \ |
| 87 | BOOST_PARAMETER_BASIC_NAME( \ |
| 88 | BOOST_PARAMETER_COMPLEX_NAME_NAMESPACE(name) \ |
| 89 | , BOOST_PARAMETER_UNQUALIFIED(BOOST_PP_TUPLE_EAT(2) name) \ |
| 90 | , BOOST_PARAMETER_GET_QUALIFIER(BOOST_PP_TUPLE_EAT(2) name) \ |
| 91 | , BOOST_PARAMETER_COMPLEX_NAME_OBJECT(name) \ |
| 92 | ) |
| 93 | /**/ |
| 94 | |
| 95 | #include <boost/preprocessor/cat.hpp> |
| 96 | |
| 97 | #define BOOST_PARAMETER_SIMPLE_NAME(name) \ |
| 98 | BOOST_PARAMETER_BASIC_NAME( \ |
| 99 | tag \ |
| 100 | , BOOST_PARAMETER_UNQUALIFIED(name) \ |
| 101 | , BOOST_PARAMETER_GET_QUALIFIER(name) \ |
| 102 | , BOOST_PP_CAT(_, BOOST_PARAMETER_UNQUALIFIED(name)) \ |
| 103 | ) |
| 104 | /**/ |
| 105 | |
| 106 | #include <boost/parameter/aux_/preprocessor/is_binary.hpp> |
| 107 | #include <boost/preprocessor/control/iif.hpp> |
| 108 | |
| 109 | #define BOOST_PARAMETER_NAME(name) \ |
| 110 | BOOST_PP_IIF( \ |
| 111 | BOOST_PARAMETER_IS_BINARY(name) \ |
| 112 | , BOOST_PARAMETER_COMPLEX_NAME \ |
| 113 | , BOOST_PARAMETER_SIMPLE_NAME \ |
| 114 | )(name) |
| 115 | /**/ |
| 116 | |
| 117 | #include <boost/parameter/template_keyword.hpp> |
| 118 | |
| 119 | #endif // include guard |
| 120 | |
| 121 | |