Boost C++ Libraries

PrevUpHomeNext

Class template flt_attr

boost::log::filters::flt_attr — The filter checks that the attribute value satisfies the predicate FunT.

Synopsis

// In header: <boost/log/filters/attr.hpp>

template<typename CharT, typename FunT, typename AttributeValueTypesT, 
         typename ExceptionPolicyT> 
class flt_attr : public basic_filter< CharT, flt_attr< CharT, FunT, AttributeValueTypesT, ExceptionPolicyT > >
{
public:
  // types
  typedef base_type::string_type      string_type;       // String type. 
  typedef base_type::values_view_type values_view_type;  // Attribute values container type. 
  typedef FunT                        checker_type;      // Predicate functor type. 

  // construct/copy/destruct
  flt_attr(string_type const &, checker_type const &);

  // public member functions
  bool operator()(values_view_type const &) const;
};

Description

The flt_attr filter extracts stored attribute value and applies the predicate to it. The result of the predicate is returned as a result of filtering. If the attribute value is not found a missing_attribute_value exception is thrown.

One should not resort to direct usage of this class. The filter is constructed with the attr helper function and lambda expression. See "Advanced features -> Filters -> Generic attribute placeholder" section of the library documentation.

flt_attr public construct/copy/destruct

  1. flt_attr(string_type const & name, checker_type const & checker);

    Constructs the filter

    Parameters:
    checker

    A predicate that is applied to the attribute value

    name

    The attribute name

flt_attr public member functions

  1. bool operator()(values_view_type const & values) const;

    Applies the filter

    Parameters:
    values

    A set of attribute values of a single log record

    Returns:

    true if the log record passed the filter, false otherwise


PrevUpHomeNext