Boost C++ Libraries

PrevUpHomeNext

Class template fmt_if_else

boost::log::formatters::fmt_if_else — Conditional 'if-else' formatter.

Synopsis

// In header: <boost/log/formatters/if.hpp>

template<typename FilterT, typename ThenT, typename ElseT> 
class fmt_if_else : public basic_formatter< ThenT::char_type, fmt_if_else< FilterT, ThenT, ElseT > >
{
public:
  // types
  typedef base_type::string_type  string_type;   // String type. 
  typedef base_type::ostream_type ostream_type;  // Stream type. 
  typedef base_type::record_type  record_type;   // Log record type. 

  // construct/copy/destruct
  fmt_if_else(FilterT const &, ThenT const &, ElseT const &);

  // public member functions
  void operator()(ostream_type &, record_type const &) const;
};

Description

fmt_if_else public construct/copy/destruct

  1. fmt_if_else(FilterT const & flt, ThenT const & th, ElseT const & el);

    Constructor

    Parameters:
    el

    The formatter that gets invoked if flt returns false

    flt

    The condition filter

    th

    The formatter that gets invoked if flt returns true

fmt_if_else public member functions

  1. void operator()(ostream_type & strm, record_type const & record) const;

    Formatting operator. Applies the filter to the log record. If the filter returns true passes the received arguments to the aggregated then-formatter. Otherwise calls else-formatter.

    Parameters:
    record

    A logging record

    strm

    A reference to the stream, where the final text of the logging record is composed


PrevUpHomeNext