|
RAVENNAKIT
|
An implementation of input_stream for reading from a file. More...
#include <file_input_stream.hpp>
Public Member Functions | |
| FileInputStream (const std::filesystem::path &f) | |
| tl::expected< size_t, Error > | read (uint8_t *buffer, const size_t size) override |
| Reads data from the stream into the given buffer. | |
| bool | set_read_position (const 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 |
| Public Member Functions inherited from rav::InputStream | |
| 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. | |
Additional Inherited Members | |
| Public Types inherited from rav::InputStream | |
| enum class | Error { insufficient_data , failed_to_set_read_position } |
| Static Public Member Functions inherited from rav::InputStream | |
| static const char * | to_string (const Error e) |
An implementation of input_stream for reading from a file.
Definition at line 36 of file file_input_stream.hpp.
|
inlineexplicit |
Definition at line 38 of file file_input_stream.hpp.
|
inlinenodiscardoverridevirtual |
Implements rav::InputStream.
Definition at line 89 of file file_input_stream.hpp.
|
inlinenodiscardoverridevirtual |
Implements rav::InputStream.
Definition at line 77 of file file_input_stream.hpp.
|
inlinenodiscardoverridevirtual |
Reads data from the stream into the given buffer.
If the stream doesn't have enough data, then nothing will be read.
| buffer | The buffer to read data into. |
| size | The number of bytes to read. |
Implements rav::InputStream.
Definition at line 56 of file file_input_stream.hpp.
|
inlineoverridevirtual |
Sets the read position in the stream.
| position | The new read position. |
Implements rav::InputStream.
Definition at line 72 of file file_input_stream.hpp.
|
inlinenodiscardoverridevirtual |
Implements rav::InputStream.
Definition at line 85 of file file_input_stream.hpp.