C4 Engine Terathon Software C4 Engine API Documentation

• Resource Manager

API Links
Developer Links

class Unpacker

Defined in:  C4Packing.h
Represents an input deserialization stream.
Definition

class Unpacker

Member Functions
Unpacker::GetType Returns the generic type appearing next in the input stream.
Unpacker::ReadArray Reads an array of data from the input stream.
Unpacker::AddObjectLink Adds an object link that will be resolved after unpacking is complete.
Unpacker::AddNodeLink Adds a node link that will be resolved after unpacking is complete.
Constructor

Unpacker(const void *ptr, long end = 1, long ver = 0);

Parameters
ptr A pointer to a memory block containing the packed data.
end The endianness of the packed data. A value of 0x00000001 corresponds to the endianness of the local machine, and a value of 0x01000000 corresponds to the opposite endianness.
ver The storage format version of the packed data. The constant kWorldVersion corresponds to the current version.
Description
A Unpacker object is passed to the Packable::Unpack function when the engine needs to deserialize data to be stored in an object. The Unpacker object encapsulates an input serialization stream, and the >> operator is typically used to read data from it.

When data is read from an Unpacker object, endianness is automatically reversed if necessary.
Overloaded Operators
template <typename type> Unpacker& operator >>(type& data); Reads the data given by the data parameter from the input stream.
Unpacker& operator >>(bool& data); Reads the boolean value given by the data parameter from the input stream.
template <long len> Unpacker& operator >>(String<len>& string); Reads the string given by the string parameter from the input stream.
See Also

Packer

Packable