Similar to std::istringstream, but with the ability to swap character content. Has some similarity to std::ispanstream (C++23). More...
#include <ICharStream.H>


Public Member Functions | |
| icharstream () | |
| Default construct - empty. | |
| icharstream (const char *buffer, size_t nbytes) | |
| Copy construct from content. | |
| icharstream (List< char > &&buffer) | |
| Move construct from List. | |
| template<int SizeMin> | |
| icharstream (DynamicList< char, SizeMin > &&buffer) | |
| Move construct from DynamicList. | |
| 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()). | |
| 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. | |
| UList< char > | list () const |
| A list 'span' of buffer contents (caution: is modifiable!!). | |
| 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 stream content (copy), reset positions. | |
| void | swap (List< char > &other) |
| Exchange stream content and parameter contents, reset positions. | |
| template<int SizeMin> | |
| void | swap (DynamicList< char, SizeMin > &other) |
| Exchange stream content and parameter contents, reset positions. | |
| DynamicList< char > | release () |
| Reset stream and return contents as a List. | |
| 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_dynamic | |
| in_dynamic ()=default | |
| Default construct - empty. | |
| in_dynamic (const char *s, std::streamsize n) | |
| Copy construct from content. | |
| in_dynamic (::Foam::List< char > &&buffer) | |
| Move construct from List. | |
| template<int SizeMin> | |
| in_dynamic (::Foam::DynamicList< char, SizeMin > &&buffer) | |
| Move construct from DynamicList (added length only). | |
| void | sync_gbuffer () |
| Sync get buffer pointers to agree with list dimensions. | |
| void | reset (const char *s, std::streamsize n) |
| Reset content (copy). | |
| void | swap (List< char > &other) |
| Exchange buffer content and parameter contents, reset positions. | |
| template<int SizeMin> | |
| void | swap (DynamicList< char, SizeMin > &other) |
| Exchange buffer content and parameter contents, reset positions. | |
| DynamicList< char > | release () |
| Reset buffer and return contents. The list size and capacity are identical. | |
| 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 the ability to swap character content. Has some similarity to std::ispanstream (C++23).
Definition at line 62 of file ICharStream.H.
|
inline |
Default construct - empty.
Definition at line 78 of file ICharStream.H.
Referenced by icharstream(), icharstream(), and icharstream().

|
inline |
Copy construct from content.
Definition at line 87 of file ICharStream.H.
References icharstream(), and reset().

|
inline |
Move construct from List.
Definition at line 97 of file ICharStream.H.
References icharstream(), and swap().

|
inline |
Move construct from DynamicList.
Definition at line 108 of file ICharStream.H.
References icharstream(), and swap().

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


|
inline |
The get buffer capacity.
Definition at line 129 of file ICharStream.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 138 of file ICharStream.H.
References memorybuf::in_base::span_remaining().

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

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

|
inline |
A list 'span' of buffer contents (caution: is modifiable!!).
Definition at line 159 of file ICharStream.H.
References memorybuf::in_base::data_bytes(), and memorybuf::in_base::size_bytes().

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

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

|
inline |
Reset stream content (copy), reset positions.
Definition at line 206 of file ICharStream.H.
References memorybuf::in_dynamic::reset().
Referenced by icharstream().


|
inline |
Exchange stream content and parameter contents, reset positions.
Definition at line 215 of file ICharStream.H.
References memorybuf::in_dynamic::swap().
Referenced by icharstream(), and icharstream().


|
inline |
Exchange stream content and parameter contents, reset positions.
Definition at line 225 of file ICharStream.H.
References memorybuf::in_dynamic::swap().

|
inline |
Reset stream and return contents as a List.
Definition at line 234 of file ICharStream.H.
References memorybuf::in_dynamic::release().

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


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