File indexing completed on 2025-01-18 09:39:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_SINKS_TEXT_OSTREAM_BACKEND_HPP_INCLUDED_
0016 #define BOOST_LOG_SINKS_TEXT_OSTREAM_BACKEND_HPP_INCLUDED_
0017
0018 #include <ostream>
0019 #include <boost/smart_ptr/shared_ptr.hpp>
0020 #include <boost/log/detail/config.hpp>
0021 #include <boost/log/detail/parameter_tools.hpp>
0022 #include <boost/log/keywords/auto_flush.hpp>
0023 #include <boost/log/keywords/auto_newline_mode.hpp>
0024 #include <boost/log/sinks/auto_newline_mode.hpp>
0025 #include <boost/log/sinks/basic_sink_backend.hpp>
0026 #include <boost/log/sinks/frontend_requirements.hpp>
0027 #include <boost/log/detail/header.hpp>
0028
0029 #ifdef BOOST_HAS_PRAGMA_ONCE
0030 #pragma once
0031 #endif
0032
0033 namespace boost {
0034
0035 BOOST_LOG_OPEN_NAMESPACE
0036
0037 namespace sinks {
0038
0039
0040
0041
0042
0043
0044 template< typename CharT >
0045 class basic_text_ostream_backend :
0046 public basic_formatted_sink_backend<
0047 CharT,
0048 combine_requirements< synchronized_feeding, flushing >::type
0049 >
0050 {
0051
0052 typedef basic_formatted_sink_backend<
0053 CharT,
0054 combine_requirements< synchronized_feeding, flushing >::type
0055 > base_type;
0056
0057 public:
0058
0059 typedef typename base_type::char_type char_type;
0060
0061 typedef typename base_type::string_type string_type;
0062
0063 typedef std::basic_ostream< char_type > stream_type;
0064
0065 private:
0066
0067
0068 struct implementation;
0069 implementation* m_pImpl;
0070
0071
0072
0073 public:
0074
0075
0076
0077 BOOST_LOG_API basic_text_ostream_backend();
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088 #ifndef BOOST_LOG_DOXYGEN_PASS
0089 BOOST_LOG_PARAMETRIZED_CONSTRUCTORS_CALL(basic_text_ostream_backend, construct)
0090 #else
0091 template< typename... ArgsT >
0092 explicit basic_text_ostream_backend(ArgsT... const& args);
0093 #endif
0094
0095
0096
0097
0098 BOOST_LOG_API ~basic_text_ostream_backend();
0099
0100
0101
0102
0103
0104
0105 BOOST_LOG_API void add_stream(shared_ptr< stream_type > const& strm);
0106
0107
0108
0109
0110
0111
0112 BOOST_LOG_API void remove_stream(shared_ptr< stream_type > const& strm);
0113
0114
0115
0116
0117
0118
0119 BOOST_LOG_API void auto_flush(bool enable = true);
0120
0121
0122
0123
0124
0125
0126
0127 BOOST_LOG_API void set_auto_newline_mode(auto_newline_mode mode);
0128
0129
0130
0131
0132 BOOST_LOG_API void consume(record_view const& rec, string_type const& formatted_message);
0133
0134
0135
0136
0137 BOOST_LOG_API void flush();
0138
0139 private:
0140 #ifndef BOOST_LOG_DOXYGEN_PASS
0141
0142 template< typename ArgsT >
0143 void construct(ArgsT const& args)
0144 {
0145 construct(
0146 args[keywords::auto_newline_mode | insert_if_missing],
0147 args[keywords::auto_flush | false]);
0148 }
0149
0150 BOOST_LOG_API void construct(auto_newline_mode auto_newline, bool auto_flush);
0151 #endif
0152 };
0153
0154 #ifdef BOOST_LOG_USE_CHAR
0155 typedef basic_text_ostream_backend< char > text_ostream_backend;
0156 #endif
0157 #ifdef BOOST_LOG_USE_WCHAR_T
0158 typedef basic_text_ostream_backend< wchar_t > wtext_ostream_backend;
0159 #endif
0160
0161 }
0162
0163 BOOST_LOG_CLOSE_NAMESPACE
0164
0165 }
0166
0167 #include <boost/log/detail/footer.hpp>
0168
0169 #endif