Mercurial > hg > vamp-build-and-test
diff DEPENDENCIES/generic/include/boost/log/support/xpressive.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/log/support/xpressive.hpp Fri Sep 04 12:01:02 2015 +0100 +++ b/DEPENDENCIES/generic/include/boost/log/support/xpressive.hpp Mon Sep 07 11:12:49 2015 +0100 @@ -1,5 +1,5 @@ /* - * Copyright Andrey Semashev 2007 - 2013. + * Copyright Andrey Semashev 2007 - 2015. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -15,7 +15,7 @@ #ifndef BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_ #define BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_ -#include <boost/mpl/bool.hpp> +#include <string> #include <boost/xpressive/basic_regex.hpp> #include <boost/xpressive/regex_constants.hpp> #include <boost/xpressive/regex_algorithms.hpp> @@ -33,53 +33,34 @@ namespace aux { -//! The trait verifies if the type can be converted to a Boost.Xpressive regex +//! This tag type is used if an expression is recognized as a Boost.Xpressive expression +struct boost_xpressive_expression_tag; + +//! The metafunction detects the matching expression kind and returns a tag that is used to specialize \c match_traits template< typename T > -struct is_xpressive_regex< T, true > +struct matching_expression_kind< xpressive::basic_regex< T > > { -private: - typedef char yes_type; - struct no_type { char dummy[2]; }; - - template< typename U > - static yes_type check_xpressive_regex(xpressive::basic_regex< U > const&); - static no_type check_xpressive_regex(...); - static T& get_T(); - -public: - enum { value = sizeof(check_xpressive_regex(get_T())) == sizeof(yes_type) }; - typedef mpl::bool_< value > type; + typedef boost_xpressive_expression_tag type; }; -//! The regex matching functor implementation -template< > -struct matches_fun_impl< boost_xpressive_expression_tag > +//! The matching function implementation +template< typename ExpressionT > +struct match_traits< ExpressionT, boost_xpressive_expression_tag > { + typedef ExpressionT compiled_type; + static compiled_type compile(ExpressionT const& expr) { return expr; } + template< typename StringT, typename T > - static bool matches( - StringT const& str, - xpressive::basic_regex< T > const& expr, - xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default) + static bool matches(StringT const& str, xpressive::basic_regex< T > const& expr, xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default) { return xpressive::regex_match(str, expr, flags); } - template< typename StringT > - static bool matches( - StringT const& str, - xpressive::basic_regex< typename StringT::value_type* > const& expr, - xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default) + template< typename CharT, typename TraitsT, typename AllocatorT > + 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) { - return xpressive::regex_match(str.c_str(), expr, flags); - } - - template< typename StringT > - static bool matches( - StringT const& str, - xpressive::basic_regex< typename StringT::value_type const* > const& expr, - xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default) - { - return xpressive::regex_match(str.c_str(), expr, flags); + const CharT* p = str.c_str(); + return xpressive::regex_match(p, p + str.size(), expr, flags); } };