File indexing completed on 2025-01-18 09:39:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BOOST_LOG_DETAIL_PARAMETER_TOOLS_HPP_INCLUDED_
0017 #define BOOST_LOG_DETAIL_PARAMETER_TOOLS_HPP_INCLUDED_
0018
0019 #include <boost/mpl/or.hpp>
0020 #include <boost/core/enable_if.hpp>
0021 #include <boost/parameter/keyword.hpp>
0022 #include <boost/type_traits/is_base_of.hpp>
0023 #include <boost/preprocessor/control/if.hpp>
0024 #include <boost/preprocessor/comparison/equal.hpp>
0025 #include <boost/preprocessor/repetition/enum_params.hpp>
0026 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0027 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0028 #include <boost/preprocessor/facilities/intercept.hpp>
0029 #include <boost/preprocessor/arithmetic/dec.hpp>
0030 #include <boost/preprocessor/tuple/elem.hpp>
0031 #include <boost/log/detail/config.hpp>
0032 #include <boost/log/detail/sfinae_tools.hpp>
0033 #include <boost/log/detail/header.hpp>
0034
0035 #ifdef BOOST_HAS_PRAGMA_ONCE
0036 #pragma once
0037 #endif
0038
0039 #ifndef BOOST_LOG_MAX_PARAMETER_ARGS
0040
0041 #define BOOST_LOG_MAX_PARAMETER_ARGS 16
0042 #endif
0043
0044
0045 #define BOOST_LOG_PARAMETRIZED_CONSTRUCTORS_GEN(macro, args)\
0046 public:\
0047 BOOST_PP_REPEAT_FROM_TO(1, BOOST_LOG_MAX_PARAMETER_ARGS, macro, args)
0048
0049 #define BOOST_LOG_CTOR_FORWARD_1(z, n, types)\
0050 template< typename T0 >\
0051 explicit BOOST_PP_TUPLE_ELEM(2, 0, types)(T0 const& arg0, typename boost::log::aux::enable_if_named_parameters< T0, boost::log::aux::sfinae_dummy >::type = boost::log::aux::sfinae_dummy()) :\
0052 BOOST_PP_TUPLE_ELEM(2, 1, types)((BOOST_PP_ENUM_PARAMS_Z(z, n, arg))) {}
0053
0054 #define BOOST_LOG_CTOR_FORWARD_N(z, n, types)\
0055 template< BOOST_PP_ENUM_PARAMS_Z(z, n, typename T) >\
0056 explicit BOOST_PP_TUPLE_ELEM(2, 0, types)(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, T, const& arg)) :\
0057 BOOST_PP_TUPLE_ELEM(2, 1, types)((BOOST_PP_ENUM_PARAMS_Z(z, n, arg))) {}
0058
0059 #define BOOST_LOG_CTOR_FORWARD(z, n, types)\
0060 BOOST_PP_IF(BOOST_PP_EQUAL(n, 1), BOOST_LOG_CTOR_FORWARD_1, BOOST_LOG_CTOR_FORWARD_N)(z, n, types)
0061
0062
0063
0064 #define BOOST_LOG_PARAMETRIZED_CONSTRUCTORS_FORWARD(class_type, base_type)\
0065 BOOST_LOG_PARAMETRIZED_CONSTRUCTORS_GEN(BOOST_LOG_CTOR_FORWARD, (class_type, base_type))
0066
0067 #define BOOST_LOG_CTOR_CALL_1(z, n, types)\
0068 template< typename T0 >\
0069 explicit BOOST_PP_TUPLE_ELEM(2, 0, types)(T0 const& arg0, typename boost::log::aux::enable_if_named_parameters< T0, boost::log::aux::sfinae_dummy >::type = boost::log::aux::sfinae_dummy())\
0070 { BOOST_PP_TUPLE_ELEM(2, 1, types)((BOOST_PP_ENUM_PARAMS_Z(z, n, arg))); }
0071
0072 #define BOOST_LOG_CTOR_CALL_N(z, n, types)\
0073 template< BOOST_PP_ENUM_PARAMS_Z(z, n, typename T) >\
0074 explicit BOOST_PP_TUPLE_ELEM(2, 0, types)(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, T, const& arg))\
0075 { BOOST_PP_TUPLE_ELEM(2, 1, types)((BOOST_PP_ENUM_PARAMS_Z(z, n, arg))); }
0076
0077 #define BOOST_LOG_CTOR_CALL(z, n, types)\
0078 BOOST_PP_IF(BOOST_PP_EQUAL(n, 1), BOOST_LOG_CTOR_CALL_1, BOOST_LOG_CTOR_CALL_N)(z, n, types)
0079
0080
0081
0082 #define BOOST_LOG_PARAMETRIZED_CONSTRUCTORS_CALL(class_type, fun)\
0083 BOOST_LOG_PARAMETRIZED_CONSTRUCTORS_GEN(BOOST_LOG_CTOR_CALL, (class_type, fun))
0084
0085 namespace boost {
0086
0087 BOOST_LOG_OPEN_NAMESPACE
0088
0089 namespace aux {
0090
0091
0092
0093 typedef boost::parameter::aux::empty_arg_list empty_arg_list;
0094
0095 #if !(defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_LOG_NO_CXX11_ARG_PACKS_TO_NON_VARIADIC_ARGS_EXPANSION))
0096
0097
0098 template< typename ArgT0, typename... ArgsT >
0099 struct make_arg_list
0100 {
0101 typedef boost::parameter::aux::arg_list< ArgT0, typename make_arg_list< ArgsT... >::type > type;
0102 };
0103
0104 template< typename ArgT0 >
0105 struct make_arg_list< ArgT0 >
0106 {
0107 typedef boost::parameter::aux::arg_list< ArgT0 > type;
0108 };
0109
0110 #else
0111
0112
0113 template< typename ArgT0, BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_DEC(BOOST_LOG_MAX_PARAMETER_ARGS), typename T, = void BOOST_PP_INTERCEPT) >
0114 struct make_arg_list
0115 {
0116 typedef boost::parameter::aux::arg_list< ArgT0, typename make_arg_list< BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(BOOST_LOG_MAX_PARAMETER_ARGS), T) >::type > type;
0117 };
0118
0119 template< typename ArgT0 >
0120 struct make_arg_list< ArgT0, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(BOOST_LOG_MAX_PARAMETER_ARGS), void BOOST_PP_INTERCEPT) >
0121 {
0122 typedef boost::parameter::aux::arg_list< ArgT0 > type;
0123 };
0124
0125 #endif
0126
0127 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
0128
0129 template< typename T, typename R >
0130 using enable_if_named_parameters = boost::enable_if_c< boost::mpl::or_< boost::is_base_of< boost::parameter::aux::tagged_argument_base, T >, boost::is_base_of< empty_arg_list, T > >::value, R >;
0131
0132 #else
0133
0134 template< typename T, typename R >
0135 struct enable_if_named_parameters :
0136 public boost::enable_if_c< boost::mpl::or_< boost::is_base_of< boost::parameter::aux::tagged_argument_base, T >, boost::is_base_of< empty_arg_list, T > >::value, R >
0137 {
0138 };
0139
0140 #endif
0141
0142 }
0143
0144 BOOST_LOG_CLOSE_NAMESPACE
0145
0146 }
0147
0148 #include <boost/log/detail/footer.hpp>
0149
0150 #endif