~ai.tron/armagetronad/0.4-winlibs-updated

« back to all changes in this revision

Viewing changes to boost/includes/boost/log/utility/manipulators/to_log.hpp

  • Committer: Nik K.
  • Date: 2013-11-07 16:58:35 UTC
  • Revision ID: nik.karbaum@gmail.com-20131107165835-kq99jz23drfj4dkh
Forgot to add some files; here they are

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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)
 
6
 */
 
7
/*!
 
8
 * \file   to_log.hpp
 
9
 * \author Andrey Semashev
 
10
 * \date   06.11.2012
 
11
 *
 
12
 * This header contains the \c to_log output manipulator.
 
13
 */
 
14
 
 
15
#ifndef BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_
 
16
#define BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_
 
17
 
 
18
#include <iosfwd>
 
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>
 
23
 
 
24
#ifdef BOOST_LOG_HAS_PRAGMA_ONCE
 
25
#pragma once
 
26
#endif
 
27
 
 
28
namespace boost {
 
29
 
 
30
BOOST_LOG_OPEN_NAMESPACE
 
31
 
 
32
/*!
 
33
 * \brief Generic manipulator for customizing output to log
 
34
 */
 
35
template< typename T, typename TagT = void >
 
36
class to_log_manip
 
37
{
 
38
public:
 
39
    //! Output value type
 
40
    typedef T value_type;
 
41
    //! Value tag type
 
42
    typedef TagT tag_type;
 
43
 
 
44
private:
 
45
    //! Reference to the value
 
46
    value_type const& m_value;
 
47
 
 
48
public:
 
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) {}
 
51
 
 
52
    value_type const& get() const { return m_value; }
 
53
};
 
54
 
 
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)
 
57
{
 
58
    strm << manip.get();
 
59
    return strm;
 
60
}
 
61
 
 
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)
 
64
{
 
65
    strm << manip.get();
 
66
    return strm;
 
67
}
 
68
 
 
69
template< typename T >
 
70
inline to_log_manip< T > to_log(T const& value)
 
71
{
 
72
    return to_log_manip< T >(value);
 
73
}
 
74
 
 
75
template< typename TagT, typename T >
 
76
inline to_log_manip< T, TagT > to_log(T const& value)
 
77
{
 
78
    return to_log_manip< T, TagT >(value);
 
79
}
 
80
 
 
81
BOOST_LOG_CLOSE_NAMESPACE // namespace log
 
82
 
 
83
} // namespace boost
 
84
 
 
85
#include <boost/log/detail/footer.hpp>
 
86
 
 
87
#endif // BOOST_LOG_UTILITY_MANIPULATORS_TO_LOG_HPP_INCLUDED_