Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:24

0001 /*
0002  *          Copyright Andrey Semashev 2007 - 2015.
0003  * Distributed under the Boost Software License, Version 1.0.
0004  *    (See accompanying file LICENSE_1_0.txt or copy at
0005  *          http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 /*!
0008  * \file   basic_sink_backend.hpp
0009  * \author Andrey Semashev
0010  * \date   04.11.2007
0011  *
0012  * The header contains implementation of base classes for sink backends.
0013  */
0014 
0015 #ifndef BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_
0016 #define BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_
0017 
0018 #include <string>
0019 #include <boost/type_traits/is_same.hpp>
0020 #include <boost/log/detail/config.hpp>
0021 #include <boost/log/sinks/frontend_requirements.hpp>
0022 #include <boost/log/core/record_view.hpp>
0023 #include <boost/log/attributes/attribute_value_set.hpp>
0024 #include <boost/log/detail/header.hpp>
0025 
0026 #ifdef BOOST_HAS_PRAGMA_ONCE
0027 #pragma once
0028 #endif
0029 
0030 namespace boost {
0031 
0032 BOOST_LOG_OPEN_NAMESPACE
0033 
0034 namespace sinks {
0035 
0036 /*!
0037  * \brief Base class for a logging sink backend
0038  *
0039  * The \c basic_sink_backend class template defines a number of types that
0040  * all sink backends are required to define. All sink backends have to derive from the class.
0041  */
0042 template< typename FrontendRequirementsT >
0043 struct basic_sink_backend
0044 {
0045     //! Frontend requirements tag
0046     typedef FrontendRequirementsT frontend_requirements;
0047 
0048     BOOST_DEFAULTED_FUNCTION(basic_sink_backend(), {})
0049 
0050     BOOST_DELETED_FUNCTION(basic_sink_backend(basic_sink_backend const&))
0051     BOOST_DELETED_FUNCTION(basic_sink_backend& operator= (basic_sink_backend const&))
0052 };
0053 
0054 /*!
0055  * \brief A base class for a logging sink backend with message formatting support
0056  *
0057  * The \c basic_formatted_sink_backend class template indicates to the frontend that
0058  * the backend requires logging record formatting.
0059  *
0060  * The class allows to request encoding conversion in case if the sink backend
0061  * requires the formatted string in some particular encoding (e.g. if underlying API
0062  * supports only narrow or wide characters). In order to perform conversion one
0063  * should specify the desired final character type in the \c TargetCharT template
0064  * parameter.
0065  */
0066 template<
0067     typename CharT,
0068     typename FrontendRequirementsT = synchronized_feeding
0069 >
0070 struct basic_formatted_sink_backend :
0071     public basic_sink_backend<
0072         typename combine_requirements< FrontendRequirementsT, formatted_records >::type
0073     >
0074 {
0075 private:
0076     typedef basic_sink_backend<
0077         typename combine_requirements< FrontendRequirementsT, formatted_records >::type
0078     > base_type;
0079 
0080 public:
0081     //! Character type
0082     typedef CharT char_type;
0083     //! Formatted string type
0084     typedef std::basic_string< char_type > string_type;
0085     //! Frontend requirements
0086     typedef typename base_type::frontend_requirements frontend_requirements;
0087 };
0088 
0089 } // namespace sinks
0090 
0091 BOOST_LOG_CLOSE_NAMESPACE // namespace log
0092 
0093 } // namespace boost
0094 
0095 #include <boost/log/detail/footer.hpp>
0096 
0097 #endif // BOOST_LOG_SINKS_BASIC_SINK_BACKEND_HPP_INCLUDED_