Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
Abstract class for custom file input streams. More...
#include <gf/InputStream.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 (void *data, std::size_t size)=0 |
Read data from the stream. More... | |
virtual long | seek (long position)=0 |
Change the current reading position. More... | |
virtual long | tell ()=0 |
Get the current reading position in the stream. More... | |
virtual std::size_t | getSize ()=0 |
Return the size of the stream. More... | |
Abstract class for custom file input streams.
This class allows users to define their own file input sources from which Gamedev Framework can load resources.
Gamedev Framework resource classes like gf::Texture and gf::Shader provide loadFromFile()
and loadFromMemory()
functions, which 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 load SFML resources with their loadFromStream()
function.
|
default |
Default constructor.
|
delete |
Deleted copy constructor.
|
virtual |
Destructor.
|
pure virtual |
Return the size of the stream.
Implemented in gf::MemoryInputStream, and gf::FileInputStream.
|
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.
data | Buffer where to copy the read data |
size | Desired number of bytes to read |
Implemented in gf::MemoryInputStream, and gf::FileInputStream.
|
pure virtual |
Change the current reading position.
position | The position to seek to, from the beginning |
Implemented in gf::MemoryInputStream, and gf::FileInputStream.
|
pure virtual |
Get the current reading position in the stream.
Implemented in gf::MemoryInputStream, and gf::FileInputStream.