![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
Memory based input stream. More...
#include <gf/Streams.h>
Public Member Functions | |
MemoryInputStream (Span< const uint8_t > memory) | |
Constructor. 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... | |
Memory based input stream.
|
explicit |
Constructor.
This class does not own the memory. The user must keep the memory available when the stream is active.
memory | The source memory |
|
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.