Chris@16: /* Chris@101: * Copyright Andrey Semashev 2007 - 2015. 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 matches.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 30.03.2008 Chris@16: * Chris@16: * This header contains a predicate for checking if the provided string matches a regular expression. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_ Chris@16: 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@101: //! The metafunction detects the matching expression kind and returns a tag that is used to specialize \c match_traits Chris@101: template< typename ExpressionT, typename = void > Chris@101: struct matching_expression_kind; Chris@16: Chris@101: //! The matching function implementation Chris@101: template< typename ExpressionT, typename TagT = typename matching_expression_kind< ExpressionT >::type > Chris@101: struct match_traits; Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: //! The regex matching functor Chris@16: struct matches_fun Chris@16: { Chris@16: typedef bool result_type; Chris@16: Chris@16: template< typename StringT, typename ExpressionT > Chris@16: bool operator() (StringT const& str, ExpressionT const& expr) const Chris@16: { Chris@101: typedef aux::match_traits< ExpressionT > impl; Chris@16: return impl::matches(str, expr); Chris@16: } Chris@16: template< typename StringT, typename ExpressionT, typename ArgT > Chris@16: bool operator() (StringT const& str, ExpressionT const& expr, ArgT const& arg) const Chris@16: { Chris@101: typedef aux::match_traits< ExpressionT > impl; Chris@16: return impl::matches(str, expr, arg); Chris@16: } Chris@16: }; 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_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_