Castor3D 0.16.0
Multiplatform 3D engine
|
#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 |
|
explicit |
Constructor, read mode.
Constructor, write mode.
[in] | type | The chunk type. |
C3D_API void castor3d::BinaryChunk::add | ( | castor::ByteArray | data | ) |
adds data to the chunk
[in] | data | The data buffer |
C3D_API void castor3d::BinaryChunk::add | ( | uint8_t * | data, |
uint32_t | size ) |
adds data to the chunk
[in] | data | The data buffer |
[in] | size | The buffer size |
C3D_API bool castor3d::BinaryChunk::addSubChunk | ( | BinaryChunk const & | subchunk | ) |
Writes a subchunk into a chunk.
[in] | subchunk | The subchunk |
false
if any error occured Referenced by castor3d::BinaryWriterBase< TWritten >::doWriteHeader(), and castor3d::BinaryWriterBase< TWritten >::write().
C3D_API bool castor3d::BinaryChunk::checkAvailable | ( | uint32_t | size = 0 | ) | const |
Checks that the remaining place can hold the given size.
[in] | size | The size |
Referenced by castor3d::BinaryParserBase< TParsed >::doGetSubChunk(), castor3d::ChunkParser< castor::Path >::parse(), castor3d::ChunkParser< castor::String >::parse(), and castor3d::ChunkParserBase::parse().
|
inline |
Retrieves the chunk data size.
Referenced by castor3d::BinaryParserBase< TParsed >::doParseHeader(), and castor3d::BinaryParserBase< TParsed >::parse().
C3D_API void castor3d::BinaryChunk::finalise | ( | ) |
Computes the final data buffer from each one added until this call.
Referenced by castor3d::BinaryWriterBase< TWritten >::write().
C3D_API void castor3d::BinaryChunk::get | ( | uint8_t * | data, |
uint32_t | size ) |
Retrieves data from the chunk.
[in] | data | The data buffer to fill |
[in] | size | The buffer size |
Referenced by castor3d::ChunkParserBase::parse().
|
inline |
Retrieves the chunk type.
Referenced by castor3d::BinaryParserBase< TParsed >::parse().
|
inline |
Retrieves the chunk data.
|
inline |
Retrieves the chunk data size.
C3D_API uint32_t castor3d::BinaryChunk::getRemaining | ( | ) | const |
Retrieves the remaining place.
Referenced by castor3d::ChunkParser< castor::Path >::parse(), and castor3d::ChunkParser< castor::String >::parse().
|
inline |
Retrieves the remaining data.
C3D_API bool castor3d::BinaryChunk::getSubChunk | ( | BinaryChunk & | subchunk | ) |
Retrieves a subchunk.
[out] | subchunk | Receives the subchunk |
false
if any error occured Referenced by castor3d::BinaryParserBase< TParsed >::doGetSubChunk(), and castor3d::BinaryParserBase< TParsed >::doParseHeader().
|
inlinenoexcept |
C3D_API bool castor3d::BinaryChunk::read | ( | castor::BinaryFile & | file | ) |
From file reader function.
[in] | file | The file containing the chunk |
false
if any error occured Referenced by castor3d::BinaryParserBase< TParsed >::parse().
|
inline |
Resets the chunk, to be able to reparse it.
Referenced by castor3d::BinaryParserBase< TParsed >::parse().
|
inline |
Sets the chunk's data.
[in] | begin | The data buffer's begin |
[in] | end | The data buffer's end |
Referenced by castor3d::ChunkWriterBase::write().
C3D_API bool castor3d::BinaryChunk::write | ( | castor::BinaryFile & | file | ) |
To chunk writer function.
[in] | file | The file |
false
if any error occured