annotate DEPENDENCIES/generic/include/boost/log/support/xpressive.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
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 support/xpressive.hpp
Chris@16 9 * \author Andrey Semashev
Chris@16 10 * \date 18.07.2009
Chris@16 11 *
Chris@16 12 * This header enables Boost.Xpressive support for Boost.Log.
Chris@16 13 */
Chris@16 14
Chris@16 15 #ifndef BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_
Chris@16 16 #define BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_
Chris@16 17
Chris@101 18 #include <string>
Chris@16 19 #include <boost/xpressive/basic_regex.hpp>
Chris@16 20 #include <boost/xpressive/regex_constants.hpp>
Chris@16 21 #include <boost/xpressive/regex_algorithms.hpp>
Chris@16 22 #include <boost/log/detail/config.hpp>
Chris@16 23 #include <boost/log/utility/functional/matches.hpp>
Chris@16 24 #include <boost/log/detail/header.hpp>
Chris@16 25
Chris@16 26 #ifdef BOOST_HAS_PRAGMA_ONCE
Chris@16 27 #pragma once
Chris@16 28 #endif
Chris@16 29
Chris@16 30 namespace boost {
Chris@16 31
Chris@16 32 BOOST_LOG_OPEN_NAMESPACE
Chris@16 33
Chris@16 34 namespace aux {
Chris@16 35
Chris@101 36 //! This tag type is used if an expression is recognized as a Boost.Xpressive expression
Chris@101 37 struct boost_xpressive_expression_tag;
Chris@101 38
Chris@101 39 //! The metafunction detects the matching expression kind and returns a tag that is used to specialize \c match_traits
Chris@16 40 template< typename T >
Chris@101 41 struct matching_expression_kind< xpressive::basic_regex< T > >
Chris@16 42 {
Chris@101 43 typedef boost_xpressive_expression_tag type;
Chris@16 44 };
Chris@16 45
Chris@101 46 //! The matching function implementation
Chris@101 47 template< typename ExpressionT >
Chris@101 48 struct match_traits< ExpressionT, boost_xpressive_expression_tag >
Chris@16 49 {
Chris@101 50 typedef ExpressionT compiled_type;
Chris@101 51 static compiled_type compile(ExpressionT const& expr) { return expr; }
Chris@101 52
Chris@16 53 template< typename StringT, typename T >
Chris@101 54 static bool matches(StringT const& str, xpressive::basic_regex< T > const& expr, xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default)
Chris@16 55 {
Chris@16 56 return xpressive::regex_match(str, expr, flags);
Chris@16 57 }
Chris@16 58
Chris@101 59 template< typename CharT, typename TraitsT, typename AllocatorT >
Chris@101 60 static bool matches(std::basic_string< CharT, TraitsT, AllocatorT > const& str, xpressive::basic_regex< const CharT* > const& expr, xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default)
Chris@16 61 {
Chris@101 62 const CharT* p = str.c_str();
Chris@101 63 return xpressive::regex_match(p, p + str.size(), expr, flags);
Chris@16 64 }
Chris@16 65 };
Chris@16 66
Chris@16 67 } // namespace aux
Chris@16 68
Chris@16 69 BOOST_LOG_CLOSE_NAMESPACE // namespace log
Chris@16 70
Chris@16 71 } // namespace boost
Chris@16 72
Chris@16 73 #include <boost/log/detail/footer.hpp>
Chris@16 74
Chris@16 75 #endif // BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_