annotate DEPENDENCIES/generic/include/boost/log/support/xpressive.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
rev   line source
Chris@16 1 /*
Chris@16 2 * Copyright Andrey Semashev 2007 - 2013.
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@16 18 #include <boost/mpl/bool.hpp>
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@16 36 //! The trait verifies if the type can be converted to a Boost.Xpressive regex
Chris@16 37 template< typename T >
Chris@16 38 struct is_xpressive_regex< T, true >
Chris@16 39 {
Chris@16 40 private:
Chris@16 41 typedef char yes_type;
Chris@16 42 struct no_type { char dummy[2]; };
Chris@16 43
Chris@16 44 template< typename U >
Chris@16 45 static yes_type check_xpressive_regex(xpressive::basic_regex< U > const&);
Chris@16 46 static no_type check_xpressive_regex(...);
Chris@16 47 static T& get_T();
Chris@16 48
Chris@16 49 public:
Chris@16 50 enum { value = sizeof(check_xpressive_regex(get_T())) == sizeof(yes_type) };
Chris@16 51 typedef mpl::bool_< value > type;
Chris@16 52 };
Chris@16 53
Chris@16 54 //! The regex matching functor implementation
Chris@16 55 template< >
Chris@16 56 struct matches_fun_impl< boost_xpressive_expression_tag >
Chris@16 57 {
Chris@16 58 template< typename StringT, typename T >
Chris@16 59 static bool matches(
Chris@16 60 StringT const& str,
Chris@16 61 xpressive::basic_regex< T > const& expr,
Chris@16 62 xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default)
Chris@16 63 {
Chris@16 64 return xpressive::regex_match(str, expr, flags);
Chris@16 65 }
Chris@16 66
Chris@16 67 template< typename StringT >
Chris@16 68 static bool matches(
Chris@16 69 StringT const& str,
Chris@16 70 xpressive::basic_regex< typename StringT::value_type* > const& expr,
Chris@16 71 xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default)
Chris@16 72 {
Chris@16 73 return xpressive::regex_match(str.c_str(), expr, flags);
Chris@16 74 }
Chris@16 75
Chris@16 76 template< typename StringT >
Chris@16 77 static bool matches(
Chris@16 78 StringT const& str,
Chris@16 79 xpressive::basic_regex< typename StringT::value_type const* > const& expr,
Chris@16 80 xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default)
Chris@16 81 {
Chris@16 82 return xpressive::regex_match(str.c_str(), expr, flags);
Chris@16 83 }
Chris@16 84 };
Chris@16 85
Chris@16 86 } // namespace aux
Chris@16 87
Chris@16 88 BOOST_LOG_CLOSE_NAMESPACE // namespace log
Chris@16 89
Chris@16 90 } // namespace boost
Chris@16 91
Chris@16 92 #include <boost/log/detail/footer.hpp>
Chris@16 93
Chris@16 94 #endif // BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_