Similar to std::ostringstream, but with an externally managed output buffer which makes it most similar to std::ospanstream (C++23) More...
Public Member Functions | |
ospanstream () | |
Default construct - empty. More... | |
ospanstream (char *buffer, size_t nbytes) | |
Construct for character array and number of bytes. More... | |
std::streampos | output_pos () const |
The current output position within the buffer (tellp) More... | |
std::streamsize | count () const |
The number of bytes outputted. More... | |
std::streamsize | capacity () const |
The put buffer capacity. More... | |
UList< char > | list () const |
Span of the current output characters (is modifiable!) More... | |
auto | view () const -> decltype(buffer_type::view()) |
A string_view (c++17) or span view (older c++) of buffer contents. More... | |
std::string | str () const |
For ostringstream compatibility, return the buffer as string copy. More... | |
void | rewind () |
Rewind the stream, clearing any old errors. More... | |
void | reset (char *buffer, size_t nbytes) |
Reset the put buffer area. More... | |
void | reset (std::string &s) |
Reset the put buffer area to use the data area from a string. More... | |
void | debug_info (Ostream &os) const |
Some information about the output buffer position/capacity. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from memorybuf::out_base | |
virtual std::streamsize | xsputn (const char *s, std::streamsize n) |
Put sequence of characters to a fixed region. More... | |
out_base ()=default | |
Default construct. More... | |
out_base (char *s, std::streamsize n) | |
Construct for character array (can be nullptr) and number of bytes. More... | |
void | resetp (char *s, std::streamsize n) |
Reset put buffer with character data (can be nullptr) and count. More... | |
std::streamsize | span_tellp () const |
The current buffer put position. More... | |
std::streamsize | span_capacity () const |
The put buffer capacity. More... | |
char * | data_bytes () const |
The span data (start of output characters) More... | |
std::streamsize | size_bytes () const |
The span size (size of output buffer) More... | |
stdFoam::span< const char > | view () const |
void | info (Ostream &os) const |
Some information about the output buffer position/capacity. More... | |
Protected Member Functions inherited from memorybuf | |
virtual std::streampos | seekoff (std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out) |
Set position pointer to relative position. More... | |
virtual std::streampos | seekpos (std::streampos pos, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out) |
Set position pointer to absolute position. More... | |
Similar to std::ostringstream, but with an externally managed output buffer which makes it most similar to std::ospanstream (C++23)
Definition at line 102 of file OSpanStream.H.
|
inline |
Default construct - empty.
Definition at line 118 of file OSpanStream.H.
|
inline |
Construct for character array and number of bytes.
Definition at line 127 of file OSpanStream.H.
|
inline |
The current output position within the buffer (tellp)
Definition at line 139 of file OSpanStream.H.
References memorybuf::out_base::span_tellp().
Referenced by ospanstream::debug_info(), OSpanStream::output_pos(), and OSpanStream::tellp().
|
inline |
The number of bytes outputted.
Definition at line 147 of file OSpanStream.H.
References memorybuf::out_base::size_bytes().
Referenced by OSpanStream::count(), and OSpanStream::size().
|
inline |
The put buffer capacity.
Definition at line 155 of file OSpanStream.H.
References memorybuf::out_base::span_capacity().
Referenced by OSpanStream::capacity(), and ospanstream::debug_info().
|
inline |
Span of the current output characters (is modifiable!)
Definition at line 163 of file OSpanStream.H.
References memorybuf::out_base::data_bytes(), and memorybuf::out_base::size_bytes().
Referenced by OSpanStream::list().
|
inline |
A string_view (c++17) or span view (older c++) of buffer contents.
Definition at line 175 of file OSpanStream.H.
References memorybuf::out_base::view().
Referenced by OSpanStream::view().
|
inline |
For ostringstream compatibility, return the buffer as string copy.
Use sparingly - it creates a full copy!!
Definition at line 185 of file OSpanStream.H.
References memorybuf::out_base::data_bytes(), and memorybuf::out_base::size_bytes().
Referenced by OSpanStream::str().
|
inline |
Rewind the stream, clearing any old errors.
Definition at line 197 of file OSpanStream.H.
References clear().
Referenced by OSpanStream::rewind().
|
inline |
Reset the put buffer area.
Definition at line 206 of file OSpanStream.H.
References clear(), and memorybuf::out_base::resetp().
Referenced by OSpanStream::OSpanStream(), and OSpanStream::reset().
|
inline |
Reset the put buffer area to use the data area from a string.
Definition at line 215 of file OSpanStream.H.
References clear(), memorybuf::out_base::resetp(), and s.
|
inline |
Some information about the output buffer position/capacity.
Definition at line 225 of file OSpanStream.H.
References ospanstream::capacity(), os(), and ospanstream::output_pos().