File indexing completed on 2025-01-18 09:39:20
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_DETAIL_ATTRIBUTE_PREDICATE_HPP_INCLUDED_
0016 #define BOOST_LOG_DETAIL_ATTRIBUTE_PREDICATE_HPP_INCLUDED_
0017
0018 #include <boost/phoenix/core/actor.hpp>
0019 #include <boost/utility/result_of.hpp>
0020 #include <boost/log/detail/config.hpp>
0021 #include <boost/log/attributes/attribute_name.hpp>
0022 #include <boost/log/attributes/value_visitation.hpp>
0023 #include <boost/log/attributes/fallback_policy.hpp>
0024 #include <boost/log/utility/functional/bind.hpp>
0025 #include <boost/log/utility/functional/save_result.hpp>
0026 #include <boost/log/detail/header.hpp>
0027
0028 #ifdef BOOST_HAS_PRAGMA_ONCE
0029 #pragma once
0030 #endif
0031
0032 namespace boost {
0033
0034 BOOST_LOG_OPEN_NAMESPACE
0035
0036 namespace expressions {
0037
0038 namespace aux {
0039
0040
0041
0042
0043 template< typename T, typename ArgT, typename PredicateT, typename FallbackPolicyT = fallback_to_none >
0044 class attribute_predicate
0045 {
0046 public:
0047
0048 typedef bool result_type;
0049
0050 typedef T value_type;
0051
0052 typedef PredicateT predicate_type;
0053
0054 typedef ArgT argument_type;
0055
0056 typedef FallbackPolicyT fallback_policy;
0057
0058 private:
0059
0060 const argument_type m_arg;
0061
0062 const attribute_name m_name;
0063
0064 value_visitor_invoker< value_type, fallback_policy > m_visitor_invoker;
0065
0066 public:
0067
0068
0069
0070
0071
0072
0073 attribute_predicate(attribute_name const& name, argument_type const& pred_arg) : m_arg(pred_arg), m_name(name)
0074 {
0075 }
0076
0077
0078
0079
0080
0081
0082
0083
0084 template< typename U >
0085 attribute_predicate(attribute_name const& name, argument_type const& pred_arg, U const& arg) : m_arg(pred_arg), m_name(name), m_visitor_invoker(arg)
0086 {
0087 }
0088
0089
0090
0091
0092
0093
0094
0095 template< typename ArgumentT >
0096 result_type operator() (ArgumentT const& arg) const
0097 {
0098 typedef binder2nd< predicate_type, argument_type const& > visitor_type;
0099
0100 bool res = false;
0101 m_visitor_invoker(m_name, arg, boost::log::save_result(visitor_type(predicate_type(), m_arg), res));
0102 return res;
0103 }
0104 };
0105
0106 }
0107
0108 }
0109
0110 BOOST_LOG_CLOSE_NAMESPACE
0111
0112 }
0113
0114 #include <boost/log/detail/footer.hpp>
0115
0116 #endif