2
* Copyright Andrey Semashev 2007 - 2013.
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)
9
* \author Andrey Semashev
12
* This header contains the \c to_log output manipulator.
15
#ifndef BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_
16
#define BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_
19
#include <boost/mpl/bool.hpp>
20
#include <boost/log/detail/config.hpp>
21
#include <boost/log/utility/formatting_ostream_fwd.hpp>
22
#include <boost/log/detail/header.hpp>
24
#ifdef BOOST_LOG_HAS_PRAGMA_ONCE
30
BOOST_LOG_OPEN_NAMESPACE
33
* \brief Generic manipulator for customizing output to log
35
template< typename T, typename TagT = void >
42
typedef TagT tag_type;
45
//! Reference to the value
46
value_type const& m_value;
49
explicit to_log_manip(value_type const& value) : m_value(value) {}
50
to_log_manip(to_log_manip const& that) : m_value(that.m_value) {}
52
value_type const& get() const { return m_value; }
55
template< typename CharT, typename TraitsT, typename T, typename TagT >
56
inline std::basic_ostream< CharT, TraitsT >& operator<< (std::basic_ostream< CharT, TraitsT >& strm, to_log_manip< T, TagT > manip)
62
template< typename CharT, typename TraitsT, typename AllocatorT, typename T, typename TagT >
63
inline basic_formatting_ostream< CharT, TraitsT, AllocatorT >& operator<< (basic_formatting_ostream< CharT, TraitsT, AllocatorT >& strm, to_log_manip< T, TagT > manip)
69
template< typename T >
70
inline to_log_manip< T > to_log(T const& value)
72
return to_log_manip< T >(value);
75
template< typename TagT, typename T >
76
inline to_log_manip< T, TagT > to_log(T const& value)
78
return to_log_manip< T, TagT >(value);
81
BOOST_LOG_CLOSE_NAMESPACE // namespace log
85
#include <boost/log/detail/footer.hpp>
87
#endif // BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_