Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/log/detail/sink_init_helpers.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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 sink_init_helpers.hpp | |
9 * \author Andrey Semashev | |
10 * \date 14.03.2009 | |
11 * | |
12 * \brief This header is the Boost.Log library implementation, see the library documentation | |
13 * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. | |
14 */ | |
15 | |
16 #ifndef BOOST_LOG_DETAIL_SINK_INIT_HELPERS_HPP_INCLUDED_ | |
17 #define BOOST_LOG_DETAIL_SINK_INIT_HELPERS_HPP_INCLUDED_ | |
18 | |
19 #include <string> | |
20 #include <boost/mpl/bool.hpp> | |
21 #include <boost/parameter/binding.hpp> | |
22 #include <boost/type_traits/is_void.hpp> | |
23 #include <boost/utility/enable_if.hpp> | |
24 #include <boost/phoenix/core/is_actor.hpp> | |
25 #include <boost/log/detail/config.hpp> | |
26 #include <boost/log/core/core.hpp> | |
27 #include <boost/log/expressions/filter.hpp> | |
28 #include <boost/log/expressions/formatter.hpp> | |
29 #include <boost/log/utility/setup/filter_parser.hpp> | |
30 #include <boost/log/utility/setup/formatter_parser.hpp> | |
31 #include <boost/log/keywords/filter.hpp> | |
32 #include <boost/log/keywords/format.hpp> | |
33 #include <boost/log/detail/header.hpp> | |
34 | |
35 #ifdef BOOST_HAS_PRAGMA_ONCE | |
36 #pragma once | |
37 #endif | |
38 | |
39 namespace boost { | |
40 | |
41 BOOST_LOG_OPEN_NAMESPACE | |
42 | |
43 namespace aux { | |
44 | |
45 // The function creates a filter functional object from the provided argument | |
46 template< typename CharT > | |
47 inline filter acquire_filter(const CharT* filter) | |
48 { | |
49 return boost::log::parse_filter(filter); | |
50 } | |
51 template< typename CharT, typename TraitsT, typename AllocatorT > | |
52 inline filter acquire_filter(std::basic_string< CharT, TraitsT, AllocatorT > const& filter) | |
53 { | |
54 return boost::log::parse_filter(filter); | |
55 } | |
56 template< typename FilterT > | |
57 inline typename enable_if< | |
58 phoenix::is_actor< FilterT >, | |
59 FilterT const& | |
60 >::type acquire_filter(FilterT const& filter) | |
61 { | |
62 return filter; | |
63 } | |
64 | |
65 // The function installs filter into the sink, if provided in the arguments pack | |
66 template< typename SinkT, typename ArgsT > | |
67 inline void setup_filter(SinkT&, ArgsT const&, mpl::true_) | |
68 { | |
69 } | |
70 | |
71 template< typename SinkT, typename ArgsT > | |
72 inline void setup_filter(SinkT& s, ArgsT const& args, mpl::false_) | |
73 { | |
74 s.set_filter(aux::acquire_filter(args[keywords::filter])); | |
75 } | |
76 | |
77 | |
78 // The function creates a filter functional object from the provided argument | |
79 template< typename CharT > | |
80 inline basic_formatter< CharT > acquire_formatter(const CharT* formatter) | |
81 { | |
82 return boost::log::parse_formatter(formatter); | |
83 } | |
84 template< typename CharT, typename TraitsT, typename AllocatorT > | |
85 inline basic_formatter< CharT > acquire_formatter(std::basic_string< CharT, TraitsT, AllocatorT > const& formatter) | |
86 { | |
87 return boost::log::parse_formatter(formatter); | |
88 } | |
89 template< typename FormatterT > | |
90 inline typename enable_if< | |
91 phoenix::is_actor< FormatterT >, | |
92 FormatterT const& | |
93 >::type acquire_formatter(FormatterT const& formatter) | |
94 { | |
95 return formatter; | |
96 } | |
97 | |
98 // The function installs filter into the sink, if provided in the arguments pack | |
99 template< typename SinkT, typename ArgsT > | |
100 inline void setup_formatter(SinkT&, ArgsT const&, mpl::true_) | |
101 { | |
102 } | |
103 | |
104 template< typename SinkT, typename ArgsT > | |
105 inline void setup_formatter(SinkT& s, ArgsT const& args, mpl::false_) | |
106 { | |
107 s.set_formatter(aux::acquire_formatter(args[keywords::format])); | |
108 } | |
109 | |
110 } // namespace aux | |
111 | |
112 BOOST_LOG_CLOSE_NAMESPACE // namespace log | |
113 | |
114 } // namespace boost | |
115 | |
116 #include <boost/log/detail/footer.hpp> | |
117 | |
118 #endif // BOOST_LOG_DETAIL_SINK_INIT_HELPERS_HPP_INCLUDED_ |