Similar to std::istringstream, but with an externally managed input buffer which makes it most similar to std::ispanstream (C++23) More...
Public Member Functions | |
ispanstream () | |
Default construct - empty. More... | |
ispanstream (const char *buffer, size_t nbytes) | |
Construct (shallow copy) for character array and number of bytes. More... | |
ispanstream (stdFoam::span< char > s) | |
Construct (shallow copy) from span character content. More... | |
ispanstream (stdFoam::span< const char > s) | |
Construct (shallow copy) from span character content. More... | |
std::streampos | input_pos () const |
The current get position within the buffer (tellg) More... | |
std::streamsize | capacity () const |
The get buffer capacity. More... | |
std::streamsize | remaining () const |
The number of characters remaining in the get area. Same as (capacity() - input_pos()) More... | |
UList< char > | list () const |
Span of the input 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 istringstream compatibility, return the buffer as string copy. More... | |
void | rewind () |
Rewind the stream, clearing any old errors. More... | |
void | reset (const char *buffer, size_t nbytes) |
Reset the get buffer area. More... | |
void | reset (const std::string &s) |
Reset the get buffer area to use the data from a string. More... | |
void | debug_info (Ostream &os) const |
Some information about the input buffer position/capacity. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from memorybuf::in_base | |
virtual std::streamsize | xsgetn (char *s, std::streamsize n) |
Get sequence of characters from a fixed region. More... | |
in_base ()=default | |
Default construct. More... | |
in_base (char *s, std::streamsize n) | |
Construct for character array (can be nullptr) and number of bytes. More... | |
void | resetg (char *s, std::streamsize n) |
Reset get buffer with character data (can be nullptr) and count. More... | |
std::streamsize | span_tellg () const |
The current buffer get position. More... | |
std::streamsize | span_capacity () const |
The get buffer capacity. More... | |
std::streamsize | span_remaining () const |
The number of characters remaining in the get area. More... | |
char * | data_bytes () const |
The span data (start of input characters) More... | |
std::streamsize | size_bytes () const |
The span size (number of input characters) More... | |
stdFoam::span< const char > | view () const |
void | info (Ostream &os) const |
Some information about the input 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::istringstream, but with an externally managed input buffer which makes it most similar to std::ispanstream (C++23)
This allows the input buffer to be filled or refilled from various sources without copying.
Definition at line 88 of file ISpanStream.H.
|
inline |
Default construct - empty.
Definition at line 104 of file ISpanStream.H.
|
inline |
Construct (shallow copy) for character array and number of bytes.
Definition at line 113 of file ISpanStream.H.
|
inlineexplicit |
Construct (shallow copy) from span character content.
Definition at line 133 of file ISpanStream.H.
|
inlineexplicit |
Construct (shallow copy) from span character content.
Definition at line 142 of file ISpanStream.H.
|
inline |
The current get position within the buffer (tellg)
Definition at line 154 of file ISpanStream.H.
References memorybuf::in_base::span_tellg().
Referenced by ispanstream::debug_info(), ISpanStream::input_pos(), and ISpanStream::tellg().
|
inline |
The get buffer capacity.
Definition at line 162 of file ISpanStream.H.
References memorybuf::in_base::span_capacity().
Referenced by ISpanStream::capacity(), ispanstream::debug_info(), and ISpanStream::size().
|
inline |
The number of characters remaining in the get area. Same as (capacity() - input_pos())
Definition at line 171 of file ISpanStream.H.
References memorybuf::in_base::span_remaining().
Referenced by ISpanStream::remaining().
|
inline |
Span of the input characters (is modifiable!)
Definition at line 179 of file ISpanStream.H.
References memorybuf::in_base::data_bytes(), and memorybuf::in_base::size_bytes().
Referenced by ISpanStream::list().
|
inline |
A string_view (c++17) or span view (older c++) of buffer contents.
Definition at line 191 of file ISpanStream.H.
References memorybuf::in_base::view().
Referenced by ISpanStream::view().
|
inline |
For istringstream compatibility, return the buffer as string copy.
Use sparingly - it creates a full copy!!
Definition at line 201 of file ISpanStream.H.
References memorybuf::in_base::data_bytes(), and memorybuf::in_base::size_bytes().
Referenced by ISpanStream::str().
|
inline |
Rewind the stream, clearing any old errors.
Definition at line 213 of file ISpanStream.H.
References clear().
Referenced by ISpanStream::rewind().
|
inline |
Reset the get buffer area.
Definition at line 222 of file ISpanStream.H.
References clear(), and memorybuf::in_base::resetg().
Referenced by ISpanStream::reset().
|
inline |
Reset the get buffer area to use the data from a string.
Definition at line 231 of file ISpanStream.H.
References clear(), memorybuf::in_base::resetg(), and s.
|
inline |
Some information about the input buffer position/capacity.
Definition at line 240 of file ISpanStream.H.
References ispanstream::capacity(), ispanstream::input_pos(), and os().
Referenced by ISpanStream::print().