MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Serialize

Method Serialize

Source/Engine/Scripting/Internal/ManagedSerialization.cpp:13–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include "Engine/Scripting/Internal/StdTypesContainer.h"
12
13void ManagedSerialization::Serialize(ISerializable::SerializeStream& stream, MObject* object)
14{
15 if (!object)
16 {
17 // Empty object
18 stream.StartObject();
19 stream.EndObject();
20 return;
21 }
22
23 // Prepare arguments
24 bool isManagedOnly = true;
25 void* params[2];
26 params[0] = object;
27 params[1] = &isManagedOnly;
28
29 // Call serialization tool
30 MObject* exception = nullptr;
31 // TODO: use method thunk
32 auto invokeResultStr = (MString*)StdTypesContainer::Instance()->Json_Serialize->Invoke(nullptr, params, &exception);
33 if (exception)
34 {
35 MException ex(exception);
36 ex.Log(LogType::Error, TEXT("ManagedSerialization::Serialize"));
37
38 // Empty object
39 stream.StartObject();
40 stream.EndObject();
41 return;
42 }
43
44 // Write result data
45 stream.RawValue(MCore::String::GetChars(invokeResultStr));
46}
47
48void ManagedSerialization::SerializeDiff(ISerializable::SerializeStream& stream, MObject* object, MObject* other)
49{

Callers

nothing calls this directly

Calls 6

InstanceClass · 0.50
StartObjectMethod · 0.45
EndObjectMethod · 0.45
InvokeMethod · 0.45
LogMethod · 0.45
RawValueMethod · 0.45

Tested by

no test coverage detected