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

Buffer input stream. More...

#include <gf/Streams.h>

Inheritance diagram for gf::BufferInputStream:
Inheritance graph
[legend]

Public Member Functions

 BufferInputStream (std::vector< uint8_t > *bytes)
 Constructor. More...
 
std::vector< uint8_t > * getBytes ()
 Get the underlying bytes. More...
 
virtual std::size_t read (BufferRef< uint8_t > buffer) override
 Read data from the stream. More...
 
virtual void seek (std::ptrdiff_t position) override
 Change the current reading position. More...
 
virtual void skip (std::ptrdiff_t position) override
 Change the current reading position. More...
 
virtual bool isFinished () override
 Tell if the stream is at the end. 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...
 
std::size_t read (uint8_t &byte)
 Read a single byte from the stream. More...
 

Detailed Description

Buffer input stream.

Constructor & Destructor Documentation

◆ BufferInputStream()

gf::BufferInputStream::BufferInputStream ( std::vector< uint8_t > *  bytes)

Constructor.

Parameters
bytesThe supplied external bytes to be read

Member Function Documentation

◆ getBytes()

std::vector<uint8_t>* gf::BufferInputStream::getBytes ( )
inline

Get the underlying bytes.

◆ isFinished()

virtual bool gf::BufferInputStream::isFinished ( )
overridevirtual

Tell if the stream is at the end.

Returns
A boolean indicating the end of the stream

Implements gf::InputStream.

◆ read()

virtual std::size_t gf::BufferInputStream::read ( BufferRef< uint8_t >  buffer)
overridevirtual

Read data from the stream.

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

Parameters
bufferThe buffer where to copy the read data
Returns
The number of bytes actually read

Implements gf::InputStream.

◆ seek()

virtual void gf::BufferInputStream::seek ( std::ptrdiff_t  position)
overridevirtual

Change the current reading position.

Parameters
positionThe position to seek to, from the beginning

Implements gf::InputStream.

◆ skip()

virtual void gf::BufferInputStream::skip ( std::ptrdiff_t  position)
overridevirtual

Change the current reading position.

Parameters
positionThe position to seek to, from the current position

Implements gf::InputStream.