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

File based input stream. More...

#include <gf/InputStreams.h>

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

Public Member Functions

 FileInputStream (const Path &path)
 Constructor. More...
 
 ~FileInputStream ()
 Destructor. 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

File based input stream.

Constructor & Destructor Documentation

gf::FileInputStream::FileInputStream ( const Path path)
explicit

Constructor.

The constructor opens the file. If the file is not opened, the operations will return default values.

Parameters
pathThe path to the file
gf::FileInputStream::~FileInputStream ( )

Destructor.

The destructor closes the file.

Member Function Documentation

virtual std::size_t gf::FileInputStream::getSize ( )
overridevirtual

Return the size of the stream.

Returns
The total number of bytes available in the stream

Implements gf::InputStream.

virtual std::size_t gf::FileInputStream::read ( void *  data,
std::size_t  size 
)
overridevirtual

Read data from the stream.

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

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

Implements gf::InputStream.

virtual long gf::FileInputStream::seek ( long  position)
overridevirtual

Change the current reading position.

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

Implements gf::InputStream.

virtual long gf::FileInputStream::tell ( )
overridevirtual

Get the current reading position in the stream.

Returns
The current position

Implements gf::InputStream.