named_scope_fmt_pp.hpp 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright Andrey Semashev 2007 - 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. template< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename ArgT) >
  8. BOOST_FORCEINLINE format_named_scope_actor<
  9. fallback_to_none,
  10. typename boost::log::aux::deduce_char_type<
  11. typename parameter::binding<
  12. typename boost::log::aux::make_arg_list< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), ArgT) >::type,
  13. keywords::tag::format,
  14. void
  15. >::type
  16. >::type
  17. > format_named_scope(attribute_name const& name, BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, const& arg))
  18. {
  19. typedef typename boost::log::aux::deduce_char_type<
  20. typename parameter::binding<
  21. typename boost::log::aux::make_arg_list< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), ArgT) >::type,
  22. keywords::tag::format,
  23. void
  24. >::type
  25. >::type char_type;
  26. return aux::format_named_scope< char_type, phoenix::actor >(name, fallback_to_none(), (BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg)));
  27. }
  28. template< typename DescriptorT, template< typename > class ActorT, BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename ArgT) >
  29. BOOST_FORCEINLINE format_named_scope_actor<
  30. fallback_to_none,
  31. typename boost::log::aux::deduce_char_type<
  32. typename parameter::binding<
  33. typename boost::log::aux::make_arg_list< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), ArgT) >::type,
  34. keywords::tag::format,
  35. void
  36. >::type
  37. >::type,
  38. ActorT
  39. >
  40. format_named_scope(attribute_keyword< DescriptorT, ActorT > const& keyword, BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, const& arg))
  41. {
  42. BOOST_STATIC_ASSERT_MSG((is_same< typename DescriptorT::value_type, attributes::named_scope::value_type >::value),\
  43. "Boost.Log: Named scope formatter only accepts attribute values of type attributes::named_scope::value_type.");
  44. typedef typename boost::log::aux::deduce_char_type<
  45. typename parameter::binding<
  46. typename boost::log::aux::make_arg_list< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), ArgT) >::type,
  47. keywords::tag::format,
  48. void
  49. >::type
  50. >::type char_type;
  51. return aux::format_named_scope< char_type, ActorT >(keyword.get_name(), fallback_to_none(), (BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg)));
  52. }
  53. template< typename T, typename FallbackPolicyT, typename TagT, template< typename > class ActorT, BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename ArgT) >
  54. BOOST_FORCEINLINE format_named_scope_actor<
  55. FallbackPolicyT,
  56. typename boost::log::aux::deduce_char_type<
  57. typename parameter::binding<
  58. typename boost::log::aux::make_arg_list< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), ArgT) >::type,
  59. keywords::tag::format,
  60. void
  61. >::type
  62. >::type,
  63. ActorT
  64. >
  65. format_named_scope(attribute_actor< T, FallbackPolicyT, TagT, ActorT > const& placeholder, BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, const& arg))
  66. {
  67. BOOST_STATIC_ASSERT_MSG((is_same< T, attributes::named_scope::value_type >::value),\
  68. "Boost.Log: Named scope formatter only accepts attribute values of type attributes::named_scope::value_type.");
  69. typedef typename boost::log::aux::deduce_char_type<
  70. typename parameter::binding<
  71. typename boost::log::aux::make_arg_list< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), ArgT) >::type,
  72. keywords::tag::format,
  73. void
  74. >::type
  75. >::type char_type;
  76. return aux::format_named_scope< char_type, ActorT >(placeholder.get_name(), placeholder.get_fallback_policy(), (BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg)));
  77. }