Gamedev Framework (gf)  0.2.0
A C++11 framework for 2D games
Public Member Functions | List of all members
gf::MemoryInputStream Class Reference

Memory based input stream. More...

#include <gf/InputStreams.h>

Inheritance diagram for gf::MemoryInputStream:
Inheritance graph

Public Member Functions

 MemoryInputStream (const void *data, std::size_t size)
 Constructor. More...
virtual std::size_t read (void *data, std::size_t size) override
 Read data from the stream. More...
virtual long seek (long position) override
 Change the current reading position. More...
virtual long tell () override
 Get the current reading position in the stream. More...
virtual std::size_t getSize () override
 Return the size of the stream. More...
- Public Member Functions inherited from gf::InputStream
 InputStream ()=default
 Default constructor. More...
 InputStream (const InputStream &)=delete
 Deleted copy constructor. More...
InputStreamoperator= (const InputStream &)=delete
 Deleted copy assignment. More...
virtual ~InputStream ()
 Destructor. More...

Detailed Description

Memory based input stream.

Constructor & Destructor Documentation

gf::MemoryInputStream::MemoryInputStream ( const void *  data,
std::size_t  size 


This class does not own the memory. The user must keep the memory available when the stream is active.

dataPointer to the data
sizeSize of the data

Member Function Documentation

virtual std::size_t gf::MemoryInputStream::getSize ( )

Return the size of the stream.

The total number of bytes available in the stream

Implements gf::InputStream.

virtual std::size_t gf::MemoryInputStream::read ( void *  data,
std::size_t  size 

Read data from the stream.

After reading, the stream's reading position must be advanced by the amount of bytes read.

dataBuffer where to copy the read data
sizeDesired number of bytes to read
The number of bytes actually read

Implements gf::InputStream.

virtual long gf::MemoryInputStream::seek ( long  position)

Change the current reading position.

positionThe position to seek to, from the beginning
The position actually sought to

Implements gf::InputStream.

virtual long gf::MemoryInputStream::tell ( )

Get the current reading position in the stream.

The current position

Implements gf::InputStream.