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

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

Class template max_size_decorator_terminal



// In header: <boost/log/expressions/formatters/max_size_decorator.hpp>

template<typename SubactorT, typename CharT> 
class max_size_decorator_terminal {
  // types
  typedef CharT                                 char_type;      // Character type. 
  typedef std::basic_string< char_type >        string_type;    // String type. 
  typedef std::size_t                           size_type;      // String size type. 
  typedef basic_formatting_ostream< char_type > stream_type;    // Stream type. 
  typedef SubactorT                             subactor_type;  // Adopted actor type. 
  typedef string_type                           result_type;    // Result type definition. 

  // construct/copy/destruct
  max_size_decorator_terminal(subactor_type const &, size_type, 
                              string_type const & = string_type());
  max_size_decorator_terminal(max_size_decorator_terminal const &);
  max_size_decorator_terminal() = delete;

  // public member functions
  subactor_type const  & get_subactor() const;
  size_type get_max_size() const;
  string_type const  & get_overflow_marker() const;
  template<typename ContextT> result_type operator()(ContextT const &);
  template<typename ContextT> result_type operator()(ContextT const &) const;


String size limiting decorator terminal class. This formatter allows to limit the maximum total length of the strings generated by other formatters.

The max_size_decorator_terminal class aggregates the formatter being decorated, the maximum string length it can produce and an optional truncation marker string, which will be put at the end of the output if the limit is exceeded. Note that the marker length is included in the limit and as such must not exceed it. The max_size_decorator_terminal class is a formatter itself, so it can be used to construct more complex formatters, including nesting decorators.

max_size_decorator_terminal public construct/copy/destruct

  1. max_size_decorator_terminal(subactor_type const & sub, size_type max_size, 
                                string_type const & overflow_marker = string_type());

    Initializing constructor.

  2. max_size_decorator_terminal(max_size_decorator_terminal const & that);

    Copy constructor

  3. max_size_decorator_terminal() = delete;

max_size_decorator_terminal public member functions

  1. subactor_type const  & get_subactor() const;


    Adopted subactor

  2. size_type get_max_size() const;


    Max string size limit

  3. string_type const  & get_overflow_marker() const;


    Max string size limit

  4. template<typename ContextT> result_type operator()(ContextT const & ctx);

    Invokation operator

  5. template<typename ContextT> result_type operator()(ContextT const & ctx) const;

    Invokation operator