Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/log/support/spirit_classic.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 /*! |
14 | 14 |
15 #ifndef BOOST_LOG_SUPPORT_SPIRIT_CLASSIC_HPP_INCLUDED_ | 15 #ifndef BOOST_LOG_SUPPORT_SPIRIT_CLASSIC_HPP_INCLUDED_ |
16 #define BOOST_LOG_SUPPORT_SPIRIT_CLASSIC_HPP_INCLUDED_ | 16 #define BOOST_LOG_SUPPORT_SPIRIT_CLASSIC_HPP_INCLUDED_ |
17 | 17 |
18 #include <boost/mpl/bool.hpp> | 18 #include <boost/mpl/bool.hpp> |
19 #include <boost/utility/enable_if.hpp> | |
19 #include <boost/log/detail/config.hpp> | 20 #include <boost/log/detail/config.hpp> |
20 #include <boost/log/utility/functional/matches.hpp> | 21 #include <boost/log/utility/functional/matches.hpp> |
21 | 22 |
22 #ifdef BOOST_HAS_PRAGMA_ONCE | 23 #ifdef BOOST_HAS_PRAGMA_ONCE |
23 #pragma once | 24 #pragma once |
35 * or even total ignorance of this macro, if the user has included Boost.Spirit | 36 * or even total ignorance of this macro, if the user has included Boost.Spirit |
36 * headers before including this header, or uses Boost.Spirit without the macro | 37 * headers before including this header, or uses Boost.Spirit without the macro |
37 * in other translation units. The only reliable way to settle this problem is to | 38 * in other translation units. The only reliable way to settle this problem is to |
38 * define the macro for the whole project (i.e. all translation units). | 39 * define the macro for the whole project (i.e. all translation units). |
39 */ | 40 */ |
40 #warning Boost.Log: Boost.Spirit requires BOOST_SPIRIT_THREADSAFE macro to be defined if parsers are used in a multithreaded context. It is strongly recommended to define this macro project-wide. | 41 #if defined(__GNUC__) |
42 #pragma message "Boost.Log: Boost.Spirit requires BOOST_SPIRIT_THREADSAFE macro to be defined if parsers are used in a multithreaded context. It is strongly recommended to define this macro project-wide." | |
43 #elif defined(_MSC_VER) | |
44 #pragma message("Boost.Log: Boost.Spirit requires BOOST_SPIRIT_THREADSAFE macro to be defined if parsers are used in a multithreaded context. It is strongly recommended to define this macro project-wide.") | |
45 #endif | |
41 #define BOOST_SPIRIT_THREADSAFE 1 | 46 #define BOOST_SPIRIT_THREADSAFE 1 |
42 #endif // !defined(BOOST_LOG_NO_THREADS) && !defined(BOOST_SPIRIT_THREADSAFE) | 47 #endif // !defined(BOOST_LOG_NO_THREADS) && !defined(BOOST_SPIRIT_THREADSAFE) |
43 | 48 |
44 #include <boost/spirit/include/classic_parser.hpp> | 49 #include <boost/spirit/include/classic_parser.hpp> |
45 | 50 |
49 | 54 |
50 BOOST_LOG_OPEN_NAMESPACE | 55 BOOST_LOG_OPEN_NAMESPACE |
51 | 56 |
52 namespace aux { | 57 namespace aux { |
53 | 58 |
59 //! This tag type is used if an expression is recognized as a Boost.Spirit.Classic expression | |
60 struct boost_spirit_classic_expression_tag; | |
61 | |
54 //! The trait verifies if the type can be converted to a Boost.Spirit (classic) parser | 62 //! The trait verifies if the type can be converted to a Boost.Spirit (classic) parser |
55 template< typename T > | 63 template< typename T > |
56 struct is_spirit_classic_parser< T, true > | 64 struct is_spirit_classic_parser |
57 { | 65 { |
58 private: | 66 private: |
59 typedef char yes_type; | 67 typedef char yes_type; |
60 struct no_type { char dummy[2]; }; | 68 struct no_type { char dummy[2]; }; |
61 | 69 |
67 public: | 75 public: |
68 enum { value = sizeof(check_spirit_classic_parser(get_T())) == sizeof(yes_type) }; | 76 enum { value = sizeof(check_spirit_classic_parser(get_T())) == sizeof(yes_type) }; |
69 typedef mpl::bool_< value > type; | 77 typedef mpl::bool_< value > type; |
70 }; | 78 }; |
71 | 79 |
72 //! The matching functor implementation | 80 //! The metafunction detects the matching expression kind and returns a tag that is used to specialize \c match_traits |
73 template< > | 81 template< typename ExpressionT > |
74 struct matches_fun_impl< boost_spirit_classic_expression_tag > | 82 struct matching_expression_kind< ExpressionT, typename boost::enable_if_c< is_spirit_classic_parser< ExpressionT >::value >::type > |
75 { | 83 { |
76 template< typename StringT, typename ParserT > | 84 typedef boost_spirit_classic_expression_tag type; |
77 static bool matches( | 85 }; |
78 StringT const& str, | 86 |
79 ParserT const& expr) | 87 //! The matching function implementation |
88 template< typename ExpressionT > | |
89 struct match_traits< ExpressionT, boost_spirit_classic_expression_tag > | |
90 { | |
91 typedef ExpressionT compiled_type; | |
92 static compiled_type compile(ExpressionT const& expr) { return expr; } | |
93 | |
94 template< typename StringT > | |
95 static bool matches(StringT const& str, ExpressionT const& expr) | |
80 { | 96 { |
81 typedef typename StringT::const_iterator const_iterator; | 97 typedef typename StringT::const_iterator const_iterator; |
82 spirit::classic::parse_info< const_iterator > info = | 98 spirit::classic::parse_info< const_iterator > info = |
83 spirit::classic::parse(str.begin(), str.end(), expr); | 99 spirit::classic::parse(str.begin(), str.end(), expr); |
84 return info.full; | 100 return info.full; |