binary_io namespace

Namespaces

namespace components
namespace concepts
namespace endian

Classes

class any_istream
A polymorphic stream which can be used to abstract other streams.
class any_ostream
A polymorphic stream which can be used to abstract other streams.
template<class Container>
class basic_memory_istream
A stream which composes a dynamically sized container.
template<class Container>
class basic_memory_ostream
A stream which composes a dynamically sized container.
class buffer_exhausted
An exception which indicates the underlying buffer for a stream has been exhausted.
class exception
The base exception type for all binary_io exceptions.
class file_istream
A stream which composes a file handle.
class file_ostream
A stream which composes a file handle.
template<class Derived>
class istream_interface
A CRTP utility which can be used to flesh out the interface of a given stream.
template<class Derived>
class ostream_interface
A CRTP utility which can be used to flesh out the interface of a given stream.
class span_istream
A stream which composes a non-owning view over a contiguous block of memory.
class span_ostream
A stream which composes a non-owning view over a contiguous block of memory.

Enums

enum class write_mode { truncate, append }
The mode to open an output stream in.

Typedefs

using memory_istream = binary_io::basic_memory_istream<std::vector<std::byte>>
using memory_ostream = binary_io::basic_memory_ostream<std::vector<std::byte>>
using streamoff = long long
An integral type which can be used to seek any stream.

Functions

template<class T>
auto read(std::span<const std::byte, sizeof(T)> a_src, std::endian a_endian) -> T
Loads the given type from the given buffer, with the given endian format, into the native endian format.
template<class T>
void write(std::span<std::byte, sizeof(T)> a_dst, T a_value, std::endian a_endian)
Stores the given type into the given buffer, from the native endian format into the given endian format.

Function documentation

template<class T>
T binary_io::read(std::span<const std::byte, sizeof(T)> a_src, std::endian a_endian)

Loads the given type from the given buffer, with the given endian format, into the native endian format.

Parameters
a_src The buffer to load from.
a_endian The endian format the given value is stored in.
Returns The value loaded from the given buffer.

template<class T>
void binary_io::write(std::span<std::byte, sizeof(T)> a_dst, T a_value, std::endian a_endian)

Stores the given type into the given buffer, from the native endian format into the given endian format.

Parameters
a_dst The buffer to store into.
a_value The value to be stored.
a_endian The endian format to store the given value in.