File indexing completed on 2025-01-30 09:45:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_SUPPORT_STD_REGEX_HPP_INCLUDED_
0016 #define BOOST_LOG_SUPPORT_STD_REGEX_HPP_INCLUDED_
0017
0018 #include <boost/log/detail/config.hpp>
0019
0020 #ifdef BOOST_HAS_PRAGMA_ONCE
0021 #pragma once
0022 #endif
0023
0024 #if defined(BOOST_NO_CXX11_HDR_REGEX)
0025
0026 #if defined(__GNUC__)
0027 #pragma message "Boost.Log: This header requires support for std::regex in the standard library."
0028 #elif defined(_MSC_VER)
0029 #pragma message("Boost.Log: This header requires support for std::regex in the standard library.")
0030 #endif
0031
0032 #else
0033
0034 #include <regex>
0035 #include <string>
0036 #include <boost/log/utility/functional/matches.hpp>
0037 #include <boost/log/detail/header.hpp>
0038
0039 namespace boost {
0040
0041 BOOST_LOG_OPEN_NAMESPACE
0042
0043 namespace aux {
0044
0045
0046 struct std_regex_expression_tag;
0047
0048
0049 template< typename CharT, typename ReTraitsT >
0050 struct matching_expression_kind< std::basic_regex< CharT, ReTraitsT > >
0051 {
0052 typedef std_regex_expression_tag type;
0053 };
0054
0055
0056 template< typename ExpressionT >
0057 struct match_traits< ExpressionT, std_regex_expression_tag >
0058 {
0059 typedef ExpressionT compiled_type;
0060 static compiled_type compile(ExpressionT const& expr) { return expr; }
0061
0062 template< typename StringT, typename CharT, typename ReTraitsT >
0063 static bool matches(StringT const& str, std::basic_regex< CharT, ReTraitsT > const& expr, std::regex_constants::match_flag_type flags = std::regex_constants::match_default)
0064 {
0065 return std::regex_match(str.begin(), str.end(), expr, flags);
0066 }
0067
0068 template< typename CharT, typename StringTraitsT, typename AllocatorT, typename ReTraitsT >
0069 static bool matches(std::basic_string< CharT, StringTraitsT, AllocatorT > const& str, std::basic_regex< CharT, ReTraitsT > const& expr, std::regex_constants::match_flag_type flags = std::regex_constants::match_default)
0070 {
0071 const CharT* p = str.c_str();
0072 return std::regex_match(p, p + str.size(), expr, flags);
0073 }
0074 };
0075
0076 }
0077
0078 BOOST_LOG_CLOSE_NAMESPACE
0079
0080 }
0081
0082 #include <boost/log/detail/footer.hpp>
0083
0084 #endif
0085
0086 #endif