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 custom_terminal_spec.hpp
|
Chris@16
|
9 * \author Andrey Semashev
|
Chris@16
|
10 * \date 29.01.2012
|
Chris@16
|
11 *
|
Chris@16
|
12 * The header contains Boost.Phoenix custom terminal specialization for Boost.Log terminals.
|
Chris@16
|
13 */
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_LOG_DETAIL_CUSTOM_TERMINAL_SPEC_HPP_INCLUDED_
|
Chris@16
|
16 #define BOOST_LOG_DETAIL_CUSTOM_TERMINAL_SPEC_HPP_INCLUDED_
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/mpl/bool.hpp>
|
Chris@16
|
19 #include <boost/phoenix/core/terminal_fwd.hpp>
|
Chris@16
|
20 #include <boost/phoenix/core/is_nullary.hpp>
|
Chris@16
|
21 #include <boost/phoenix/core/terminal.hpp> // needed for terminal-related part of the grammar
|
Chris@16
|
22 #include <boost/type_traits/remove_cv.hpp>
|
Chris@16
|
23 #include <boost/type_traits/remove_reference.hpp>
|
Chris@16
|
24 #include <boost/utility/result_of.hpp>
|
Chris@16
|
25 #include <boost/log/detail/config.hpp>
|
Chris@16
|
26 #include <boost/log/detail/header.hpp>
|
Chris@16
|
27
|
Chris@16
|
28 #ifdef BOOST_HAS_PRAGMA_ONCE
|
Chris@16
|
29 #pragma once
|
Chris@16
|
30 #endif
|
Chris@16
|
31
|
Chris@16
|
32 namespace boost {
|
Chris@16
|
33
|
Chris@16
|
34 namespace phoenix {
|
Chris@16
|
35
|
Chris@16
|
36 template< typename T >
|
Chris@16
|
37 struct is_custom_terminal< T, typename T::_is_boost_log_terminal > :
|
Chris@16
|
38 public mpl::true_
|
Chris@16
|
39 {
|
Chris@16
|
40 };
|
Chris@16
|
41
|
Chris@16
|
42 template< typename T >
|
Chris@16
|
43 struct custom_terminal< T, typename T::_is_boost_log_terminal >
|
Chris@16
|
44 {
|
Chris@16
|
45 typedef custom_terminal< T, typename T::_is_boost_log_terminal > this_type;
|
Chris@16
|
46
|
Chris@16
|
47 template< typename >
|
Chris@16
|
48 struct result;
|
Chris@16
|
49
|
Chris@16
|
50 template< typename ThisT, typename TermT, typename ContextT >
|
Chris@16
|
51 struct result< ThisT(TermT, ContextT) >
|
Chris@16
|
52 {
|
Chris@16
|
53 typedef typename remove_cv< typename remove_reference< TermT >::type >::type term;
|
Chris@16
|
54 typedef typename boost::result_of< const term(ContextT) >::type type;
|
Chris@16
|
55 };
|
Chris@16
|
56
|
Chris@16
|
57 template< typename ContextT >
|
Chris@16
|
58 typename result< const this_type(T const&, ContextT&) >::type operator() (T const& term, ContextT& ctx) const
|
Chris@16
|
59 {
|
Chris@16
|
60 return term(ctx);
|
Chris@16
|
61 }
|
Chris@16
|
62 };
|
Chris@16
|
63
|
Chris@16
|
64 } // namespace phoenix
|
Chris@16
|
65
|
Chris@16
|
66 } // namespace boost
|
Chris@16
|
67
|
Chris@16
|
68 #include <boost/log/detail/footer.hpp>
|
Chris@16
|
69
|
Chris@16
|
70 #endif // BOOST_LOG_DETAIL_CUSTOM_TERMINAL_SPEC_HPP_INCLUDED_
|