Output string stream that wraps lines on white-space characters at the specified line length, and with support for indentation.
More...
|
using | base_type = basic_line_wrapping_ostream< CharType, Traits > |
| The concrete type that this class derives from.
|
|
using | ostringstream_type = std::basic_ostringstream< CharType, Traits, Allocator > |
| The concrete type of std::basic_ostringstream used.
|
|
using | string_type = std::basic_string< CharType, Traits, Allocator > |
| The concrete type of std::basic_string used.
|
|
using | base_type = std::basic_ostream< CharType, std::char_traits< CharType > > |
| The concrete type that this class derives from.
|
|
using | streambuf_type = std::basic_streambuf< CharType, std::char_traits< CharType > > |
| The concrete base stream buffer type used by this stream.
|
|
|
| basic_line_wrapping_ostringstream (size_t max_line_length, bool count_formatting=false) |
| Initializes a new instance of the basic_line_wrapping_ostringstream class with the specified maximum line length. More...
|
|
string_type | str () && |
| Gets a string move-constructed from the underlying string. More...
|
|
string_type | str () const & |
| Gets a copy of the underlying string object. More...
|
|
template<typename SAlloc , std::enable_if_t< details::is_allocator< SAlloc >::value, int > = 0> |
std::basic_string< CharType, Traits, SAlloc > | str (const SAlloc &alloc) const |
| Gets a copy of the underlying string object, using alloc as allocator. More...
|
|
template<typename SAlloc > |
void | str (const std::basic_string< CharType, Traits, SAlloc > &s) |
| Replaces the contents of the underlying string. More...
|
|
void | str (const string_type &s) |
| Replaces the contents of the underlying string. More...
|
|
void | str (string_type &&s) |
| Replaces the contents of the underlying string. More...
|
|
std::basic_string_view< CharType, Traits > | view () const noexcept |
| Gets a view over the underlying string. More...
|
|
| basic_line_wrapping_ostream () |
| Initializes a new instance of the basic_line_wrapping_ostream class. More...
|
|
| basic_line_wrapping_ostream (base_type &base_stream, size_t max_line_length, bool count_formatting=false) |
| Initializes a new instance of the basic_line_wrapping_ostream class with the specified underlying stream and maximum line length. More...
|
|
| basic_line_wrapping_ostream (basic_line_wrapping_ostream &&other) noexcept |
| Move constructor. More...
|
|
void | flush (bool flush_last_line) |
| Flushes the buffer to the underlying stream buffer, optionally including the the final, partial line. More...
|
|
void | init (base_type &base_stream, size_t max_line_length, bool count_formatting=false) |
| Initializes a new instance of the basic_line_wrapping_ostream class with the specified underlying stream and maximum line length. More...
|
|
basic_line_wrapping_ostream & | operator= (basic_line_wrapping_ostream &&other) noexcept |
| Move assignment operator. More...
|
|
void | swap (basic_line_wrapping_ostream &other) noexcept |
| Swaps this basic_line_wrapping_ostream instance with another. More...
|
|
template<typename CharType, typename Traits = std::char_traits<CharType>, typename Allocator = std::allocator<CharType>>
class ookii::basic_line_wrapping_ostringstream< CharType, Traits, Allocator >
Output string stream that wraps lines on white-space characters at the specified line length, and with support for indentation.
This stream writes to a string, whose contents can be retrieved using the str() and view() methods.
- Warning
- Flushing this stream will not flush the contents of the last unfinished line. Use ookii::flush() with the
flush_last_line
parameter set to true
to make sure all content is flushed (this may insert an additional new line character).
Several typedefs for common character types are provided:
- Template Parameters
-
CharType | The type of characters used. |
Traits | The character traits used. |
Allocator | The allocator to use for strings. |
template<typename CharType , typename Traits = std::char_traits<CharType>, typename Allocator = std::allocator<CharType>>
Gets a string move-constructed from the underlying string.
To make sure the result contains all the written text, you must flush the string using ookii:flush(), specifying true
to flush the final line.
template<typename CharType , typename Traits = std::char_traits<CharType>, typename Allocator = std::allocator<CharType>>
template<typename SAlloc , std::enable_if_t< details::is_allocator< SAlloc >::value, int > = 0>
Gets a copy of the underlying string object, using alloc
as allocator.
To make sure the result contains all the written text, you must flush the string using ookii:flush(), specifying true
to flush the final line.
template<typename CharType , typename Traits = std::char_traits<CharType>, typename Allocator = std::allocator<CharType>>
Gets a view over the underlying string.
To make sure the result contains all the written text, you must flush the string using ookii:flush(), specifying true
to flush the final line.