File indexing completed on 2025-01-18 09:39:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_EXPRESSIONS_FORMATTERS_FORMAT_HPP_INCLUDED_
0016 #define BOOST_LOG_EXPRESSIONS_FORMATTERS_FORMAT_HPP_INCLUDED_
0017
0018 #include <string>
0019 #include <boost/mpl/bool.hpp>
0020 #include <boost/phoenix/core/actor.hpp>
0021 #include <boost/phoenix/core/terminal_fwd.hpp>
0022 #include <boost/phoenix/core/is_nullary.hpp>
0023 #include <boost/phoenix/core/environment.hpp>
0024 #include <boost/fusion/sequence/intrinsic/at_c.hpp>
0025 #include <boost/log/detail/config.hpp>
0026 #include <boost/log/detail/format.hpp>
0027 #include <boost/log/detail/custom_terminal_spec.hpp>
0028 #include <boost/log/detail/header.hpp>
0029
0030 #ifdef BOOST_HAS_PRAGMA_ONCE
0031 #pragma once
0032 #endif
0033
0034 namespace boost {
0035
0036 BOOST_LOG_OPEN_NAMESPACE
0037
0038 namespace expressions {
0039
0040
0041
0042
0043 template< typename CharT >
0044 class format_terminal
0045 {
0046 public:
0047 #ifndef BOOST_LOG_DOXYGEN_PASS
0048
0049 typedef void _is_boost_log_terminal;
0050 #endif
0051
0052
0053 typedef CharT char_type;
0054
0055 typedef boost::log::aux::basic_format< char_type > format_type;
0056
0057 typedef std::basic_string< char_type > string_type;
0058
0059
0060 typedef typename format_type::pump result_type;
0061
0062 private:
0063
0064 mutable format_type m_format;
0065
0066 public:
0067
0068 explicit format_terminal(const char_type* format) : m_format(format) {}
0069
0070
0071 template< typename ContextT >
0072 result_type operator() (ContextT const& ctx) const
0073 {
0074 return m_format.make_pump(fusion::at_c< 1 >(phoenix::env(ctx).args()));
0075 }
0076
0077 BOOST_DELETED_FUNCTION(format_terminal())
0078 };
0079
0080
0081
0082
0083
0084 template< typename CharT >
0085 BOOST_FORCEINLINE phoenix::actor< format_terminal< CharT > > format(const CharT* fmt)
0086 {
0087 typedef format_terminal< CharT > terminal_type;
0088 phoenix::actor< terminal_type > act = {{ terminal_type(fmt) }};
0089 return act;
0090 }
0091
0092
0093
0094
0095
0096 template< typename CharT, typename TraitsT, typename AllocatorT >
0097 BOOST_FORCEINLINE phoenix::actor< format_terminal< CharT > > format(std::basic_string< CharT, TraitsT, AllocatorT > const& fmt)
0098 {
0099 typedef format_terminal< CharT > terminal_type;
0100 phoenix::actor< terminal_type > act = {{ terminal_type(fmt.c_str()) }};
0101 return act;
0102 }
0103
0104 }
0105
0106 BOOST_LOG_CLOSE_NAMESPACE
0107
0108 #ifndef BOOST_LOG_DOXYGEN_PASS
0109
0110 namespace phoenix {
0111
0112 namespace result_of {
0113
0114 template< typename CharT >
0115 struct is_nullary< custom_terminal< boost::log::expressions::format_terminal< CharT > > > :
0116 public mpl::false_
0117 {
0118 };
0119
0120 }
0121
0122 }
0123
0124 #endif
0125
0126 }
0127
0128 #include <boost/log/detail/footer.hpp>
0129
0130 #endif