Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards


Struct template formatter_factory



// In header: <boost/log/utility/setup/formatter_parser.hpp>

template<typename CharT> 
struct formatter_factory {
  // types
  typedef CharT                                char_type;       // Character type. 
  typedef std::basic_string< char_type >       string_type;     // String type. 
  typedef basic_formatter< char_type >         formatter_type;  // The formatter function object. 
  typedef std::map< string_type, string_type > args_map;      

  // construct/copy/destruct
  formatter_factory() = default;
  formatter_factory(formatter_factory const &) = delete;
  formatter_factory & operator=(formatter_factory const &) = delete;
  virtual ~formatter_factory();

  // public member functions
  virtual formatter_type 
  create_formatter(attribute_name const &, args_map const &) = 0;


Formatter factory base interface.

formatter_factory public types

  1. typedef std::map< string_type, string_type > args_map;

    Type of the map of formatter factory arguments [argument name -> argument value]. This type of maps will be passed to formatter factories on attempt to create a formatter.

formatter_factory public construct/copy/destruct

  1. formatter_factory() = default;

    Default constructor

  2. formatter_factory(formatter_factory const &) = delete;
  3. formatter_factory & operator=(formatter_factory const &) = delete;
  4. virtual ~formatter_factory();

    Virtual destructor

formatter_factory public member functions

  1. virtual formatter_type 
    create_formatter(attribute_name const & name, args_map const & args) = 0;

    The function creates a formatter for the specified attribute.



    Formatter arguments


    Attribute name