123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #ifndef BOOST_LOG_DETAIL_ATTRIBUTE_PREDICATE_HPP_INCLUDED_
- #define BOOST_LOG_DETAIL_ATTRIBUTE_PREDICATE_HPP_INCLUDED_
- #include <boost/phoenix/core/actor.hpp>
- #include <boost/utility/result_of.hpp>
- #include <boost/log/detail/config.hpp>
- #include <boost/log/attributes/attribute_name.hpp>
- #include <boost/log/attributes/value_visitation.hpp>
- #include <boost/log/attributes/fallback_policy.hpp>
- #include <boost/log/utility/functional/bind.hpp>
- #include <boost/log/utility/functional/save_result.hpp>
- #include <boost/log/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- namespace boost {
- BOOST_LOG_OPEN_NAMESPACE
- namespace expressions {
- namespace aux {
- template< typename T, typename ArgT, typename PredicateT, typename FallbackPolicyT = fallback_to_none >
- class attribute_predicate
- {
- public:
-
- typedef bool result_type;
-
- typedef T value_type;
-
- typedef PredicateT predicate_type;
-
- typedef ArgT argument_type;
-
- typedef FallbackPolicyT fallback_policy;
- private:
-
- const argument_type m_arg;
-
- const attribute_name m_name;
-
- value_visitor_invoker< value_type, fallback_policy > m_visitor_invoker;
- public:
-
- attribute_predicate(attribute_name const& name, argument_type const& pred_arg) : m_arg(pred_arg), m_name(name)
- {
- }
-
- template< typename U >
- 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)
- {
- }
-
- template< typename ArgumentT >
- result_type operator() (ArgumentT const& arg) const
- {
- typedef binder2nd< predicate_type, argument_type const& > visitor_type;
- bool res = false;
- m_visitor_invoker(m_name, arg, boost::log::save_result(visitor_type(predicate_type(), m_arg), res));
- return res;
- }
- };
- }
- }
- BOOST_LOG_CLOSE_NAMESPACE
- }
- #include <boost/log/detail/footer.hpp>
- #endif
|