12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef BOOST_LOG_SUPPORT_REGEX_HPP_INCLUDED_
- #define BOOST_LOG_SUPPORT_REGEX_HPP_INCLUDED_
- #include <string>
- #include <boost/regex.hpp>
- #include <boost/log/detail/config.hpp>
- #include <boost/log/utility/functional/matches.hpp>
- #include <boost/log/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- namespace boost {
- BOOST_LOG_OPEN_NAMESPACE
- namespace aux {
- struct boost_regex_expression_tag;
- template< typename CharT, typename TraitsT >
- struct matching_expression_kind< boost::basic_regex< CharT, TraitsT > >
- {
- typedef boost_regex_expression_tag type;
- };
- template< typename ExpressionT >
- struct match_traits< ExpressionT, boost_regex_expression_tag >
- {
- typedef ExpressionT compiled_type;
- static compiled_type compile(ExpressionT const& expr) { return expr; }
- template< typename StringT, typename CharT, typename TraitsT >
- 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)
- {
- return boost::regex_match(str.begin(), str.end(), expr, flags);
- }
- template< typename CharT, typename StringTraitsT, typename AllocatorT, typename ReTraitsT >
- static bool matches(
- std::basic_string< CharT, StringTraitsT, AllocatorT > const& str,
- boost::basic_regex< CharT, ReTraitsT > const& expr,
- boost::regex_constants::match_flag_type flags = boost::regex_constants::match_default)
- {
- const CharT* p = str.c_str();
- return boost::regex_match(p, p + str.size(), expr, flags);
- }
- };
- }
- BOOST_LOG_CLOSE_NAMESPACE
- }
- #include <boost/log/detail/footer.hpp>
- #endif
|