![]() |
GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Fast binary serialization/deserialization for SerializerElement trees. More...
#include <BinarySerializer.h>
Public Types | |
| enum class | NodeType : uint8_t { Element = 0x01 , ValueUndefined = 0x02 , ValueBool = 0x03 , ValueInt = 0x04 , ValueDouble = 0x05 , ValueString = 0x06 } |
Static Public Member Functions | |
| static void | SerializeToBinaryBuffer (const SerializerElement &element, std::vector< uint8_t > &outBuffer) |
| Serialize a SerializerElement tree to a binary buffer. More... | |
| static bool | DeserializeFromBinaryBuffer (const uint8_t *buffer, size_t bufferSize, SerializerElement &outElement) |
| Deserialize a binary buffer back to a SerializerElement tree. More... | |
Helpers | |
| static uintptr_t | CreateBinarySnapshot (const SerializerElement &element) |
| Create a binary snapshot and return the size. The binary data is written to Emscripten's heap at the returned pointer. More... | |
| static size_t | GetLastBinarySnapshotSize () |
| Get the size of the last created binary snapshot. Must be called immediately after CreateBinarySnapshot. | |
| static void | FreeBinarySnapshot (uintptr_t bufferPtr) |
| Free a binary snapshot. | |
| static SerializerElement * | DeserializeBinarySnapshot (uintptr_t bufferPtr, size_t size) |
| Deserialize binary snapshot back to SerializerElement. More... | |
Fast binary serialization/deserialization for SerializerElement trees.
This format is optimized for speed and compactness, not for human readability or long-term storage. For transferring data between "threads" (web workers).
|
static |
Create a binary snapshot and return the size. The binary data is written to Emscripten's heap at the returned pointer.
|
static |
Deserialize binary snapshot back to SerializerElement.
|
static |
Deserialize a binary buffer back to a SerializerElement tree.
| buffer | The binary data |
| bufferSize | Size of the binary data |
| outElement | The output element (will be populated) |
|
static |
Serialize a SerializerElement tree to a binary buffer.
| element | The root element to serialize |
| outBuffer | Output buffer that will contain the binary data |