template<class Container>
basic_memory_istream class final
A stream which composes a dynamically sized container.
Template parameters | |
---|---|
Container | The container type to use as the underlying buffer. |
Base classes
-
template<class Container>class basic_memory_stream_base<Container>
- Implements the common interface of every
memory_stream
. -
template<class Derived>class istream_interface<basic_memory_istream<Container>>
- A CRTP utility which can be used to flesh out the interface of a given stream.
Public types
- using container_type = Container
Buffer management
-
auto rdbuf() -> container_
type& noexcept - Provides mutable access to the underlying buffer.
-
auto rdbuf() const -> const container_
type& noexcept - Provides immutable access to the underlying buffer.
Formatting
- auto endian() const -> std::endian noexcept
- Gets the current default endian format.
- void endian(std::endian a_endian) noexcept
- Sets the default endian format.
Position
-
void seek_absolute(binary_io::
streamoff a_pos) noexcept - Seek to an absolute position in the stream (i.e. from the beginning).
-
void seek_relative(binary_io::
streamoff a_off) noexcept - Seek to a position in the stream relative to the current position.
-
auto tell() const -> binary_io::
streamoff noexcept - Gets the current stream position.
Reading
-
auto read() -> std::
tuple<Args...> - Batch reads the given values from the input stream.
-
auto read(std::endian a_endian) -> std::
tuple<Args...> - Batch reads the given values with the given endian format from the input stream.
- void read(Args&... a_args)
- Batch reads the given values from the input stream.
- void read(std::endian a_endian, Args&... a_args)
- Batch reads the given values with the given endian format from the input stream.
-
void read_bytes(std::
span<std:: byte> a_dst) - Reads bytes into the given buffer.
-
auto read_bytes(std::
size_t a_count) -> std::span< const std::byte > - Yields a no-copy view of
a_count
bytes from the underlying buffer.
Function documentation
template<class Container>
void binary_io:: basic_memory_istream<Container>:: read_bytes(std:: span<std:: byte> a_dst)
Reads bytes into the given buffer.
Parameters | |
---|---|
a_dst | The buffer to read bytes into. |
Exceptions | |
binary_io:: |
Thrown when the buffer has less than the requested number of bytes. |
template<class Container>
auto binary_io:: basic_memory_istream<Container>:: read_bytes(std:: size_t a_count) -> std::span< const std::byte >
Yields a no-copy view of a_count
bytes from the underlying buffer.
Parameters | |
---|---|
a_count | The number of bytes to be read. |
Returns | A view of the bytes read. |
Exceptions | |
binary_io:: |
Thrown when the buffer has less than the requested number of bytes. |