Implementation of sink to std::string
Besides to having similar functionality to std::basic_ostringstream
this class also allows to access directly the destination std::string
More...
#include <io_string.h>
|
typedef std::basic_string
< CharT, Traits > | string_type |
| Type of the underlying string.
|
|
typedef
std::experimental::basic_string_view
< CharT, Traits > | string_view_type |
| string_view for string_type
|
|
|
| string_sink (std::size_t max_size=std::string::npos) |
| Constructs object with optional argument to specify maximum size of the destination string_type . More...
|
|
std::streamsize | write (const CharT *s, std::streamsize n) |
| Writes first n character from the array s into destination string More...
|
|
void | flush () |
| Sets flushed flag to true
|
|
void | reset () |
| Resets the sink.
|
|
string_view_type | view () const |
| Returns string_view to the destination std::string More...
|
|
string_type & | str () |
| Returns the reference to the destination std::string More...
|
|
bool | was_flushed () const |
| Return flag which indicates whether this sink was flushed since last reset. More...
|
|
std::size_t | characters_written () const |
| Return the number of character which were written into this sink since last reset. More...
|
|
template<typename CharT, typename Traits = std::char_traits<CharT>>
class servlet::string_sink< CharT, Traits >
Implementation of sink to std::string
Besides to having similar functionality to std::basic_ostringstream
this class also allows to access directly the destination std::string
- Template Parameters
-
CharT | character type for this stream |
Traits | cahracter traits type to be used in this stream. |
- See Also
- sink
template<typename CharT , typename Traits = std::char_traits<CharT>>
Constructs object with optional argument to specify maximum size of the destination string_type
.
By default this size is unlimited.
- Parameters
-
max_size | Size limit for destination string |
template<typename CharT , typename Traits = std::char_traits<CharT>>
Return the number of character which were written into this sink since last reset.
- Returns
- the number of characters written to this sink since last reset.
template<typename CharT , typename Traits = std::char_traits<CharT>>
Returns the reference to the destination std::string
- Returns
- reference to the destination string
template<typename CharT , typename Traits = std::char_traits<CharT>>
Returns string_view
to the destination std::string
- Returns
view
of the destination string.
template<typename CharT , typename Traits = std::char_traits<CharT>>
Return flag which indicates whether this sink was flushed since last reset.
- Returns
true
if this sink was flushed since last reset
template<typename CharT , typename Traits = std::char_traits<CharT>>
Writes first n
character from the array s
into destination string
- Parameters
-
s | Pointer to an array of at least n elements |
n | Number of characters to write. |
- Returns
- Number of successefully written characters
The documentation for this class was generated from the following file: