Skip to main content

Module typetree

Module typetree 

Source
Expand description

Type trees: a class’s serialized layout, and decoding an object’s bytes by it.

The rules: primitives by their type name; string is a 32-bit length, the UTF-8 bytes, then 4-byte alignment; TypelessData a 32-bit length and the bytes; pair its two children; a node whose first child is Array is a vector (a 32-bit count, then the elements, each by the array’s second child); anything else is a struct of its children in order. After any node whose meta flag has ALIGN, the position is aligned to 4 bytes (from the object’s start); an Array child’s flag aligns its vector.

Structs§

Node
One node: its type and field name, its byte size (-1: variable), version, meta flags and children (indices into the tree’s node list).
TypeTree
A class’s type tree; node 0 is the root.

Constants§

ALIGN
The meta flag that aligns the position to 4 bytes after the node.