V-Gears 0
Free Final Fantasy VII engine.
VGears::LZSDataStream Class Reference

Handles LZS compressed data streams. More...

#include <VGearsLZSDataStream.h>

Inheritance diagram for VGears::LZSDataStream:
Collaboration diagram for VGears::LZSDataStream:

Public Member Functions

 LZSDataStream (const Ogre::DataStreamPtr &compressed_stream)
 Constructor. More...
 
 LZSDataStream (const String &name, const Ogre::DataStreamPtr &compressed_stream)
 Constructor. More...
 
virtual ~LZSDataStream ()
 Destructor. More...
 
virtual size_t read (void *buf, size_t count) override
 Reads from the current position of stream into a buffer. More...
 
virtual bool eof () const override
 Indicates if the stream has reached the end. More...
 
virtual void skip (long count) override
 Unimplemented. More...
 
virtual void seek (size_t pos) override
 Unimplemented. More...
 
virtual size_t tell () const override
 Retrieves the current stream position. More...
 
virtual void close () override
 Closes the stream. More...
 
size_t AvailableCompressed () const
 Checks how many data still remains compresses. More...
 
size_t AvailableUncompressed () const
 Checks how many data still has been uncompressesed. More...
 
void FlipEndian (uint32 &inout_data)
 Flips the endian mode of some data. More...
 

Protected Member Functions

virtual void init ()
 Initializes the stream and sets instance data. More...
 
virtual void DecompressChunk ()
 Decompresses the stream. More...
 

Protected Attributes

Ogre::DataStreamPtr compressed_stream_
 
uint32 available_compressed_
 
size_t position_
 
RingBuffer< 4096 > buffer_
 

Detailed Description

Handles LZS compressed data streams.

Constructor & Destructor Documentation

◆ LZSDataStream() [1/2]

VGears::LZSDataStream::LZSDataStream ( const Ogre::DataStreamPtr &  compressed_stream)

Constructor.

Parameters
[in]compressed_streamThe compressed stream.

◆ LZSDataStream() [2/2]

VGears::LZSDataStream::LZSDataStream ( const String name,
const Ogre::DataStreamPtr &  compressed_stream 
)

Constructor.

Parameters
[in]nameNAme for th stream.
[in]compressed_streamThe compressed stream.

◆ ~LZSDataStream()

VGears::LZSDataStream::~LZSDataStream ( )
virtual

Destructor.

Member Function Documentation

◆ AvailableCompressed()

size_t VGears::LZSDataStream::AvailableCompressed ( ) const
inline

Checks how many data still remains compresses.

Returns
The number of compressed bytes.

◆ AvailableUncompressed()

size_t VGears::LZSDataStream::AvailableUncompressed ( ) const
inline

Checks how many data still has been uncompressesed.

Returns
The number of uncompressed bytes.

◆ close()

void VGears::LZSDataStream::close ( )
overridevirtual

Closes the stream.

◆ DecompressChunk()

void VGears::LZSDataStream::DecompressChunk ( )
protectedvirtual

Decompresses the stream.

Todo:
The whole stream?

◆ eof()

bool VGears::LZSDataStream::eof ( ) const
overridevirtual

Indicates if the stream has reached the end.

Returns
True if the stream is ended, false otherwise.

◆ FlipEndian()

void VGears::LZSDataStream::FlipEndian ( uint32 inout_data)

Flips the endian mode of some data.

Little endian data will be transformed into big endian, and big endian data will be transformed into little endian.

Parameters
[in,out]inout_dataThe data to flip.

◆ init()

void VGears::LZSDataStream::init ( )
protectedvirtual

Initializes the stream and sets instance data.

◆ read()

size_t VGears::LZSDataStream::read ( void *  buf,
size_t  count 
)
overridevirtual

Reads from the current position of stream into a buffer.

It also advances the stream cursor.

Parameters
[out]bufBuffer to read to.
[in]countNumber of data to read. If the end of the stream is reached before reading this much, it will stop reading.

◆ seek()

void VGears::LZSDataStream::seek ( size_t  pos)
overridevirtual

Unimplemented.

Not required.

Parameters
[in]posUnused.

◆ skip()

void VGears::LZSDataStream::skip ( long  count)
overridevirtual

Unimplemented.

Not required, can use read instead.

Parameters
[in]countUnused.

◆ tell()

size_t VGears::LZSDataStream::tell ( ) const
overridevirtual

Retrieves the current stream position.

Returns
The current stream position.

Member Data Documentation

◆ available_compressed_

uint32 VGears::LZSDataStream::available_compressed_
protected

◆ buffer_

RingBuffer<4096> VGears::LZSDataStream::buffer_
protected

◆ compressed_stream_

Ogre::DataStreamPtr VGears::LZSDataStream::compressed_stream_
protected

◆ position_

size_t VGears::LZSDataStream::position_
protected

The documentation for this class was generated from the following files: