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

Abstract class for custom file output streams. More...

#include <gf/Stream.h>

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

Public Member Functions

 OutputStream ()=default
 Default constructor. More...
 
 OutputStream (const InputStream &)=delete
 Deleted copy constructor. More...
 
OutputStreamoperator= (const InputStream &)=delete
 Deleted copy assignment. More...
 
virtual ~OutputStream ()
 Destructor. More...
 
virtual std::size_t write (ArrayRef< uint8_t > buffer)=0
 Write data to the stream. More...
 
std::size_t write (uint8_t byte)
 Write a single byte to the stream. More...
 
virtual std::size_t getWrittenBytesCount () const =0
 Get the number of bytes already written. More...
 

Detailed Description

Abstract class for custom file output streams.

This class allows users to define their own stream output sinks to which Gamedev Framework can save resources.

See also
gf::InputStream

Constructor & Destructor Documentation

◆ OutputStream() [1/2]

gf::OutputStream::OutputStream ( )
default

Default constructor.

◆ OutputStream() [2/2]

gf::OutputStream::OutputStream ( const InputStream )
delete

Deleted copy constructor.

◆ ~OutputStream()

virtual gf::OutputStream::~OutputStream ( )
virtual

Destructor.

Member Function Documentation

◆ getWrittenBytesCount()

virtual std::size_t gf::OutputStream::getWrittenBytesCount ( ) const
pure virtual

Get the number of bytes already written.

This function returns the number of bytes actually written i.e. it does not take into account possible bytes that have not been flushed yet.

Returns
The number of written bytes

Implemented in gf::CompressedOutputStream, gf::MemoryOutputStream, and gf::FileOutputStream.

◆ operator=()

OutputStream& gf::OutputStream::operator= ( const InputStream )
delete

Deleted copy assignment.

◆ write() [1/2]

virtual std::size_t gf::OutputStream::write ( ArrayRef< uint8_t >  buffer)
pure virtual

Write data to the stream.

Parameters
bufferThe buffer to copy to the stream
Returns
The number of bytes actually written

Implemented in gf::CompressedOutputStream, gf::MemoryOutputStream, and gf::FileOutputStream.

◆ write() [2/2]

std::size_t gf::OutputStream::write ( uint8_t  byte)
inline

Write a single byte to the stream.

Parameters
byteThe byte to copy to the stream
Returns
The number of bytes actually written