|
RAVENNAKIT
|
An implementation of output_stream for writing to a file. More...
#include <file_output_stream.hpp>
Public Member Functions | |
| FileOutputStream (const std::filesystem::path &file) | |
| ~FileOutputStream () override=default | |
| tl::expected< void, Error > | write (const uint8_t *buffer, const size_t size) override |
| Writes data from the given buffer to the stream. | |
| tl::expected< void, Error > | set_write_position (const 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. | |
| Public Member Functions inherited from rav::OutputStream | |
| 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. | |
Additional Inherited Members | |
| Public Types inherited from rav::OutputStream | |
| enum class | Error { failed_to_write , out_of_memory } |
An implementation of output_stream for writing to a file.
Definition at line 35 of file file_output_stream.hpp.
|
inlineexplicit |
Definition at line 37 of file file_output_stream.hpp.
|
overridedefault |
|
inlineoverridevirtual |
Flushes the stream, ensuring that all data is written to the underlying storage.
Not all streams support this operation.
Implements rav::OutputStream.
Definition at line 63 of file file_output_stream.hpp.
|
inlinenodiscardoverridevirtual |
Implements rav::OutputStream.
Definition at line 59 of file file_output_stream.hpp.
|
inlineoverridevirtual |
Sets the write position in the stream.
| position | The new write position. |
Implements rav::OutputStream.
Definition at line 54 of file file_output_stream.hpp.
|
inlineoverridevirtual |
Writes data from the given buffer to the stream.
| buffer | The buffer to write data from. |
| size | The number of bytes to write. |
Implements rav::OutputStream.
Definition at line 49 of file file_output_stream.hpp.