boost::logging::optimize::cache_string_one_str< string_type_ > Struct Template Reference

Optimizes the formatting for prepending and/or appending strings to the original message. More...

List of all members.

Public Member Functions

 cache_string_one_str (int reserve_prepend, int reserve_append, int grow_size=10)
 cache_string_one_str (const string_type &msg, int reserve_prepend=10, int reserve_append=10, int grow_size=10)
void prepend_string (const string_type &str)
 pre-pends a string (inserts it at the beginning)
void append_string (const string_type &str)
 appends a string (inserts it at the end)
template<class stream_type>
void to_stream (stream_type &stream) const
const string_type & full_string () const


Detailed Description

template<class string_type_ = boost::logging::hold_string_type>
struct boost::logging::optimize::cache_string_one_str< string_type_ >

Optimizes the formatting for prepending and/or appending strings to the original message.

It keeps all the modified message in one string. Useful if some formatter needs to access the whole string at once.

reserve_prepend() - the size that is reserved for prepending (similar to string::reserve function) reserve_append() - the size that is reserved for appending (similar to string::reserve function)

Note : as strings are prepended, reserve_prepend() shrinks. Same goes for append.


Constructor & Destructor Documentation

template<class string_type_ = boost::logging::hold_string_type>
boost::logging::optimize::cache_string_one_str< string_type_ >::cache_string_one_str ( int  reserve_prepend,
int  reserve_append,
int  grow_size = 10 
) [inline]

Parameters:
reserve_prepend - how many chars to have space to prepend by default
reserve_append - how many chars to have space to append by default
grow_size - in case we add a string and there's no room for it, with how much should we grow? We'll grow this much in addition to the added string - in the needed direction

template<class string_type_ = boost::logging::hold_string_type>
boost::logging::optimize::cache_string_one_str< string_type_ >::cache_string_one_str ( const string_type &  msg,
int  reserve_prepend = 10,
int  reserve_append = 10,
int  grow_size = 10 
) [inline]

Parameters:
msg - the message that is originally cached
reserve_prepend - how many chars to have space to prepend by default
reserve_append - how many chars to have space to append by default
grow_size - in case we add a string and there's no room for it, with how much should we grow? We'll grow this much in addition to the added string - in the needed direction


Member Function Documentation

template<class string_type_ = boost::logging::hold_string_type>
template<class stream_type>
void boost::logging::optimize::cache_string_one_str< string_type_ >::to_stream ( stream_type &  stream  )  const [inline]

writes the current cached contents to a stream

template<class string_type_ = boost::logging::hold_string_type>
const string_type& boost::logging::optimize::cache_string_one_str< string_type_ >::full_string (  )  const [inline]

returns the full string


The documentation for this struct was generated from the following file:

Copyright John Torjo © 2007
Have a question/ suggestion/ comment? Send me feedback