Chris@16: /* Chris@16: * Copyright Andrey Semashev 2007 - 2013. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: /*! Chris@16: * \file support/spirit_qi.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 19.07.2009 Chris@16: * Chris@16: * This header enables Boost.Spirit.Qi support for Boost.Log. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_SUPPORT_SPIRIT_QI_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_SUPPORT_SPIRIT_QI_HPP_INCLUDED_ Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: namespace aux { Chris@16: Chris@16: //! The trait verifies if the type can be converted to a Boost.Spirit.Qi parser Chris@16: template< typename T > Chris@16: struct is_spirit_qi_parser< T, true > : Chris@16: public spirit::traits::is_component< spirit::qi::domain, T > Chris@16: { Chris@16: }; Chris@16: Chris@16: //! The matching functor implementation Chris@16: template< > Chris@16: struct matches_fun_impl< boost_spirit_qi_expression_tag > Chris@16: { Chris@16: template< typename StringT, typename ParserT > Chris@16: static bool matches( Chris@16: StringT const& str, Chris@16: ParserT const& expr) Chris@16: { Chris@16: typedef typename StringT::const_iterator const_iterator; Chris@16: const_iterator it = str.begin(), end = str.end(); Chris@16: return (spirit::qi::parse(it, end, expr) && it == end); Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: BOOST_LOG_CLOSE_NAMESPACE // namespace log Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_LOG_SUPPORT_SPIRIT_QI_HPP_INCLUDED_