Back to home page

EIC code displayed by LXR

 
 

    


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

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   custom_terminal_spec.hpp
0009  * \author Andrey Semashev
0010  * \date   29.01.2012
0011  *
0012  * The header contains Boost.Phoenix custom terminal specialization for Boost.Log terminals.
0013  */
0014 
0015 #ifndef BOOST_LOG_DETAIL_CUSTOM_TERMINAL_SPEC_HPP_INCLUDED_
0016 #define BOOST_LOG_DETAIL_CUSTOM_TERMINAL_SPEC_HPP_INCLUDED_
0017 
0018 #include <boost/mpl/bool.hpp>
0019 #include <boost/phoenix/core/terminal_fwd.hpp>
0020 #include <boost/phoenix/core/is_nullary.hpp>
0021 #include <boost/phoenix/core/terminal.hpp> // needed for terminal-related part of the grammar
0022 #include <boost/type_traits/remove_cv.hpp>
0023 #include <boost/type_traits/remove_reference.hpp>
0024 #include <boost/utility/result_of.hpp>
0025 #include <boost/log/detail/config.hpp>
0026 #include <boost/log/detail/header.hpp>
0027 
0028 #ifdef BOOST_HAS_PRAGMA_ONCE
0029 #pragma once
0030 #endif
0031 
0032 namespace boost {
0033 
0034 namespace phoenix {
0035 
0036 template< typename T >
0037 struct is_custom_terminal< T, typename T::_is_boost_log_terminal > :
0038     public mpl::true_
0039 {
0040 };
0041 
0042 template< typename T >
0043 struct custom_terminal< T, typename T::_is_boost_log_terminal >
0044 {
0045     typedef custom_terminal< T, typename T::_is_boost_log_terminal > this_type;
0046 
0047     template< typename >
0048     struct result;
0049 
0050     template< typename ThisT, typename TermT, typename ContextT >
0051     struct result< ThisT(TermT, ContextT) >
0052     {
0053         typedef typename remove_cv< typename remove_reference< TermT >::type >::type term;
0054         typedef typename boost::result_of< const term(ContextT) >::type type;
0055     };
0056 
0057     template< typename ContextT >
0058     typename result< const this_type(T const&, ContextT&) >::type operator() (T const& term, ContextT& ctx) const
0059     {
0060         return term(ctx);
0061     }
0062 };
0063 
0064 } // namespace phoenix
0065 
0066 } // namespace boost
0067 
0068 #include <boost/log/detail/footer.hpp>
0069 
0070 #endif // BOOST_LOG_DETAIL_CUSTOM_TERMINAL_SPEC_HPP_INCLUDED_