The Interchange File Format stream class. More...

#include "murl_util_iff_stream.h"

Public Member Functions

 IffStream (UInt32 form, UInt32 fourCC, const ConstData &data)
 Constructor taking the file identifier and the file type identifier. More...
 
 IffStream (UInt32 fourCC, const ConstData &data)
 Constructor taking the file type identifier. More...
 
 IffStream (const ConstData &data)
 Constructor to create a headerless IffStream. More...
 
virtual ~IffStream ()
 The destructor.
 
virtual Bool Open ()
 Open the iff-file stream. More...
 
virtual Bool Close ()
 Close the iff-file stream. More...
 
virtual UInt32 Check (UInt32 fourCC=0) const
 Check the chunk identifier at the current read position and return the byte size of the chunk. More...
 
virtual Bool Check (UInt32 fourCC, UInt32 chunkSize, UInt32 additionalSize=0) const
 Check the chunk identifier at the current read position and verify the byte size of the chunk. More...
 
virtual const IffChunkRead (UInt32 fourCC=0) const
 Check the chunk identifier and size at the current read position and return the the chunk. More...
 
virtual Bool Advance ()
 Advance the current read position to the next chunk. More...
 
virtual Bool Rewind ()
 Rewind the read postition to the first chunk. More...
 
virtual Bool Eos () const
 Check if the end of the stream is reached. More...
 
template<class ChunkType >
Bool CheckChunk (UInt32 additionalSize=0) const
 Check() a chunk of specified type at the current read position. More...
 
template<class ChunkType >
const ChunkType * ReadChunk () const
 Read() a chunk of specified type at the current read position. More...
 

Protected Attributes

UInt32 mForm
 The file format identifier.
 
UInt32 mFourCC
 The FourCC file type identifier.
 
ConstData mData
 Reference to the iff-file data.
 
UInt32 mCurrentPos
 The current byte position.
 

Detailed Description

The Interchange File Format stream class.

The IffStream class is used to deserialize an data object which contains iff-file data. The data object's memory to read from is used by reference only, which allows using memory mapped files without copying the data to memory.

(!) The ownership of the data object's memory pointer remains to the caller. This means as long as the IffStream is used, the memory pointer of the data object (but probably not to data object itself) must be available in memory.

Constructor & Destructor Documentation

◆ IffStream() [1/3]

Murl::Util::IffStream::IffStream ( UInt32  form,
UInt32  fourCC,
const ConstData data 
)

Constructor taking the file identifier and the file type identifier.

This method takes care of the system's byte ordering.

Parameters
formThe file format identifier.
fourCCThe file type identifier.
dataThe iff-file data object.

◆ IffStream() [2/3]

Murl::Util::IffStream::IffStream ( UInt32  fourCC,
const ConstData data 
)

Constructor taking the file type identifier.

Set the file format identifier to 'MURL'. This method takes care of the system's byte ordering.

Parameters
fourCCThe file type identifier.
dataThe iff-file data object.

◆ IffStream() [3/3]

Murl::Util::IffStream::IffStream ( const ConstData data)

Constructor to create a headerless IffStream.

Use this constructor to parse sub-streams from a given container stream. This method takes care of the system's byte ordering.

Parameters
dataThe iff-file data object.

Member Function Documentation

◆ Open()

virtual Bool Murl::Util::IffStream::Open ( )
virtual

Open the iff-file stream.

Verify the IffHeader and set the read position to the first chunk. The verification checks the file identifier, the file type identifier and the file size.

Returns
true if successful.

◆ Close()

virtual Bool Murl::Util::IffStream::Close ( )
virtual

Close the iff-file stream.

Returns
true if successful.

◆ Check() [1/2]

virtual UInt32 Murl::Util::IffStream::Check ( UInt32  fourCC = 0) const
virtual

Check the chunk identifier at the current read position and return the byte size of the chunk.

This method takes care of the system's byte ordering.

Parameters
fourCCThe FourCC chunk identifier to check or zero to skip the chunk test.
Returns
The byte size of the chunk, zero if the check failed or the end of the stream is reached.

Referenced by CheckChunk().

◆ Check() [2/2]

virtual Bool Murl::Util::IffStream::Check ( UInt32  fourCC,
UInt32  chunkSize,
UInt32  additionalSize = 0 
) const
virtual

Check the chunk identifier at the current read position and verify the byte size of the chunk.

This method takes care of the system's byte ordering.

Parameters
fourCCThe FourCC chunk identifier to check or zero to skip the chunk test.
chunkSizeThe byte size of the chunk.
additionalSizeAdditional byte size to check.
Returns
true if successful.

◆ Read()

virtual const IffChunk* Murl::Util::IffStream::Read ( UInt32  fourCC = 0) const
virtual

Check the chunk identifier and size at the current read position and return the the chunk.

This method takes care of the system's byte ordering.

Parameters
fourCCThe FourCC chunk identifier to check or zero to skip the chunk test.
Returns
Pointer to the chunk, null if the check failed or the end of the stream is reached.

Referenced by ReadChunk().

◆ Advance()

virtual Bool Murl::Util::IffStream::Advance ( )
virtual

Advance the current read position to the next chunk.

Returns
true if successful, false if the end of the stream is reached.

◆ Rewind()

virtual Bool Murl::Util::IffStream::Rewind ( )
virtual

Rewind the read postition to the first chunk.

Returns
true if successful.

◆ Eos()

virtual Bool Murl::Util::IffStream::Eos ( ) const
virtual

Check if the end of the stream is reached.

Returns
true if the end of the stream is reached.

◆ CheckChunk()

template<class ChunkType >
Bool Murl::Util::IffStream::CheckChunk ( UInt32  additionalSize = 0) const
inline

Check() a chunk of specified type at the current read position.

Template Parameters
ChunkTypeThe iff chunk type which must have a public enum FOURCC_CHUNK constant defining the chunk identifier.
Parameters
additionalSizeAdditional byte size to check.
Returns
true if successful.

References Check().

◆ ReadChunk()

template<class ChunkType >
const ChunkType* Murl::Util::IffStream::ReadChunk ( ) const
inline

Read() a chunk of specified type at the current read position.

Template Parameters
ChunkTypeThe iff chunk type which must have a public enum FOURCC_CHUNK constant defining the chunk identifier.
Returns
Pointer to the chunk of specified type, null if the check failed or the end of the stream is reached.

References Read().


The documentation for this class was generated from the following file:
  • murl_util_iff_stream.h


Copyright © 2011-2024 Spraylight GmbH.