Similar to std::istringstream, but with an externally managed input buffer which makes it most similar to std::ispanstream (C++23). More...
#include <ISpanStream.H>


Public Member Functions | |
| ispanstream () | |
| Default construct - empty. | |
| ispanstream (const char *buffer, size_t nbytes) | |
| Construct (shallow copy) for character array and number of bytes. | |
| ispanstream (std::string_view s) | |
| Construct (shallow copy) from std::string_view content. | |
| std::streampos | input_pos () const |
| The current get position within the buffer (tellg). | |
| std::streamsize | capacity () const |
| The get buffer capacity. | |
| std::streamsize | remaining () const |
| The number of characters remaining in the get area. Same as (capacity() - input_pos()). | |
| UList< char > | list () const |
| A list span of the input characters (is modifiable!). | |
| auto | view () const |
| A string_view of buffer contents. | |
| auto | view (size_t pos, size_t len=std::string::npos) const |
| A sub-slice string view of the buffer contents. | |
| std::string | str () const |
| For istringstream compatibility, return the buffer as string copy. | |
| void | rewind () |
| Rewind the stream, clearing any old errors. | |
| void | seek (std::streampos pos) |
| Reposition the stream from the start. | |
| void | reset (const char *buffer, size_t nbytes) |
| Reset the get buffer area. | |
| void | reset (const char *s) |
| Reset the get buffer area to use the nul-terminated buffer. | |
| void | reset (const std::string &s) |
| Reset the get buffer area to use the data from a string. | |
| void | reset (std::string_view s) |
| Reset the get buffer area to use the data from a string_view. | |
| void | debug_info (Ostream &os) const |
| Some information about the input buffer position/capacity. | |
| void | print (Ostream &os) const |
| Information about stream. | |
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. | |
| in_base ()=default | |
| Default construct. | |
| in_base (char *s, std::streamsize n) | |
| Construct for character array (can be nullptr) and number of bytes. | |
| void | resetg (char *s, std::streamsize n) |
| Reset get buffer with character data (can be nullptr) and count. | |
| std::streamsize | span_tellg () const |
| The current buffer get position. | |
| std::streamsize | span_capacity () const |
| The get buffer capacity. | |
| std::streamsize | span_remaining () const |
| The number of characters remaining in the get area. | |
| char * | data_bytes () const |
| The span data (start of input characters). | |
| std::streamsize | size_bytes () const |
| The span size (number of input characters). | |
| bool | in_range (std::streampos pos) const |
| True if position is within the current input range. | |
| auto | view () const |
| A string view of the current input region. | |
| auto | view (size_t pos, size_t len) const |
| A sub-slice string view of the current input region. | |
| void | info (Ostream &os) const |
| Some information about the input buffer position/capacity. | |
| 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. | |
| 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. | |
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 std::string_view content.
Definition at line 122 of file ISpanStream.H.
References s().

|
inline |
The current get position within the buffer (tellg).
Definition at line 134 of file ISpanStream.H.
References memorybuf::in_base::span_tellg().
Referenced by debug_info().


|
inline |
The get buffer capacity.
Definition at line 142 of file ISpanStream.H.
References memorybuf::in_base::span_capacity().
Referenced by debug_info().


|
inline |
The number of characters remaining in the get area. Same as (capacity() - input_pos()).
Definition at line 151 of file ISpanStream.H.
References memorybuf::in_base::span_remaining().

|
inline |
A list span of the input characters (is modifiable!).
Definition at line 159 of file ISpanStream.H.
References memorybuf::in_base::data_bytes(), and memorybuf::in_base::size_bytes().

|
inline |
A string_view of buffer contents.
Definition at line 171 of file ISpanStream.H.
References memorybuf::in_base::view().

|
inline |
A sub-slice string view of the buffer contents.
Definition at line 176 of file ISpanStream.H.
References Foam::pos(), and memorybuf::in_base::view().

|
inline |
For istringstream compatibility, return the buffer as string copy.
Use sparingly - it creates a full copy!!
Definition at line 186 of file ISpanStream.H.
References memorybuf::in_base::data_bytes(), and memorybuf::in_base::size_bytes().

|
inline |
Rewind the stream, clearing any old errors.
Definition at line 198 of file ISpanStream.H.
|
inline |
Reposition the stream from the start.
Definition at line 207 of file ISpanStream.H.
References memorybuf::in_base::in_range(), and Foam::pos().

|
inline |
Reset the get buffer area.
Definition at line 219 of file ISpanStream.H.
References memorybuf::in_base::resetg().
Referenced by reset().


|
inline |
Reset the get buffer area to use the nul-terminated buffer.
Definition at line 228 of file ISpanStream.H.

|
inline |
Reset the get buffer area to use the data from a string.
Definition at line 236 of file ISpanStream.H.
References memorybuf::in_base::resetg(), and s().

|
inline |
Reset the get buffer area to use the data from a string_view.
Definition at line 245 of file ISpanStream.H.
References memorybuf::in_base::resetg(), and s().

|
inline |
Some information about the input buffer position/capacity.
Definition at line 254 of file ISpanStream.H.
References capacity(), input_pos(), and os().
Referenced by print().


|
inline |
Information about stream.
Definition at line 262 of file ISpanStream.H.
References debug_info(), and os().
