![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
File based input stream. More...
#include <gf/Streams.h>
Public Member Functions | |
FileInputStream (const Path &path) | |
Constructor. More... | |
~FileInputStream () | |
Destructor. More... | |
std::size_t | read (Span< uint8_t > buffer) override |
Read data from the stream. More... | |
void | seek (std::ptrdiff_t position) override |
Change the current reading position. More... | |
void | skip (std::ptrdiff_t position) override |
Change the current reading position. More... | |
bool | isFinished () override |
Tell if the stream is at the end. More... | |
![]() | |
InputStream ()=default | |
Default constructor. More... | |
InputStream (const InputStream &)=delete | |
Deleted copy constructor. More... | |
InputStream & | operator= (const InputStream &)=delete |
Deleted copy assignment. More... | |
virtual | ~InputStream () |
Destructor. More... | |
virtual std::size_t | read (Span< uint8_t > buffer)=0 |
Read data from the stream. More... | |
std::size_t | read (uint8_t &byte) |
Read a single byte from the stream. More... | |
virtual void | seek (std::ptrdiff_t position)=0 |
Change the current reading position. More... | |
virtual void | skip (std::ptrdiff_t position)=0 |
Change the current reading position. More... | |
virtual bool | isFinished ()=0 |
Tell if the stream is at the end. More... | |
File based input stream.
|
explicit |
Constructor.
The constructor opens the file. If the file is not opened, an exception is thrown.
path | The path to the file |
gf::FileInputStream::~FileInputStream | ( | ) |
Destructor.
The destructor closes the file.
|
overridevirtual |
Tell if the stream is at the end.
Implements gf::InputStream.
|
overridevirtual |
Read data from the stream.
After reading, the stream's reading position must be advanced by the amount of bytes read.
buffer | The buffer where to copy the read data |
Implements gf::InputStream.
|
overridevirtual |
Change the current reading position.
position | The position to seek to, from the beginning |
Implements gf::InputStream.
|
overridevirtual |
Change the current reading position.
position | The position to seek to, from the current position |
Implements gf::InputStream.