Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | List of all members
castor3d::BinaryChunk Class Reference

#include <BinaryChunk.hpp>

Public Member Functions

C3D_API BinaryChunk (bool isLittleEndian)
 Constructor, read mode.
 
C3D_API BinaryChunk (ChunkType type)
 Constructor, write mode.
 
C3D_API void finalise ()
 Computes the final data buffer from each one added until this call.
 
C3D_API void add (castor::ByteArray data)
 adds data to the chunk
 
C3D_API void add (uint8_t *data, uint32_t size)
 adds data to the chunk
 
C3D_API void get (uint8_t *data, uint32_t size)
 Retrieves data from the chunk.
 
C3D_API bool checkAvailable (uint32_t size=0) const
 Checks that the remaining place can hold the given size.
 
C3D_API uint32_t getRemaining () const
 Retrieves the remaining place.
 
C3D_API bool getSubChunk (BinaryChunk &subchunk)
 Retrieves a subchunk.
 
C3D_API bool addSubChunk (BinaryChunk const &subchunk)
 Writes a subchunk into a chunk.
 
C3D_API bool write (castor::BinaryFile &file)
 To chunk writer function.
 
C3D_API bool read (castor::BinaryFile &file)
 From file reader function.
 
uint8_t const * getRemainingData () const
 Retrieves the remaining data.
 
ChunkType getChunkType () const
 Retrieves the chunk type.
 
uint32_t getDataSize () const
 Retrieves the chunk data size.
 
uint8_t const * getData () const
 Retrieves the chunk data.
 
void setData (uint8_t const *begin, uint8_t const *end)
 Sets the chunk's data.
 
void endParse ()
 Retrieves the chunk data size.
 
void resetParse ()
 Resets the chunk, to be able to reparse it.
 
bool isLittleEndian () const noexcept
 

Constructor & Destructor Documentation

◆ BinaryChunk() [1/2]

C3D_API castor3d::BinaryChunk::BinaryChunk ( bool isLittleEndian)
explicit

Constructor, read mode.

◆ BinaryChunk() [2/2]

C3D_API castor3d::BinaryChunk::BinaryChunk ( ChunkType type)
explicit

Constructor, write mode.

Parameters
[in]typeThe chunk type.

Member Function Documentation

◆ add() [1/2]

C3D_API void castor3d::BinaryChunk::add ( castor::ByteArray data)

adds data to the chunk

Parameters
[in]dataThe data buffer

◆ add() [2/2]

C3D_API void castor3d::BinaryChunk::add ( uint8_t * data,
uint32_t size )

adds data to the chunk

Parameters
[in]dataThe data buffer
[in]sizeThe buffer size

◆ addSubChunk()

C3D_API bool castor3d::BinaryChunk::addSubChunk ( BinaryChunk const & subchunk)

Writes a subchunk into a chunk.

Parameters
[in]subchunkThe subchunk
Returns
false if any error occured

Referenced by castor3d::BinaryWriterBase< TWritten >::doWriteHeader(), and castor3d::BinaryWriterBase< TWritten >::write().

Here is the caller graph for this function:

◆ checkAvailable()

C3D_API bool castor3d::BinaryChunk::checkAvailable ( uint32_t size = 0) const

Checks that the remaining place can hold the given size.

Parameters
[in]sizeThe size

Referenced by castor3d::BinaryParserBase< TParsed >::doGetSubChunk(), castor3d::ChunkParser< castor::Path >::parse(), castor3d::ChunkParser< castor::String >::parse(), and castor3d::ChunkParserBase::parse().

Here is the caller graph for this function:

◆ endParse()

void castor3d::BinaryChunk::endParse ( )
inline

Retrieves the chunk data size.

Referenced by castor3d::BinaryParserBase< TParsed >::doParseHeader(), and castor3d::BinaryParserBase< TParsed >::parse().

Here is the caller graph for this function:

◆ finalise()

C3D_API void castor3d::BinaryChunk::finalise ( )

Computes the final data buffer from each one added until this call.

Referenced by castor3d::BinaryWriterBase< TWritten >::write().

Here is the caller graph for this function:

◆ get()

C3D_API void castor3d::BinaryChunk::get ( uint8_t * data,
uint32_t size )

Retrieves data from the chunk.

Parameters
[in]dataThe data buffer to fill
[in]sizeThe buffer size

Referenced by castor3d::ChunkParserBase::parse().

Here is the caller graph for this function:

◆ getChunkType()

ChunkType castor3d::BinaryChunk::getChunkType ( ) const
inline

Retrieves the chunk type.

Returns
The value

Referenced by castor3d::BinaryParserBase< TParsed >::parse().

Here is the caller graph for this function:

◆ getData()

uint8_t const * castor3d::BinaryChunk::getData ( ) const
inline

Retrieves the chunk data.

Returns
The value

◆ getDataSize()

uint32_t castor3d::BinaryChunk::getDataSize ( ) const
inline

Retrieves the chunk data size.

Returns
The value

◆ getRemaining()

C3D_API uint32_t castor3d::BinaryChunk::getRemaining ( ) const

Retrieves the remaining place.

Returns
The value

Referenced by castor3d::ChunkParser< castor::Path >::parse(), and castor3d::ChunkParser< castor::String >::parse().

Here is the caller graph for this function:

◆ getRemainingData()

uint8_t const * castor3d::BinaryChunk::getRemainingData ( ) const
inline

Retrieves the remaining data.

Returns
The value

◆ getSubChunk()

C3D_API bool castor3d::BinaryChunk::getSubChunk ( BinaryChunk & subchunk)

Retrieves a subchunk.

Parameters
[out]subchunkReceives the subchunk
Returns
false if any error occured

Referenced by castor3d::BinaryParserBase< TParsed >::doGetSubChunk(), and castor3d::BinaryParserBase< TParsed >::doParseHeader().

Here is the caller graph for this function:

◆ isLittleEndian()

bool castor3d::BinaryChunk::isLittleEndian ( ) const
inlinenoexcept

◆ read()

C3D_API bool castor3d::BinaryChunk::read ( castor::BinaryFile & file)

From file reader function.

Parameters
[in]fileThe file containing the chunk
Returns
false if any error occured

Referenced by castor3d::BinaryParserBase< TParsed >::parse().

Here is the caller graph for this function:

◆ resetParse()

void castor3d::BinaryChunk::resetParse ( )
inline

Resets the chunk, to be able to reparse it.

Referenced by castor3d::BinaryParserBase< TParsed >::parse().

Here is the caller graph for this function:

◆ setData()

void castor3d::BinaryChunk::setData ( uint8_t const * begin,
uint8_t const * end )
inline

Sets the chunk's data.

Parameters
[in]beginThe data buffer's begin
[in]endThe data buffer's end

Referenced by castor3d::ChunkWriterBase::write().

Here is the caller graph for this function:

◆ write()

C3D_API bool castor3d::BinaryChunk::write ( castor::BinaryFile & file)

To chunk writer function.

Parameters
[in]fileThe file
Returns
false if any error occured

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