Boost C++ Libraries

PrevUpHomeNext

Class template fmt_format

boost::log::formatters::fmt_format — Formatter to output objects into a Boost.Format object.

Synopsis

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

template<typename CharT> 
class fmt_format : public basic_formatter< CharT, fmt_format< CharT > > {
public:
  // types
  typedef base_type::char_type      char_type;     // Character type. 
  typedef base_type::string_type    string_type;   // String type. 
  typedef base_type::ostream_type   ostream_type;  // Stream type. 
  typedef basic_format< char_type > format_type;   // Boost.Format type. 
  typedef base_type::record_type    record_type;   // Log record type. 

  // construct/copy/destruct
  explicit fmt_format(format_type const &);
  fmt_format(fmt_format const &);
  fmt_format& operator=(fmt_format const &);

  // public member functions
  void operator()(ostream_type &, record_type const &) const;
  template<typename T> fmt_format< char_type > & operator%(T const &);
};

Description

The fmt_format class template is a hook that allows to construct formatters with format strings. The formatter basically accumulates formatters of the formatting expression and invokes them sequentially when called to format a log record. The results of the aggregated formatters are fed to a Boost.Format formatter instance. The final result of formatting is put into the resulting stream.

fmt_format public construct/copy/destruct

  1. explicit fmt_format(format_type const & fmt);

    Constructor with formatter initialization

    Parameters:
    fmt

    Boost.Format formatter instance

  2. fmt_format(fmt_format const & that);

    Copy constructor

  3. fmt_format& operator=(fmt_format const & that);
    Assignment prohibited.

fmt_format public member functions

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

    Formatting operator. Invokes all aggregated formatters, collects their formatting results and composes them according to the format string passed on construction.

    Parameters:
    record

    A logging record

    strm

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

  2. template<typename T> fmt_format< char_type > & operator%(T const & fmt);

    Composition operator. Consumes the fmt formatter.

    Parameters:
    fmt

    A Boost.Log formatter


PrevUpHomeNext