MCPcopy Create free account
hub / github.com/ZDoom/Raze / SerializeFunctionPointer

Function SerializeFunctionPointer

source/common/engine/serializer.cpp:1727–1797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1725//==========================================================================
1726
1727void SerializeFunctionPointer(FSerializer &arc, const char *key, FunctionPointerValue *&p)
1728{
1729 if (arc.isWriting())
1730 {
1731 if(p)
1732 {
1733 arc.BeginObject(key);
1734 arc("Class",p->ClassName);
1735 arc("Function",p->FunctionName);
1736 arc.EndObject();
1737 }
1738 else
1739 {
1740 arc.WriteKey(key);
1741 arc.w->Null();
1742 }
1743 }
1744 else
1745 {
1746 assert(p);
1747 auto v = arc.r->FindKey(key);
1748 if(!v || v->IsNull())
1749 {
1750 p = nullptr;
1751 }
1752 else if(v->IsObject())
1753 {
1754 arc.r->mObjects.Push(FJSONObject(v)); // BeginObject
1755
1756 const char * cstr;
1757 arc.StringPtr("Class", cstr);
1758
1759 if(!cstr)
1760 {
1761 arc.StringPtr("Function", cstr);
1762 if(!cstr)
1763 {
1764 Printf(TEXTCOLOR_RED "Function Pointer missing Class and Function Fields in Object\n");
1765 }
1766 else
1767 {
1768 Printf(TEXTCOLOR_RED "Function Pointer missing Class Field in Object\n");
1769 }
1770 arc.mErrors++;
1771 arc.EndObject();
1772 p = nullptr;
1773 return;
1774 }
1775
1776 p->ClassName = FString(cstr);
1777 arc.StringPtr("Function", cstr);
1778
1779 if(!cstr)
1780 {
1781 Printf(TEXTCOLOR_RED "Function Pointer missing Function Field in Object\n");
1782 arc.mErrors++;
1783 arc.EndObject();
1784 p = nullptr;

Callers 2

WriteValueMethod · 0.85
ReadValueMethod · 0.85

Calls 12

FJSONObjectClass · 0.85
PrintfFunction · 0.85
isWritingMethod · 0.80
WriteKeyMethod · 0.80
NullMethod · 0.80
IsObjectMethod · 0.80
FStringClass · 0.50
BeginObjectMethod · 0.45
EndObjectMethod · 0.45
FindKeyMethod · 0.45
IsNullMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected