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