C4 Engine
C4 Engine API Documentation


Defined in:  C4Packing.h
Unpacks a sequence of chunks from an input stream.

template <class type> void UnpackChunkList(Unpacker& data, uint32 unpackFlags);

data The Unpacker object from which the object data is read.
unpackFlags The unpacking flags.
The UnpackChunkList function is used to unpack a sequence of chunks from an input stream that was previously packed using ChunkHeader structures. This function should be called from the Packable::Unpack function, and it iterates through the chunks in the input stream until a terminator chunk is found. For each chunk, the UnpackChunk member function of the class specified by the type template parameter is called. The UnpackChunk function must have the following declaration.
void UnpackChunk(const ChunkHeader *chunkHeader, Unpacker& data, uint32 unpackFlags);
The chunkHeader parameter passed to this function should be examined, and the data corresponding to its type should be read from the Unpacker object passed as the data parameter. The unpackFlags parameter passed to the UnpackChunk function is the same value of the unpackFlags parameter that was passed to the UnpackChunkList function. The UnpackChunk function should return true if data was unpacked from the chunk, and it should return false if the chunk type is not supported (which ordinarily means that it's obsolete). The UnpackChunkList function simply skips the data for chunks that are identified as unsupported by the UnpackChunk function.
See Also