File indexing completed on 2025-01-18 09:39:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_UTILITY_MANIPULATORS_AUTO_NEWLINE_HPP_INCLUDED_
0016 #define BOOST_LOG_UTILITY_MANIPULATORS_AUTO_NEWLINE_HPP_INCLUDED_
0017
0018 #include <boost/log/detail/config.hpp>
0019 #include <boost/log/utility/formatting_ostream_fwd.hpp>
0020 #include <boost/log/detail/header.hpp>
0021
0022 #ifdef BOOST_HAS_PRAGMA_ONCE
0023 #pragma once
0024 #endif
0025
0026 namespace boost {
0027
0028 BOOST_LOG_OPEN_NAMESPACE
0029
0030
0031
0032
0033
0034 struct auto_newline_manip {}
0035 BOOST_INLINE_VARIABLE const auto_newline = {};
0036
0037
0038
0039
0040 template< typename CharT, typename TraitsT, typename AllocatorT >
0041 inline basic_formatting_ostream< CharT, TraitsT, AllocatorT >& operator<< (basic_formatting_ostream< CharT, TraitsT, AllocatorT >& strm, auto_newline_manip)
0042 {
0043 typedef basic_formatting_ostream< CharT, TraitsT, AllocatorT > stream_type;
0044 typedef typename stream_type::char_type char_type;
0045 typedef typename stream_type::string_type string_type;
0046 if (BOOST_LIKELY(strm.good()))
0047 {
0048 string_type* str = strm.rdbuf()->storage();
0049 if (BOOST_LIKELY(!!str))
0050 {
0051 strm.rdbuf()->pubsync();
0052 if (str->empty() || *str->rbegin() != static_cast< char_type >('\n'))
0053 strm.rdbuf()->push_back(static_cast< char_type >('\n'));
0054 }
0055 }
0056
0057 return strm;
0058 }
0059
0060 BOOST_LOG_CLOSE_NAMESPACE
0061
0062 }
0063
0064 #include <boost/log/detail/footer.hpp>
0065
0066 #endif