|
| | ByteStream ()=default |
| | ByteStream (std::vector< uint8_t > data) |
| void | reset () |
| | Resets the stream to its initial state by clearing the data and setting the read and write positions to 0.
|
| tl::expected< size_t, InputStream::Error > | read (uint8_t *buffer, size_t size) override |
| | Reads data from the stream into the given buffer.
|
| bool | set_read_position (size_t position) override |
| | Sets the read position in the stream.
|
| size_t | get_read_position () override |
| std::optional< size_t > | size () const override |
| bool | exhausted () override |
| tl::expected< void, OutputStream::Error > | write (const uint8_t *buffer, size_t size) override |
| | Writes data from the given buffer to the stream.
|
| tl::expected< void, OutputStream::Error > | set_write_position (size_t position) override |
| | Sets the write position in the stream.
|
| size_t | get_write_position () override |
| void | flush () override |
| | Flushes the stream, ensuring that all data is written to the underlying storage.
|
| | InputStream ()=default |
| virtual | ~InputStream ()=default |
| std::optional< size_t > | remaining () |
| bool | skip (size_t size) |
| | Skips size amount of bytes in the stream.
|
| tl::expected< std::string, Error > | read_as_string (size_t size) |
| | Reads size amount of bytes from the stream and returns it as a string.
|
| template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true> |
| tl::expected< Type, Error > | read_ne () |
| | Reads a value from the given stream in native byte order (not to be confused with network-endian).
|
| template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true> |
| tl::expected< Type, Error > | read_be () |
| | Reads a big-endian value from the given stream.
|
| template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true> |
| tl::expected< Type, Error > | read_le () |
| | Reads a little-endian value from the given stream.
|
| | OutputStream ()=default |
| virtual | ~OutputStream ()=default |
| tl::expected< void, Error > | write (const char *buffer, const size_t size) |
| | Convenience function to write data from a char buffer to the stream.
|
| template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true> |
| tl::expected< void, Error > | write_ne (const Type value) |
| | Writes a value to the stream in native byte order (not to be confused with network-endian).
|
| template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true> |
| tl::expected< void, Error > | write_be (const Type value) |
| | Writes a big-endian value to the stream.
|
| template<typename Type, std::enable_if_t< std::is_trivially_copyable_v< Type >, bool > = true> |
| tl::expected< void, Error > | write_le (const Type value) |
| | Writes a little-endian value to the stream.
|
| tl::expected< void, Error > | write_string (const std::string &str) |
| | Writes a string to the stream.
|
| tl::expected< void, Error > | write_cstring (const char *str) |
| | Writes a c-string to the stream, up to and including the null character.
|
Simple stream implementation that writes to and reads from a vector.
Definition at line 37 of file byte_stream.hpp.