![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
File based output stream. More...
#include <gf/Streams.h>
Public Types | |
enum class | Mode { Write , Append } |
Open mode for the file. More... | |
Public Member Functions | |
FileOutputStream (const Path &path, Mode mode=Mode::Write) | |
Constructor. More... | |
~FileOutputStream () | |
Destructor. More... | |
std::size_t | write (Span< const uint8_t > buffer) override |
Write data to the stream. More... | |
std::size_t | getWrittenBytesCount () const override |
Get the number of bytes already written. More... | |
![]() | |
OutputStream ()=default | |
Default constructor. More... | |
OutputStream (const OutputStream &)=delete | |
Deleted copy constructor. More... | |
OutputStream & | operator= (const OutputStream &)=delete |
Deleted copy assignment. More... | |
virtual | ~OutputStream () |
Destructor. More... | |
virtual std::size_t | write (Span< const uint8_t > buffer)=0 |
Write data to the stream. More... | |
std::size_t | write (uint8_t byte) |
Write a single byte to the stream. More... | |
virtual std::size_t | getWrittenBytesCount () const =0 |
Get the number of bytes already written. More... | |
File based output stream.
|
strong |
gf::FileOutputStream::FileOutputStream | ( | const Path & | path, |
Mode | mode = Mode::Write |
||
) |
Constructor.
The constructor opens the file. If the file is not opened, an exception is thrown.
path | The path to the file |
mode | The open mode of the file |
gf::FileOutputStream::~FileOutputStream | ( | ) |
Destructor.
The destructor closes the file.
|
overridevirtual |
Get the number of bytes already written.
This function returns the number of bytes actually written i.e. it does not take into account possible bytes that have not been flushed yet.
Implements gf::OutputStream.
|
overridevirtual |
Write data to the stream.
buffer | The buffer to copy to the stream |
Implements gf::OutputStream.