|
DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
|
imemorystreambuf is a stream buffer that wraps std::span<const std::byte> and provides a compatible interface with std::istream. More...
#include <memorystream.h>
Public Member Functions | |
| imemorystreambuf (std::span< const std::byte > source) | |
| Construct a new imemorystreambuf object. More... | |
| std::streampos | seekpos (std::streampos sp, std::ios_base::openmode which=std::ios_base::in) override |
| Set the position of the stream buffer. More... | |
| std::streampos | seekoff (std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which=std::ios_base::in) override |
| Move the position of the stream buffer. More... | |
imemorystreambuf is a stream buffer that wraps std::span<const std::byte> and provides a compatible interface with std::istream.
C++20 introduced std::span, which is a utility class that provides a way to access a contiguous sequence of elements. imemorystreambuf is a stream buffer that wraps std::span<const std::byte> and provides a compatible interface with std::istream.
Unlike std::istringstream, imemorystreambuf does not make a copy of the underlying data. It uses a std::span to provide a way to access the data.
There are several alternatives to using imemorystreambuf, such as std::istringstream, but they have a few limitations:
imemorystreambuf is a drop-in replacement for std::istrstream and is compatible with C++20 and later.
Definition at line 37 of file memorystream.h.
|
inlineexplicit |
Construct a new imemorystreambuf object.
| source | The source data to be used by the stream buffer. |
Definition at line 47 of file memorystream.h.
|
inlineoverride |
Move the position of the stream buffer.
| off | The offset to move the position. |
| way | The direction to move the position. |
| which | The I/O mode. |
Definition at line 78 of file memorystream.h.
|
inlineoverride |
Set the position of the stream buffer.
| sp | The position to set. |
| which | The I/O mode. |
Definition at line 61 of file memorystream.h.