Chris@16
|
1 /*
|
Chris@101
|
2 * Copyright Andrey Semashev 2007 - 2015.
|
Chris@16
|
3 * Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
4 * (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 * http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 */
|
Chris@16
|
7 /*!
|
Chris@16
|
8 * \file basic_sink_backend.hpp
|
Chris@16
|
9 * \author Andrey Semashev
|
Chris@16
|
10 * \date 04.11.2007
|
Chris@16
|
11 *
|
Chris@16
|
12 * The header contains implementation of base classes for sink backends.
|
Chris@16
|
13 */
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_
|
Chris@16
|
16 #define BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_
|
Chris@16
|
17
|
Chris@16
|
18 #include <string>
|
Chris@16
|
19 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
20 #include <boost/log/detail/config.hpp>
|
Chris@16
|
21 #include <boost/log/sinks/frontend_requirements.hpp>
|
Chris@16
|
22 #include <boost/log/core/record_view.hpp>
|
Chris@16
|
23 #include <boost/log/attributes/attribute_value_set.hpp>
|
Chris@16
|
24 #include <boost/log/detail/header.hpp>
|
Chris@16
|
25
|
Chris@16
|
26 #ifdef BOOST_HAS_PRAGMA_ONCE
|
Chris@16
|
27 #pragma once
|
Chris@16
|
28 #endif
|
Chris@16
|
29
|
Chris@16
|
30 namespace boost {
|
Chris@16
|
31
|
Chris@16
|
32 BOOST_LOG_OPEN_NAMESPACE
|
Chris@16
|
33
|
Chris@16
|
34 namespace sinks {
|
Chris@16
|
35
|
Chris@16
|
36 /*!
|
Chris@16
|
37 * \brief Base class for a logging sink backend
|
Chris@16
|
38 *
|
Chris@16
|
39 * The \c basic_sink_backend class template defines a number of types that
|
Chris@16
|
40 * all sink backends are required to define. All sink backends have to derive from the class.
|
Chris@16
|
41 */
|
Chris@16
|
42 template< typename FrontendRequirementsT >
|
Chris@16
|
43 struct basic_sink_backend
|
Chris@16
|
44 {
|
Chris@16
|
45 //! Frontend requirements tag
|
Chris@16
|
46 typedef FrontendRequirementsT frontend_requirements;
|
Chris@16
|
47
|
Chris@16
|
48 BOOST_DEFAULTED_FUNCTION(basic_sink_backend(), {})
|
Chris@16
|
49
|
Chris@16
|
50 BOOST_DELETED_FUNCTION(basic_sink_backend(basic_sink_backend const&))
|
Chris@16
|
51 BOOST_DELETED_FUNCTION(basic_sink_backend& operator= (basic_sink_backend const&))
|
Chris@16
|
52 };
|
Chris@16
|
53
|
Chris@16
|
54 /*!
|
Chris@16
|
55 * \brief A base class for a logging sink backend with message formatting support
|
Chris@16
|
56 *
|
Chris@16
|
57 * The \c basic_formatted_sink_backend class template indicates to the frontend that
|
Chris@16
|
58 * the backend requires logging record formatting.
|
Chris@16
|
59 *
|
Chris@16
|
60 * The class allows to request encoding conversion in case if the sink backend
|
Chris@16
|
61 * requires the formatted string in some particular encoding (e.g. if underlying API
|
Chris@16
|
62 * supports only narrow or wide characters). In order to perform conversion one
|
Chris@16
|
63 * should specify the desired final character type in the \c TargetCharT template
|
Chris@16
|
64 * parameter.
|
Chris@16
|
65 */
|
Chris@16
|
66 template<
|
Chris@16
|
67 typename CharT,
|
Chris@16
|
68 typename FrontendRequirementsT = synchronized_feeding
|
Chris@16
|
69 >
|
Chris@16
|
70 struct basic_formatted_sink_backend :
|
Chris@16
|
71 public basic_sink_backend<
|
Chris@16
|
72 typename combine_requirements< FrontendRequirementsT, formatted_records >::type
|
Chris@16
|
73 >
|
Chris@16
|
74 {
|
Chris@16
|
75 private:
|
Chris@16
|
76 typedef basic_sink_backend<
|
Chris@16
|
77 typename combine_requirements< FrontendRequirementsT, formatted_records >::type
|
Chris@16
|
78 > base_type;
|
Chris@16
|
79
|
Chris@16
|
80 public:
|
Chris@16
|
81 //! Character type
|
Chris@16
|
82 typedef CharT char_type;
|
Chris@16
|
83 //! Formatted string type
|
Chris@16
|
84 typedef std::basic_string< char_type > string_type;
|
Chris@16
|
85 //! Frontend requirements
|
Chris@16
|
86 typedef typename base_type::frontend_requirements frontend_requirements;
|
Chris@16
|
87 };
|
Chris@16
|
88
|
Chris@16
|
89 } // namespace sinks
|
Chris@16
|
90
|
Chris@16
|
91 BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
Chris@16
|
92
|
Chris@16
|
93 } // namespace boost
|
Chris@16
|
94
|
Chris@16
|
95 #include <boost/log/detail/footer.hpp>
|
Chris@16
|
96
|
Chris@16
|
97 #endif // BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_
|