stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork

This commit is contained in:
2026-02-24 18:38:47 +00:00
parent da8c28aaeb
commit 65cb2619a7
13106 changed files with 2484322 additions and 1804 deletions
@@ -0,0 +1,129 @@
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file begins_with.hpp
* \author Andrey Semashev
* \date 02.09.2012
*
* The header contains implementation of a \c begins_with predicate in template expressions.
*/
#ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_BEGINS_WITH_HPP_INCLUDED_
#define BOOST_LOG_EXPRESSIONS_PREDICATES_BEGINS_WITH_HPP_INCLUDED_
#include <boost/phoenix/core/actor.hpp>
#include <boost/log/detail/config.hpp>
#include <boost/log/detail/embedded_string_type.hpp>
#include <boost/log/detail/unary_function_terminal.hpp>
#include <boost/log/detail/attribute_predicate.hpp>
#include <boost/log/attributes/attribute_name.hpp>
#include <boost/log/attributes/fallback_policy.hpp>
#include <boost/log/expressions/attr_fwd.hpp>
#include <boost/log/expressions/keyword_fwd.hpp>
#include <boost/log/utility/functional/begins_with.hpp>
#include <boost/log/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
/*!
* The predicate checks if the attribute value begins with a substring. The attribute value is assumed to be of a string type.
*/
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template< typename T, typename SubstringT, typename FallbackPolicyT = fallback_to_none >
using attribute_begins_with = aux::attribute_predicate< T, SubstringT, begins_with_fun, FallbackPolicyT >;
#else // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template< typename T, typename SubstringT, typename FallbackPolicyT = fallback_to_none >
class attribute_begins_with :
public aux::attribute_predicate< T, SubstringT, begins_with_fun, FallbackPolicyT >
{
typedef aux::attribute_predicate< T, SubstringT, begins_with_fun, FallbackPolicyT > base_type;
public:
/*!
* Initializing constructor
*
* \param name Attribute name
* \param substring The expected attribute value beginning
*/
attribute_begins_with(attribute_name const& name, SubstringT const& substring) : base_type(name, substring)
{
}
/*!
* Initializing constructor
*
* \param name Attribute name
* \param substring The expected attribute value beginning
* \param arg Additional parameter for the fallback policy
*/
template< typename U >
attribute_begins_with(attribute_name const& name, SubstringT const& substring, U const& arg) : base_type(name, substring, arg)
{
}
};
#endif // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, begins with the specified substring.
*/
template< typename T, typename FallbackPolicyT, typename TagT, template< typename > class ActorT, typename SubstringT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_begins_with< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type, FallbackPolicyT > > >
begins_with(attribute_actor< T, FallbackPolicyT, TagT, ActorT > const& attr, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_begins_with< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type, FallbackPolicyT > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(attr.get_name(), substring, attr.get_fallback_policy()) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, begins with the specified substring.
*/
template< typename DescriptorT, template< typename > class ActorT, typename SubstringT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_begins_with< typename DescriptorT::value_type, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > >
begins_with(attribute_keyword< DescriptorT, ActorT > const&, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_begins_with< typename DescriptorT::value_type, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(DescriptorT::get_name(), substring) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, begins with the specified substring.
*/
template< typename T, typename SubstringT >
BOOST_FORCEINLINE phoenix::actor< aux::unary_function_terminal< attribute_begins_with< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > >
begins_with(attribute_name const& name, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_begins_with< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > terminal_type;
phoenix::actor< terminal_type > act = {{ terminal_type(name, substring) }};
return act;
}
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#include <boost/log/detail/footer.hpp>
#endif // BOOST_LOG_EXPRESSIONS_PREDICATES_BEGINS_WITH_HPP_INCLUDED_
@@ -0,0 +1,574 @@
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file channel_severity_filter.hpp
* \author Andrey Semashev
* \date 25.11.2012
*
* The header contains implementation of a minimal severity per channel filter.
*/
#ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_CHANNEL_SEVERITY_FILTER_HPP_INCLUDED_
#define BOOST_LOG_EXPRESSIONS_PREDICATES_CHANNEL_SEVERITY_FILTER_HPP_INCLUDED_
#include <map>
#include <memory>
#include <utility>
#include <boost/phoenix/core/actor.hpp>
#include <boost/phoenix/core/terminal_fwd.hpp>
#include <boost/phoenix/core/is_nullary.hpp>
#include <boost/phoenix/core/environment.hpp>
#include <boost/fusion/sequence/intrinsic/at_c.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/log/detail/config.hpp>
#include <boost/log/detail/custom_terminal_spec.hpp>
#include <boost/log/attributes/attribute_name.hpp>
#include <boost/log/attributes/fallback_policy.hpp>
#include <boost/log/attributes/value_visitation.hpp>
#include <boost/log/utility/functional/logical.hpp>
#include <boost/log/expressions/attr_fwd.hpp>
#include <boost/log/expressions/keyword_fwd.hpp>
#include <boost/log/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
template<
typename ChannelT,
typename SeverityT,
typename ChannelFallbackT = fallback_to_none,
typename SeverityFallbackT = fallback_to_none,
typename ChannelOrderT = less,
typename SeverityCompareT = greater_equal,
typename AllocatorT = std::allocator< void >
>
class channel_severity_filter_terminal
{
public:
#ifndef BOOST_LOG_DOXYGEN_PASS
//! Internal typedef for type categorization
typedef void _is_boost_log_terminal;
#endif
//! Function result type
typedef bool result_type;
//! Channel attribute value type
typedef ChannelT channel_value_type;
//! Channel fallback policy
typedef ChannelFallbackT channel_fallback_policy;
//! Severity level attribute value type
typedef SeverityT severity_value_type;
//! Severity level fallback policy
typedef SeverityFallbackT severity_fallback_policy;
private:
//! Channel to severity mapping type
typedef std::map<
channel_value_type,
severity_value_type,
ChannelOrderT,
typename AllocatorT::BOOST_NESTED_TEMPLATE rebind< std::pair< const channel_value_type, severity_value_type > >::other
> mapping_type;
//! Attribute value visitor invoker for channel
typedef value_visitor_invoker< channel_value_type, channel_fallback_policy > channel_visitor_invoker_type;
//! Attribute value visitor invoker for severity level
typedef value_visitor_invoker< severity_value_type, severity_fallback_policy > severity_visitor_invoker_type;
//! Channel visitor
template< typename ArgT >
struct channel_visitor
{
typedef void result_type;
channel_visitor(channel_severity_filter_terminal const& self, ArgT arg, bool& res) : m_self(self), m_arg(arg), m_res(res)
{
}
result_type operator() (channel_value_type const& channel) const
{
m_self.visit_channel(channel, m_arg, m_res);
}
private:
channel_severity_filter_terminal const& m_self;
ArgT m_arg;
bool& m_res;
};
//! Severity level visitor
struct severity_visitor
{
typedef void result_type;
severity_visitor(channel_severity_filter_terminal const& self, severity_value_type const& severity, bool& res) : m_self(self), m_severity(severity), m_res(res)
{
}
result_type operator() (severity_value_type const& severity) const
{
m_self.visit_severity(severity, m_severity, m_res);
}
private:
channel_severity_filter_terminal const& m_self;
severity_value_type const& m_severity;
bool& m_res;
};
private:
//! Channel attribute name
attribute_name m_channel_name;
//! Severity level attribute name
attribute_name m_severity_name;
//! Channel value visitor invoker
channel_visitor_invoker_type m_channel_visitor_invoker;
//! Severity level value visitor invoker
severity_visitor_invoker_type m_severity_visitor_invoker;
//! Channel to severity level mapping
mapping_type m_mapping;
//! Severity checking predicate
SeverityCompareT m_severity_compare;
//! Default result
bool m_default;
public:
//! Initializing constructor
channel_severity_filter_terminal
(
attribute_name const& channel_name,
attribute_name const& severity_name,
channel_fallback_policy const& channel_fallback = channel_fallback_policy(),
severity_fallback_policy const& severity_fallback = severity_fallback_policy(),
ChannelOrderT const& channel_order = ChannelOrderT(),
SeverityCompareT const& severity_compare = SeverityCompareT()
) :
m_channel_name(channel_name),
m_severity_name(severity_name),
m_channel_visitor_invoker(channel_fallback),
m_severity_visitor_invoker(severity_fallback),
m_mapping(channel_order),
m_severity_compare(severity_compare),
m_default(false)
{
}
//! Adds a new element to the mapping
void add(channel_value_type const& channel, severity_value_type const& severity)
{
typedef typename mapping_type::iterator iterator;
std::pair< iterator, bool > res = m_mapping.insert(typename mapping_type::value_type(channel, severity));
if (!res.second)
res.first->second = severity;
}
//! Sets the default result of the predicate
void set_default(bool def)
{
m_default = def;
}
//! Invokation operator
template< typename ContextT >
result_type operator() (ContextT const& ctx) const
{
result_type res = m_default;
typedef typename remove_cv<
typename remove_reference< typename phoenix::result_of::env< ContextT >::type >::type
>::type env_type;
typedef typename env_type::args_type args_type;
typedef typename fusion::result_of::at_c< args_type, 0 >::type arg_type;
arg_type arg = fusion::at_c< 0 >(phoenix::env(ctx).args());
m_channel_visitor_invoker(m_channel_name, arg, channel_visitor< arg_type >(*this, arg, res));
return res;
}
private:
//! Visits channel name
template< typename ArgT >
void visit_channel(channel_value_type const& channel, ArgT const& arg, bool& res) const
{
typename mapping_type::const_iterator it = m_mapping.find(channel);
if (it != m_mapping.end())
{
m_severity_visitor_invoker(m_severity_name, arg, severity_visitor(*this, it->second, res));
}
}
//! Visits severity level
void visit_severity(severity_value_type const& left, severity_value_type const& right, bool& res) const
{
res = m_severity_compare(left, right);
}
};
template<
typename ChannelT,
typename SeverityT,
typename ChannelFallbackT = fallback_to_none,
typename SeverityFallbackT = fallback_to_none,
typename ChannelOrderT = less,
typename SeverityCompareT = greater_equal,
typename AllocatorT = std::allocator< void >,
template< typename > class ActorT = phoenix::actor
>
class channel_severity_filter_actor :
public ActorT< channel_severity_filter_terminal< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, AllocatorT > >
{
private:
//! Self type
typedef channel_severity_filter_actor this_type;
public:
//! Terminal type
typedef channel_severity_filter_terminal< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, AllocatorT > terminal_type;
//! Base actor type
typedef ActorT< terminal_type > base_type;
//! Channel attribute value type
typedef typename terminal_type::channel_value_type channel_value_type;
//! Channel fallback policy
typedef typename terminal_type::channel_fallback_policy channel_fallback_policy;
//! Severity level attribute value type
typedef typename terminal_type::severity_value_type severity_value_type;
//! Severity level fallback policy
typedef typename terminal_type::severity_fallback_policy severity_fallback_policy;
private:
//! An auxiliary pseudo-reference to implement insertion through subscript operator
class subscript_result
{
private:
channel_severity_filter_actor& m_owner;
channel_value_type const& m_channel;
public:
subscript_result(channel_severity_filter_actor& owner, channel_value_type const& channel) : m_owner(owner), m_channel(channel)
{
}
void operator= (severity_value_type const& severity)
{
m_owner.add(m_channel, severity);
}
};
public:
//! Initializing constructor
explicit channel_severity_filter_actor(base_type const& act) : base_type(act)
{
}
//! Copy constructor
channel_severity_filter_actor(channel_severity_filter_actor const& that) : base_type(static_cast< base_type const& >(that))
{
}
//! Sets the default function result
this_type& set_default(bool def)
{
this->proto_expr_.child0.set_default(def);
return *this;
}
//! Adds a new element to the mapping
this_type& add(channel_value_type const& channel, severity_value_type const& severity)
{
this->proto_expr_.child0.add(channel, severity);
return *this;
}
//! Alternative interface for adding a new element to the mapping
subscript_result operator[] (channel_value_type const& channel)
{
return subscript_result(*this, channel);
}
};
/*!
* The function generates a filtering predicate that checks the severity levels of log records in different channels. The predicate will return \c true
* if the record severity level is not less than the threshold for the channel the record belongs to.
*/
template< typename ChannelT, typename SeverityT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT >
channel_severity_filter(attribute_name const& channel_name, attribute_name const& severity_name)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_name) }};
return result_type(act);
}
//! \overload
template< typename SeverityT, typename ChannelDescriptorT, template< typename > class ActorT >
BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, less, greater_equal, std::allocator< void >, ActorT >
channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_name const& severity_name)
{
typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, less, greater_equal, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_name) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename SeverityDescriptorT, template< typename > class ActorT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, greater_equal, std::allocator< void >, ActorT >
channel_severity_filter(attribute_name const& channel_name, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword)
{
typedef channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, greater_equal, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_keyword.get_name()) }};
return result_type(act);
}
//! \overload
template< typename ChannelDescriptorT, typename SeverityDescriptorT, template< typename > class ActorT >
BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, greater_equal, std::allocator< void >, ActorT >
channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword)
{
typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, greater_equal, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_keyword.get_name()) }};
return result_type(act);
}
//! \overload
template< typename SeverityT, typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, template< typename > class ActorT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, less, greater_equal, std::allocator< void >, ActorT >
channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_name const& severity_name)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, less, greater_equal, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_name, channel_placeholder.get_fallback_policy()) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, less, greater_equal, std::allocator< void >, ActorT >
channel_severity_filter(attribute_name const& channel_name, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, less, greater_equal, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_placeholder.get_name(), fallback_to_none(), severity_placeholder.get_fallback_policy()) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, less, greater_equal, std::allocator< void >, ActorT >
channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, less, greater_equal, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_placeholder.get_name(), channel_placeholder.get_fallback_policy(), severity_placeholder.get_fallback_policy()) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename SeverityT, typename SeverityCompareT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, fallback_to_none, less, SeverityCompareT >
channel_severity_filter(attribute_name const& channel_name, attribute_name const& severity_name, SeverityCompareT const& severity_compare)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, fallback_to_none, less, SeverityCompareT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_name, fallback_to_none(), fallback_to_none(), less(), severity_compare) }};
return result_type(act);
}
//! \overload
template< typename SeverityT, typename ChannelDescriptorT, template< typename > class ActorT, typename SeverityCompareT >
BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, less, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_name const& severity_name, SeverityCompareT const& severity_compare)
{
typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, less, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_name, fallback_to_none(), fallback_to_none(), less(), severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename SeverityDescriptorT, template< typename > class ActorT, typename SeverityCompareT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_name const& channel_name, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword, SeverityCompareT const& severity_compare)
{
typedef channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_keyword.get_name(), fallback_to_none(), fallback_to_none(), less(), severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelDescriptorT, typename SeverityDescriptorT, template< typename > class ActorT, typename SeverityCompareT >
BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword, SeverityCompareT const& severity_compare)
{
typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, less, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_keyword.get_name(), fallback_to_none(), fallback_to_none(), less(), severity_compare) }};
return result_type(act);
}
//! \overload
template< typename SeverityT, typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, template< typename > class ActorT, typename SeverityCompareT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, less, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_name const& severity_name, SeverityCompareT const& severity_compare)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, less, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_name, channel_placeholder.get_fallback_policy(), fallback_to_none(), less(), severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT, typename SeverityCompareT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, less, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_name const& channel_name, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder, SeverityCompareT const& severity_compare)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, less, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_placeholder.get_name(), fallback_to_none(), severity_placeholder.get_fallback_policy(), less(), severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT, typename SeverityCompareT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, less, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder, SeverityCompareT const& severity_compare)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, less, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_placeholder.get_name(), channel_placeholder.get_fallback_policy(), severity_placeholder.get_fallback_policy(), less(), severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename SeverityT, typename SeverityCompareT, typename ChannelOrderT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT >
channel_severity_filter(attribute_name const& channel_name, attribute_name const& severity_name, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_name, fallback_to_none(), fallback_to_none(), channel_order, severity_compare) }};
return result_type(act);
}
//! \overload
template< typename SeverityT, typename ChannelDescriptorT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT >
BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_name const& severity_name, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order)
{
typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, SeverityT, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_name, fallback_to_none(), fallback_to_none(), channel_order, severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename SeverityDescriptorT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_name const& channel_name, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order)
{
typedef channel_severity_filter_actor< ChannelT, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_keyword.get_name(), fallback_to_none(), fallback_to_none(), channel_order, severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelDescriptorT, typename SeverityDescriptorT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT >
BOOST_FORCEINLINE channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_keyword< ChannelDescriptorT, ActorT > const& channel_keyword, attribute_keyword< SeverityDescriptorT, ActorT > const& severity_keyword, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order)
{
typedef channel_severity_filter_actor< typename ChannelDescriptorT::value_type, typename SeverityDescriptorT::value_type, fallback_to_none, fallback_to_none, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_keyword.get_name(), severity_keyword.get_name(), fallback_to_none(), fallback_to_none(), channel_order, severity_compare) }};
return result_type(act);
}
//! \overload
template< typename SeverityT, typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_name const& severity_name, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, fallback_to_none, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_name, channel_placeholder.get_fallback_policy(), fallback_to_none(), channel_order, severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_name const& channel_name, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, fallback_to_none, SeverityFallbackT, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_name, severity_placeholder.get_name(), fallback_to_none(), severity_placeholder.get_fallback_policy(), channel_order, severity_compare) }};
return result_type(act);
}
//! \overload
template< typename ChannelT, typename ChannelFallbackT, typename ChannelTagT, typename SeverityT, typename SeverityFallbackT, typename SeverityTagT, template< typename > class ActorT, typename SeverityCompareT, typename ChannelOrderT >
BOOST_FORCEINLINE channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT >
channel_severity_filter(attribute_actor< ChannelT, ChannelFallbackT, ChannelTagT, ActorT > const& channel_placeholder, attribute_actor< SeverityT, SeverityFallbackT, SeverityTagT, ActorT > const& severity_placeholder, SeverityCompareT const& severity_compare, ChannelOrderT const& channel_order)
{
typedef channel_severity_filter_actor< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, std::allocator< void >, ActorT > result_type;
typedef typename result_type::terminal_type terminal_type;
typename result_type::base_type act = {{ terminal_type(channel_placeholder.get_name(), severity_placeholder.get_name(), channel_placeholder.get_fallback_policy(), severity_placeholder.get_fallback_policy(), channel_order, severity_compare) }};
return result_type(act);
}
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
#ifndef BOOST_LOG_DOXYGEN_PASS
namespace phoenix {
namespace result_of {
template<
typename ChannelT,
typename SeverityT,
typename ChannelFallbackT,
typename SeverityFallbackT,
typename ChannelOrderT,
typename SeverityCompareT,
typename AllocatorT
>
struct is_nullary< custom_terminal< boost::log::expressions::channel_severity_filter_terminal< ChannelT, SeverityT, ChannelFallbackT, SeverityFallbackT, ChannelOrderT, SeverityCompareT, AllocatorT > > > :
public mpl::false_
{
};
} // namespace result_of
} // namespace phoenix
#endif
} // namespace boost
#include <boost/log/detail/footer.hpp>
#endif // BOOST_LOG_EXPRESSIONS_PREDICATES_CHANNEL_SEVERITY_FILTER_HPP_INCLUDED_
@@ -0,0 +1,129 @@
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file contains.hpp
* \author Andrey Semashev
* \date 02.09.2012
*
* The header contains implementation of a \c contains predicate in template expressions.
*/
#ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_CONTAINS_HPP_INCLUDED_
#define BOOST_LOG_EXPRESSIONS_PREDICATES_CONTAINS_HPP_INCLUDED_
#include <boost/phoenix/core/actor.hpp>
#include <boost/log/detail/config.hpp>
#include <boost/log/detail/embedded_string_type.hpp>
#include <boost/log/detail/unary_function_terminal.hpp>
#include <boost/log/detail/attribute_predicate.hpp>
#include <boost/log/expressions/attr_fwd.hpp>
#include <boost/log/expressions/keyword_fwd.hpp>
#include <boost/log/attributes/attribute_name.hpp>
#include <boost/log/attributes/fallback_policy.hpp>
#include <boost/log/utility/functional/contains.hpp>
#include <boost/log/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
/*!
* The predicate checks if the attribute value contains a substring. The attribute value is assumed to be of a string type.
*/
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template< typename T, typename SubstringT, typename FallbackPolicyT = fallback_to_none >
using attribute_contains = aux::attribute_predicate< T, SubstringT, contains_fun, FallbackPolicyT >;
#else // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template< typename T, typename SubstringT, typename FallbackPolicyT = fallback_to_none >
class attribute_contains :
public aux::attribute_predicate< T, SubstringT, contains_fun, FallbackPolicyT >
{
typedef aux::attribute_predicate< T, SubstringT, contains_fun, FallbackPolicyT > base_type;
public:
/*!
* Initializing constructor
*
* \param name Attribute name
* \param substring The expected attribute value substring
*/
attribute_contains(attribute_name const& name, SubstringT const& substring) : base_type(name, substring)
{
}
/*!
* Initializing constructor
*
* \param name Attribute name
* \param substring The expected attribute value substring
* \param arg Additional parameter for the fallback policy
*/
template< typename U >
attribute_contains(attribute_name const& name, SubstringT const& substring, U const& arg) : base_type(name, substring, arg)
{
}
};
#endif // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, contains the specified substring.
*/
template< typename T, typename FallbackPolicyT, typename TagT, template< typename > class ActorT, typename SubstringT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_contains< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type, FallbackPolicyT > > >
contains(attribute_actor< T, FallbackPolicyT, TagT, ActorT > const& attr, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_contains< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type, FallbackPolicyT > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(attr.get_name(), substring, attr.get_fallback_policy()) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, contains the specified substring.
*/
template< typename DescriptorT, template< typename > class ActorT, typename SubstringT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_contains< typename DescriptorT::value_type, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > >
contains(attribute_keyword< DescriptorT, ActorT > const&, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_contains< typename DescriptorT::value_type, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(DescriptorT::get_name(), substring) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, contains the specified substring.
*/
template< typename T, typename SubstringT >
BOOST_FORCEINLINE phoenix::actor< aux::unary_function_terminal< attribute_contains< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > >
contains(attribute_name const& name, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_contains< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > terminal_type;
phoenix::actor< terminal_type > act = {{ terminal_type(name, substring) }};
return act;
}
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#include <boost/log/detail/footer.hpp>
#endif // BOOST_LOG_EXPRESSIONS_PREDICATES_CONTAINS_HPP_INCLUDED_
@@ -0,0 +1,129 @@
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file ends_with.hpp
* \author Andrey Semashev
* \date 02.09.2012
*
* The header contains implementation of a \c ends_with predicate in template expressions.
*/
#ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_ENDS_WITH_HPP_INCLUDED_
#define BOOST_LOG_EXPRESSIONS_PREDICATES_ENDS_WITH_HPP_INCLUDED_
#include <boost/phoenix/core/actor.hpp>
#include <boost/log/detail/config.hpp>
#include <boost/log/detail/embedded_string_type.hpp>
#include <boost/log/detail/unary_function_terminal.hpp>
#include <boost/log/detail/attribute_predicate.hpp>
#include <boost/log/expressions/attr_fwd.hpp>
#include <boost/log/expressions/keyword_fwd.hpp>
#include <boost/log/attributes/attribute_name.hpp>
#include <boost/log/attributes/fallback_policy.hpp>
#include <boost/log/utility/functional/ends_with.hpp>
#include <boost/log/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
/*!
* The predicate checks if the attribute value ends with a substring. The attribute value is assumed to be of a string type.
*/
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template< typename T, typename SubstringT, typename FallbackPolicyT = fallback_to_none >
using attribute_ends_with = aux::attribute_predicate< T, SubstringT, ends_with_fun, FallbackPolicyT >;
#else // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template< typename T, typename SubstringT, typename FallbackPolicyT = fallback_to_none >
class attribute_ends_with :
public aux::attribute_predicate< T, SubstringT, ends_with_fun, FallbackPolicyT >
{
typedef aux::attribute_predicate< T, SubstringT, ends_with_fun, FallbackPolicyT > base_type;
public:
/*!
* Initializing constructor
*
* \param name Attribute name
* \param substring The expected attribute value ending
*/
attribute_ends_with(attribute_name const& name, SubstringT const& substring) : base_type(name, substring)
{
}
/*!
* Initializing constructor
*
* \param name Attribute name
* \param substring The expected attribute value ending
* \param arg Additional parameter for the fallback policy
*/
template< typename U >
attribute_ends_with(attribute_name const& name, SubstringT const& substring, U const& arg) : base_type(name, substring, arg)
{
}
};
#endif // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, ends with the specified substring.
*/
template< typename T, typename FallbackPolicyT, typename TagT, template< typename > class ActorT, typename SubstringT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_ends_with< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type, FallbackPolicyT > > >
ends_with(attribute_actor< T, FallbackPolicyT, TagT, ActorT > const& attr, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_ends_with< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type, FallbackPolicyT > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(attr.get_name(), substring, attr.get_fallback_policy()) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, ends with the specified substring.
*/
template< typename DescriptorT, template< typename > class ActorT, typename SubstringT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_ends_with< typename DescriptorT::value_type, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > >
ends_with(attribute_keyword< DescriptorT, ActorT > const&, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_ends_with< typename DescriptorT::value_type, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(DescriptorT::get_name(), substring) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, ends with the specified substring.
*/
template< typename T, typename SubstringT >
BOOST_FORCEINLINE phoenix::actor< aux::unary_function_terminal< attribute_ends_with< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > >
ends_with(attribute_name const& name, SubstringT const& substring)
{
typedef aux::unary_function_terminal< attribute_ends_with< T, typename boost::log::aux::make_embedded_string_type< SubstringT >::type > > terminal_type;
phoenix::actor< terminal_type > act = {{ terminal_type(name, substring) }};
return act;
}
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#include <boost/log/detail/footer.hpp>
#endif // BOOST_LOG_EXPRESSIONS_PREDICATES_ENDS_WITH_HPP_INCLUDED_
@@ -0,0 +1,172 @@
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file has_attr.hpp
* \author Andrey Semashev
* \date 23.07.2012
*
* The header contains implementation of a generic attribute presence checker in template expressions.
*/
#ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_HAS_ATTR_HPP_INCLUDED_
#define BOOST_LOG_EXPRESSIONS_PREDICATES_HAS_ATTR_HPP_INCLUDED_
#include <boost/phoenix/core/actor.hpp>
#include <boost/log/detail/config.hpp>
#include <boost/log/core/record_view.hpp>
#include <boost/log/attributes/attribute_name.hpp>
#include <boost/log/attributes/attribute_value_set.hpp>
#include <boost/log/attributes/value_visitation.hpp>
#include <boost/log/expressions/keyword_fwd.hpp>
#include <boost/log/detail/unary_function_terminal.hpp>
#include <boost/log/utility/functional/nop.hpp>
#include <boost/log/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
/*!
* An attribute value presence checker.
*/
template< typename T >
class has_attribute
{
public:
//! Function result_type
typedef bool result_type;
//! Expected attribute value type
typedef T value_type;
private:
//! Attribute value name
const attribute_name m_name;
//! Visitor invoker
value_visitor_invoker< value_type > m_visitor_invoker;
public:
/*!
* Initializing constructor
*
* \param name Attribute name
*/
explicit has_attribute(attribute_name const& name) : m_name(name)
{
}
/*!
* Checking operator
*
* \param arg A set of attribute values or a log record
* \return \c true if the log record contains the sought attribute value, \c false otherwise
*/
template< typename ArgT >
result_type operator() (ArgT const& arg) const
{
return m_visitor_invoker(m_name, arg, nop()).code() == visitation_result::ok;
}
};
/*!
* An attribute value presence checker. This specialization does not check the type of the attribute value.
*/
template< >
class has_attribute< void >
{
public:
//! Function result_type
typedef bool result_type;
//! Expected attribute value type
typedef void value_type;
private:
//! Attribute name
const attribute_name m_name;
public:
/*!
* Initializing constructor
*
* \param name Attribute name
*/
explicit has_attribute(attribute_name const& name) : m_name(name)
{
}
/*!
* Checking operator
*
* \param attrs A set of attribute values
* \return \c true if the log record contains the sought attribute value, \c false otherwise
*/
result_type operator() (attribute_value_set const& attrs) const
{
return attrs.find(m_name) != attrs.end();
}
/*!
* Checking operator
*
* \param rec A log record
* \return \c true if the log record contains the sought attribute value, \c false otherwise
*/
result_type operator() (boost::log::record_view const& rec) const
{
return operator()(rec.attribute_values());
}
};
/*!
* The function generates a terminal node in a template expression. The node will check for the attribute value
* presence in a log record. The node will also check that the attribute value has the specified type, if present.
*/
template< typename AttributeValueT >
BOOST_FORCEINLINE phoenix::actor< aux::unary_function_terminal< has_attribute< AttributeValueT > > > has_attr(attribute_name const& name)
{
typedef aux::unary_function_terminal< has_attribute< AttributeValueT > > terminal_type;
phoenix::actor< terminal_type > act = {{ terminal_type(name) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check for the attribute value
* presence in a log record.
*/
BOOST_FORCEINLINE phoenix::actor< aux::unary_function_terminal< has_attribute< void > > > has_attr(attribute_name const& name)
{
typedef aux::unary_function_terminal< has_attribute< void > > terminal_type;
phoenix::actor< terminal_type > act = {{ terminal_type(name) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check for the attribute value
* presence in a log record. The node will also check that the attribute value has the specified type, if present.
*/
template< typename DescriptorT, template< typename > class ActorT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< has_attribute< typename DescriptorT::value_type > > > has_attr(attribute_keyword< DescriptorT, ActorT > const&)
{
typedef aux::unary_function_terminal< has_attribute< typename DescriptorT::value_type > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(DescriptorT::get_name()) }};
return act;
}
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#include <boost/log/detail/footer.hpp>
#endif // BOOST_LOG_EXPRESSIONS_PREDICATES_HAS_ATTR_HPP_INCLUDED_
@@ -0,0 +1,107 @@
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file is_debugger_present.hpp
* \author Andrey Semashev
* \date 05.12.2012
*
* The header contains implementation of the \c is_debugger_present predicate in template expressions.
*/
#ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_
#define BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_
#include <boost/log/detail/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if defined(BOOST_WINDOWS)
#include <boost/phoenix/core/terminal.hpp> // this is needed to be able to include this header alone, Boost.Phoenix blows up without it
#include <boost/phoenix/function/adapt_callable.hpp>
#include <boost/log/detail/header.hpp>
#if defined(BOOST_USE_WINDOWS_H)
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
#include <windows.h>
#else // defined(BOOST_USE_WINDOWS_H)
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
namespace aux {
extern "C" {
__declspec(dllimport) int __stdcall IsDebuggerPresent();
} // extern "C"
} // namespace aux
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#endif // BOOST_USE_WINDOWS_H
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
namespace aux {
struct is_debugger_present
{
typedef bool result_type;
result_type operator() () const
{
return IsDebuggerPresent() != 0;
}
};
} // namespace aux
#ifndef BOOST_LOG_DOXYGEN_PASS
BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(is_debugger_present, aux::is_debugger_present)
#else
/*!
* The function generates a filter that will check whether the logger is attached to the process
*/
unspecified is_debugger_present();
#endif
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#include <boost/log/detail/footer.hpp>
#endif // BOOST_WINDOWS
#endif // BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_
@@ -0,0 +1,133 @@
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file is_in_range.hpp
* \author Andrey Semashev
* \date 02.09.2012
*
* The header contains implementation of an \c is_in_range predicate in template expressions.
*/
#ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_IS_IN_RANGE_HPP_INCLUDED_
#define BOOST_LOG_EXPRESSIONS_PREDICATES_IS_IN_RANGE_HPP_INCLUDED_
#include <utility>
#include <boost/phoenix/core/actor.hpp>
#include <boost/log/detail/config.hpp>
#include <boost/log/detail/embedded_string_type.hpp>
#include <boost/log/detail/unary_function_terminal.hpp>
#include <boost/log/detail/attribute_predicate.hpp>
#include <boost/log/expressions/attr_fwd.hpp>
#include <boost/log/expressions/keyword_fwd.hpp>
#include <boost/log/attributes/attribute_name.hpp>
#include <boost/log/attributes/fallback_policy.hpp>
#include <boost/log/utility/functional/in_range.hpp>
#include <boost/log/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
/*!
* The predicate checks if the attribute value contains a substring. The attribute value is assumed to be of a string type.
*/
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template< typename T, typename BoundaryT, typename FallbackPolicyT = fallback_to_none >
using attribute_is_in_range = aux::attribute_predicate< T, std::pair< BoundaryT, BoundaryT >, in_range_fun, FallbackPolicyT >;
#else // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template< typename T, typename BoundaryT, typename FallbackPolicyT = fallback_to_none >
class attribute_is_in_range :
public aux::attribute_predicate< T, std::pair< BoundaryT, BoundaryT >, in_range_fun, FallbackPolicyT >
{
typedef aux::attribute_predicate< T, std::pair< BoundaryT, BoundaryT >, in_range_fun, FallbackPolicyT > base_type;
public:
/*!
* Initializing constructor
*
* \param name Attribute name
* \param boundaries The expected attribute value boundaries
*/
attribute_is_in_range(attribute_name const& name, std::pair< BoundaryT, BoundaryT > const& boundaries) : base_type(name, boundaries)
{
}
/*!
* Initializing constructor
*
* \param name Attribute name
* \param boundaries The expected attribute value boundaries
* \param arg Additional parameter for the fallback policy
*/
template< typename U >
attribute_is_in_range(attribute_name const& name, std::pair< BoundaryT, BoundaryT > const& boundaries, U const& arg) : base_type(name, boundaries, arg)
{
}
};
#endif // !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value
* is in the specified range. The range must be half-open, that is the predicate will be equivalent to <tt>least <= attr < most</tt>.
*/
template< typename T, typename FallbackPolicyT, typename TagT, template< typename > class ActorT, typename BoundaryT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_is_in_range< T, typename boost::log::aux::make_embedded_string_type< BoundaryT >::type, FallbackPolicyT > > >
is_in_range(attribute_actor< T, FallbackPolicyT, TagT, ActorT > const& attr, BoundaryT const& least, BoundaryT const& most)
{
typedef typename boost::log::aux::make_embedded_string_type< BoundaryT >::type boundary_type;
typedef aux::unary_function_terminal< attribute_is_in_range< T, boundary_type, FallbackPolicyT > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(attr.get_name(), std::pair< boundary_type, boundary_type >(least, most), attr.get_fallback_policy()) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value
* is in the specified range. The range must be half-open, that is the predicate will be equivalent to <tt>least <= attr < most</tt>.
*/
template< typename DescriptorT, template< typename > class ActorT, typename BoundaryT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_is_in_range< typename DescriptorT::value_type, typename boost::log::aux::make_embedded_string_type< BoundaryT >::type > > >
is_in_range(attribute_keyword< DescriptorT, ActorT > const&, BoundaryT const& least, BoundaryT const& most)
{
typedef typename boost::log::aux::make_embedded_string_type< BoundaryT >::type boundary_type;
typedef aux::unary_function_terminal< attribute_is_in_range< typename DescriptorT::value_type, boundary_type > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(DescriptorT::get_name(), std::pair< boundary_type, boundary_type >(least, most)) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value
* is in the specified range. The range must be half-open, that is the predicate will be equivalent to <tt>least <= attr < most</tt>.
*/
template< typename T, typename BoundaryT >
BOOST_FORCEINLINE phoenix::actor< aux::unary_function_terminal< attribute_is_in_range< T, typename boost::log::aux::make_embedded_string_type< BoundaryT >::type > > >
is_in_range(attribute_name const& name, BoundaryT const& least, BoundaryT const& most)
{
typedef typename boost::log::aux::make_embedded_string_type< BoundaryT >::type boundary_type;
typedef aux::unary_function_terminal< attribute_is_in_range< T, boundary_type > > terminal_type;
phoenix::actor< terminal_type > act = {{ terminal_type(name, std::pair< boundary_type, boundary_type >(least, most)) }};
return act;
}
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#include <boost/log/detail/footer.hpp>
#endif // BOOST_LOG_EXPRESSIONS_PREDICATES_IS_IN_RANGE_HPP_INCLUDED_
@@ -0,0 +1,119 @@
/*
* Copyright Andrey Semashev 2007 - 2015.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file matches.hpp
* \author Andrey Semashev
* \date 02.09.2012
*
* The header contains implementation of a \c matches predicate in template expressions.
*/
#ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_MATCHES_HPP_INCLUDED_
#define BOOST_LOG_EXPRESSIONS_PREDICATES_MATCHES_HPP_INCLUDED_
#include <boost/phoenix/core/actor.hpp>
#include <boost/log/detail/config.hpp>
#include <boost/log/detail/unary_function_terminal.hpp>
#include <boost/log/detail/attribute_predicate.hpp>
#include <boost/log/expressions/attr_fwd.hpp>
#include <boost/log/expressions/keyword_fwd.hpp>
#include <boost/log/attributes/attribute_name.hpp>
#include <boost/log/attributes/fallback_policy.hpp>
#include <boost/log/utility/functional/matches.hpp>
#include <boost/log/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
BOOST_LOG_OPEN_NAMESPACE
namespace expressions {
/*!
* The predicate checks if the attribute value matches a regular expression. The attribute value is assumed to be of a string type.
*/
template< typename T, typename RegexT, typename FallbackPolicyT = fallback_to_none >
class attribute_matches :
public aux::attribute_predicate< T, typename boost::log::aux::match_traits< RegexT >::compiled_type, matches_fun, FallbackPolicyT >
{
typedef aux::attribute_predicate< T, typename boost::log::aux::match_traits< RegexT >::compiled_type, matches_fun, FallbackPolicyT > base_type;
public:
/*!
* Initializing constructor
*
* \param name Attribute name
* \param rex The regular expression to match the attribute value against
*/
attribute_matches(attribute_name const& name, RegexT const& rex) : base_type(name, boost::log::aux::match_traits< RegexT >::compile(rex))
{
}
/*!
* Initializing constructor
*
* \param name Attribute name
* \param rex The regular expression to match the attribute value against
* \param arg Additional parameter for the fallback policy
*/
template< typename U >
attribute_matches(attribute_name const& name, RegexT const& rex, U const& arg) : base_type(name, boost::log::aux::match_traits< RegexT >::compile(rex), arg)
{
}
};
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, matches the specified regular expression.
*/
template< typename T, typename FallbackPolicyT, typename TagT, template< typename > class ActorT, typename RegexT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_matches< T, RegexT, FallbackPolicyT > > >
matches(attribute_actor< T, FallbackPolicyT, TagT, ActorT > const& attr, RegexT const& rex)
{
typedef aux::unary_function_terminal< attribute_matches< T, RegexT, FallbackPolicyT > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(attr.get_name(), rex, attr.get_fallback_policy()) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, matches the specified regular expression.
*/
template< typename DescriptorT, template< typename > class ActorT, typename RegexT >
BOOST_FORCEINLINE ActorT< aux::unary_function_terminal< attribute_matches< typename DescriptorT::value_type, RegexT > > >
matches(attribute_keyword< DescriptorT, ActorT > const&, RegexT const& rex)
{
typedef aux::unary_function_terminal< attribute_matches< typename DescriptorT::value_type, RegexT > > terminal_type;
ActorT< terminal_type > act = {{ terminal_type(DescriptorT::get_name(), rex) }};
return act;
}
/*!
* The function generates a terminal node in a template expression. The node will check if the attribute value,
* which is assumed to be a string, matches the specified regular expression.
*/
template< typename T, typename RegexT >
BOOST_FORCEINLINE phoenix::actor< aux::unary_function_terminal< attribute_matches< T, RegexT > > >
matches(attribute_name const& name, RegexT const& rex)
{
typedef aux::unary_function_terminal< attribute_matches< T, RegexT > > terminal_type;
phoenix::actor< terminal_type > act = {{ terminal_type(name, rex) }};
return act;
}
} // namespace expressions
BOOST_LOG_CLOSE_NAMESPACE // namespace log
} // namespace boost
#include <boost/log/detail/footer.hpp>
#endif // BOOST_LOG_EXPRESSIONS_PREDICATES_MATCHES_HPP_INCLUDED_