Chris@16
|
1 /*
|
Chris@101
|
2 * Copyright Andrey Semashev 2007 - 2015.
|
Chris@16
|
3 * Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
4 * (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 * http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 */
|
Chris@16
|
7 /*!
|
Chris@16
|
8 * \file matches.hpp
|
Chris@16
|
9 * \author Andrey Semashev
|
Chris@16
|
10 * \date 30.03.2008
|
Chris@16
|
11 *
|
Chris@16
|
12 * This header contains a predicate for checking if the provided string matches a regular expression.
|
Chris@16
|
13 */
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_LOG_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_
|
Chris@16
|
16 #define BOOST_LOG_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/log/detail/config.hpp>
|
Chris@16
|
19 #include <boost/log/detail/header.hpp>
|
Chris@16
|
20
|
Chris@16
|
21 #ifdef BOOST_HAS_PRAGMA_ONCE
|
Chris@16
|
22 #pragma once
|
Chris@16
|
23 #endif
|
Chris@16
|
24
|
Chris@16
|
25 namespace boost {
|
Chris@16
|
26
|
Chris@16
|
27 BOOST_LOG_OPEN_NAMESPACE
|
Chris@16
|
28
|
Chris@16
|
29 namespace aux {
|
Chris@16
|
30
|
Chris@101
|
31 //! The metafunction detects the matching expression kind and returns a tag that is used to specialize \c match_traits
|
Chris@101
|
32 template< typename ExpressionT, typename = void >
|
Chris@101
|
33 struct matching_expression_kind;
|
Chris@16
|
34
|
Chris@101
|
35 //! The matching function implementation
|
Chris@101
|
36 template< typename ExpressionT, typename TagT = typename matching_expression_kind< ExpressionT >::type >
|
Chris@101
|
37 struct match_traits;
|
Chris@16
|
38
|
Chris@16
|
39 } // namespace aux
|
Chris@16
|
40
|
Chris@16
|
41 //! The regex matching functor
|
Chris@16
|
42 struct matches_fun
|
Chris@16
|
43 {
|
Chris@16
|
44 typedef bool result_type;
|
Chris@16
|
45
|
Chris@16
|
46 template< typename StringT, typename ExpressionT >
|
Chris@16
|
47 bool operator() (StringT const& str, ExpressionT const& expr) const
|
Chris@16
|
48 {
|
Chris@101
|
49 typedef aux::match_traits< ExpressionT > impl;
|
Chris@16
|
50 return impl::matches(str, expr);
|
Chris@16
|
51 }
|
Chris@16
|
52 template< typename StringT, typename ExpressionT, typename ArgT >
|
Chris@16
|
53 bool operator() (StringT const& str, ExpressionT const& expr, ArgT const& arg) const
|
Chris@16
|
54 {
|
Chris@101
|
55 typedef aux::match_traits< ExpressionT > impl;
|
Chris@16
|
56 return impl::matches(str, expr, arg);
|
Chris@16
|
57 }
|
Chris@16
|
58 };
|
Chris@16
|
59
|
Chris@16
|
60 BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
Chris@16
|
61
|
Chris@16
|
62 } // namespace boost
|
Chris@16
|
63
|
Chris@16
|
64 #include <boost/log/detail/footer.hpp>
|
Chris@16
|
65
|
Chris@16
|
66 #endif // BOOST_LOG_UTILITY_FUNCTIONAL_MATCHES_HPP_INCLUDED_
|