13 #include "GDCore/Serialization/SerializerElement.h"
32 std::vector<uint8_t>& outBuffer);
42 static bool DeserializeFromBinaryBuffer(
const uint8_t* buffer,
60 static size_t GetLastBinarySnapshotSize();
65 static void FreeBinarySnapshot(uintptr_t bufferPtr);
75 enum class NodeType : uint8_t {
77 ValueUndefined = 0x02,
87 std::vector<uint8_t>& buffer);
89 std::vector<uint8_t>& buffer);
90 static void SerializeString(
const gd::String& str,
91 std::vector<uint8_t>& buffer);
94 static bool DeserializeElement(
const uint8_t*& ptr,
97 static bool DeserializeValue(
const uint8_t*& ptr,
101 static bool DeserializeString(
const uint8_t*& ptr,
106 template <
typename T>
107 static void Write(std::vector<uint8_t>& buffer,
const T& value) {
108 const uint8_t* bytes =
reinterpret_cast<const uint8_t*
>(&value);
109 buffer.insert(buffer.end(), bytes, bytes +
sizeof(T));
113 template <
typename T>
114 static bool Read(
const uint8_t*& ptr,
const uint8_t* end, T& value) {
115 if (ptr +
sizeof(T) > end)
return false;
116 std::memcpy(&value, ptr,
sizeof(T));
122 static size_t lastBinarySnapshotSize;
Fast binary serialization/deserialization for SerializerElement trees.
Definition: BinarySerializer.h:23
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
A value stored inside a gd::SerializerElement.
Definition: SerializerValue.h:20
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24