![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
Abstract class for custom file input streams. More...
#include <gf/Stream.h>
Public Member Functions | |
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... | |
Abstract class for custom file input streams.
This class allows users to define their own stream input sources from which Gamedev Framework can load resources.
Gamedev Framework resource classes like gf::Texture and gf::Shader provide constructors that read data from conventional sources. However, if you have data coming from a different source (over a network, embedded, encrypted, compressed, etc) you can derive your own class from gf::InputStream and use the constructor that takes a generic input stream.
|
default |
Default constructor.
|
delete |
Deleted copy constructor.
|
virtual |
Destructor.
|
pure virtual |
Tell if the stream is at the end.
Implemented in gf::FileInputStream, gf::MemoryInputStream, gf::CompressedInputStream, and gf::BufferInputStream.
|
delete |
Deleted copy assignment.
|
pure virtual |
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 |
Implemented in gf::FileInputStream, gf::MemoryInputStream, gf::CompressedInputStream, and gf::BufferInputStream.
|
inline |
Read a single byte from the stream.
This is a convinience function to read a single byte instead of a whole buffer.
byte | The byte where to copy the read data |
|
pure virtual |
Change the current reading position.
position | The position to seek to, from the beginning |
Implemented in gf::FileInputStream, gf::MemoryInputStream, gf::CompressedInputStream, and gf::BufferInputStream.
|
pure virtual |
Change the current reading position.
position | The position to seek to, from the current position |
Implemented in gf::FileInputStream, gf::MemoryInputStream, gf::CompressedInputStream, and gf::BufferInputStream.