Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/log/support/regex.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
1 /* | 1 /* |
2 * Copyright Andrey Semashev 2007 - 2013. | 2 * Copyright Andrey Semashev 2007 - 2015. |
3 * Distributed under the Boost Software License, Version 1.0. | 3 * Distributed under the Boost Software License, Version 1.0. |
4 * (See accompanying file LICENSE_1_0.txt or copy at | 4 * (See accompanying file LICENSE_1_0.txt or copy at |
5 * http://www.boost.org/LICENSE_1_0.txt) | 5 * http://www.boost.org/LICENSE_1_0.txt) |
6 */ | 6 */ |
7 /*! | 7 /*! |
13 */ | 13 */ |
14 | 14 |
15 #ifndef BOOST_LOG_SUPPORT_REGEX_HPP_INCLUDED_ | 15 #ifndef BOOST_LOG_SUPPORT_REGEX_HPP_INCLUDED_ |
16 #define BOOST_LOG_SUPPORT_REGEX_HPP_INCLUDED_ | 16 #define BOOST_LOG_SUPPORT_REGEX_HPP_INCLUDED_ |
17 | 17 |
18 #include <string> | |
18 #include <boost/regex.hpp> | 19 #include <boost/regex.hpp> |
19 #include <boost/mpl/bool.hpp> | |
20 #include <boost/log/detail/config.hpp> | 20 #include <boost/log/detail/config.hpp> |
21 #include <boost/log/utility/functional/matches.hpp> | 21 #include <boost/log/utility/functional/matches.hpp> |
22 #include <boost/log/detail/header.hpp> | 22 #include <boost/log/detail/header.hpp> |
23 | 23 |
24 #ifdef BOOST_HAS_PRAGMA_ONCE | 24 #ifdef BOOST_HAS_PRAGMA_ONCE |
29 | 29 |
30 BOOST_LOG_OPEN_NAMESPACE | 30 BOOST_LOG_OPEN_NAMESPACE |
31 | 31 |
32 namespace aux { | 32 namespace aux { |
33 | 33 |
34 //! The trait verifies if the type can be converted to a Boost.Regex expression | 34 //! This tag type is used if an expression is recognized as a Boost.Regex expression |
35 template< typename T > | 35 struct boost_regex_expression_tag; |
36 struct is_regex< T, true > | 36 |
37 //! The metafunction detects the matching expression kind and returns a tag that is used to specialize \c match_traits | |
38 template< typename CharT, typename TraitsT > | |
39 struct matching_expression_kind< boost::basic_regex< CharT, TraitsT > > | |
37 { | 40 { |
38 private: | 41 typedef boost_regex_expression_tag type; |
39 typedef char yes_type; | |
40 struct no_type { char dummy[2]; }; | |
41 | |
42 template< typename CharT, typename TraitsT > | |
43 static yes_type check_regex(basic_regex< CharT, TraitsT > const&); | |
44 static no_type check_regex(...); | |
45 static T& get_T(); | |
46 | |
47 public: | |
48 enum { value = sizeof(check_regex(get_T())) == sizeof(yes_type) }; | |
49 typedef mpl::bool_< value > type; | |
50 }; | 42 }; |
51 | 43 |
52 //! The regex matching functor implementation | 44 //! The matching function implementation |
53 template< > | 45 template< typename ExpressionT > |
54 struct matches_fun_impl< boost_regex_expression_tag > | 46 struct match_traits< ExpressionT, boost_regex_expression_tag > |
55 { | 47 { |
48 typedef ExpressionT compiled_type; | |
49 static compiled_type compile(ExpressionT const& expr) { return expr; } | |
50 | |
56 template< typename StringT, typename CharT, typename TraitsT > | 51 template< typename StringT, typename CharT, typename TraitsT > |
57 static bool matches( | 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) |
58 StringT const& str, | |
59 basic_regex< CharT, TraitsT > const& expr, | |
60 match_flag_type flags = match_default) | |
61 { | 53 { |
62 return boost::regex_match(str.begin(), str.end(), expr, flags); | 54 return boost::regex_match(str.begin(), str.end(), expr, flags); |
55 } | |
56 | |
57 template< typename CharT, typename StringTraitsT, typename AllocatorT, typename ReTraitsT > | |
58 static bool matches( | |
59 std::basic_string< CharT, StringTraitsT, AllocatorT > const& str, | |
60 boost::basic_regex< CharT, ReTraitsT > const& expr, | |
61 boost::regex_constants::match_flag_type flags = boost::regex_constants::match_default) | |
62 { | |
63 const CharT* p = str.c_str(); | |
64 return boost::regex_match(p, p + str.size(), expr, flags); | |
63 } | 65 } |
64 }; | 66 }; |
65 | 67 |
66 } // namespace aux | 68 } // namespace aux |
67 | 69 |