diff DEPENDENCIES/generic/include/boost/log/support/spirit_qi.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/log/support/spirit_qi.hpp	Fri Sep 04 12:01:02 2015 +0100
+++ b/DEPENDENCIES/generic/include/boost/log/support/spirit_qi.hpp	Mon Sep 07 11:12:49 2015 +0100
@@ -1,5 +1,5 @@
 /*
- *          Copyright Andrey Semashev 2007 - 2013.
+ *          Copyright Andrey Semashev 2007 - 2015.
  * Distributed under the Boost Software License, Version 1.0.
  *    (See accompanying file LICENSE_1_0.txt or copy at
  *          http://www.boost.org/LICENSE_1_0.txt)
@@ -15,11 +15,14 @@
 #ifndef BOOST_LOG_SUPPORT_SPIRIT_QI_HPP_INCLUDED_
 #define BOOST_LOG_SUPPORT_SPIRIT_QI_HPP_INCLUDED_
 
+#include <boost/utility/enable_if.hpp>
+#include <boost/spirit/include/qi_parse.hpp>
+#include <boost/spirit/include/qi_domain.hpp>
+#include <boost/spirit/include/support_unused.hpp>
+#include <boost/spirit/home/support/meta_compiler.hpp> // spirit::compile()
+#include <boost/spirit/home/qi/nonterminal/nonterminal_fwd.hpp> // rule forward declaration
 #include <boost/log/detail/config.hpp>
 #include <boost/log/utility/functional/matches.hpp>
-#include <boost/spirit/include/qi_parse.hpp>
-#include <boost/spirit/include/qi_domain.hpp>
-#include <boost/spirit/include/support_component.hpp>
 #include <boost/log/detail/header.hpp>
 
 #ifdef BOOST_HAS_PRAGMA_ONCE
@@ -32,21 +35,45 @@
 
 namespace aux {
 
-//! The trait verifies if the type can be converted to a Boost.Spirit.Qi parser
-template< typename T >
-struct is_spirit_qi_parser< T, true > :
-    public spirit::traits::is_component< spirit::qi::domain, T >
+//! This tag type is used if an expression is recognized as a Boost.Spirit.Qi expression
+struct boost_spirit_qi_expression_tag;
+
+//! The metafunction detects the matching expression kind and returns a tag that is used to specialize \c match_traits
+template< typename ExpressionT >
+struct matching_expression_kind< ExpressionT, typename boost::enable_if< spirit::traits::matches< spirit::qi::domain, ExpressionT > >::type >
 {
+    typedef boost_spirit_qi_expression_tag type;
 };
 
-//! The matching functor implementation
-template< >
-struct matches_fun_impl< boost_spirit_qi_expression_tag >
+//! The matching function implementation
+template< typename ExpressionT >
+struct match_traits< ExpressionT, boost_spirit_qi_expression_tag >
 {
-    template< typename StringT, typename ParserT >
-    static bool matches(
-        StringT const& str,
-        ParserT const& expr)
+    typedef typename spirit::result_of::compile< spirit::qi::domain, ExpressionT, spirit::unused_type >::type compiled_type;
+
+    static compiled_type compile(ExpressionT const& expr)
+    {
+        return spirit::compile< spirit::qi::domain >(expr);
+    }
+
+    template< typename StringT >
+    static bool matches(StringT const& str, ExpressionT const& expr)
+    {
+        typedef typename StringT::const_iterator const_iterator;
+        const_iterator it = str.begin(), end = str.end();
+        return (spirit::qi::parse(it, end, expr) && it == end);
+    }
+};
+
+//! The matching function implementation
+template< typename IteratorT, typename T1, typename T2, typename T3, typename T4 >
+struct match_traits< spirit::qi::rule< IteratorT, T1, T2, T3, T4 >, boost_spirit_qi_expression_tag >
+{
+    typedef spirit::qi::rule< IteratorT, T1, T2, T3, T4 > compiled_type;
+    static compiled_type compile(compiled_type const& expr) { return expr; }
+
+    template< typename StringT >
+    static bool matches(StringT const& str, compiled_type const& expr)
     {
         typedef typename StringT::const_iterator const_iterator;
         const_iterator it = str.begin(), end = str.end();