File indexing completed on 2025-01-30 09:45:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_SUPPORT_SPIRIT_QI_HPP_INCLUDED_
0016 #define BOOST_LOG_SUPPORT_SPIRIT_QI_HPP_INCLUDED_
0017
0018 #include <boost/core/enable_if.hpp>
0019 #include <boost/spirit/include/qi_parse.hpp>
0020 #include <boost/spirit/include/qi_domain.hpp>
0021 #include <boost/spirit/include/support_unused.hpp>
0022 #include <boost/spirit/home/support/meta_compiler.hpp> // spirit::compile()
0023 #include <boost/spirit/home/qi/nonterminal/nonterminal_fwd.hpp> // rule forward declaration
0024 #include <boost/log/detail/config.hpp>
0025 #include <boost/log/utility/functional/matches.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 BOOST_LOG_OPEN_NAMESPACE
0035
0036 namespace aux {
0037
0038
0039 struct boost_spirit_qi_expression_tag;
0040
0041
0042 template< typename ExpressionT >
0043 struct matching_expression_kind< ExpressionT, typename boost::enable_if_c< spirit::traits::matches< spirit::qi::domain, ExpressionT >::value >::type >
0044 {
0045 typedef boost_spirit_qi_expression_tag type;
0046 };
0047
0048
0049 template< typename ExpressionT >
0050 struct match_traits< ExpressionT, boost_spirit_qi_expression_tag >
0051 {
0052 typedef typename spirit::result_of::compile< spirit::qi::domain, ExpressionT, spirit::unused_type >::type compiled_type;
0053
0054 static compiled_type compile(ExpressionT const& expr)
0055 {
0056 return spirit::compile< spirit::qi::domain >(expr);
0057 }
0058
0059 template< typename StringT >
0060 static bool matches(StringT const& str, ExpressionT const& expr)
0061 {
0062 typedef typename StringT::const_iterator const_iterator;
0063 const_iterator it = str.begin(), end = str.end();
0064 return (spirit::qi::parse(it, end, expr) && it == end);
0065 }
0066 };
0067
0068
0069 template< typename IteratorT, typename T1, typename T2, typename T3, typename T4 >
0070 struct match_traits< spirit::qi::rule< IteratorT, T1, T2, T3, T4 >, boost_spirit_qi_expression_tag >
0071 {
0072 typedef spirit::qi::rule< IteratorT, T1, T2, T3, T4 > compiled_type;
0073 static compiled_type compile(compiled_type const& expr) { return expr; }
0074
0075 template< typename StringT >
0076 static bool matches(StringT const& str, compiled_type const& expr)
0077 {
0078 typedef typename StringT::const_iterator const_iterator;
0079 const_iterator it = str.begin(), end = str.end();
0080 return (spirit::qi::parse(it, end, expr) && it == end);
0081 }
0082 };
0083
0084 }
0085
0086 BOOST_LOG_CLOSE_NAMESPACE
0087
0088 }
0089
0090 #include <boost/log/detail/footer.hpp>
0091
0092 #endif