MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / componentToJsonV1

Function componentToJsonV1

launcher/minecraft/PackProfile.cpp:89–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87static const int currentComponentsFileVersion = 1;
88
89static QJsonObject componentToJsonV1(ComponentPtr component)
90{
91 QJsonObject obj;
92 // critical
93 obj.insert("uid", component->m_uid);
94 if(!component->m_version.isEmpty())
95 {
96 obj.insert("version", component->m_version);
97 }
98 if(component->m_dependencyOnly)
99 {
100 obj.insert("dependencyOnly", true);
101 }
102 if(component->m_important)
103 {
104 obj.insert("important", true);
105 }
106 if(component->m_disabled)
107 {
108 obj.insert("disabled", true);
109 }
110
111 // cached
112 if(!component->m_cachedVersion.isEmpty())
113 {
114 obj.insert("cachedVersion", component->m_cachedVersion);
115 }
116 if(!component->m_cachedName.isEmpty())
117 {
118 obj.insert("cachedName", component->m_cachedName);
119 }
120 Meta::serializeRequires(obj, &component->m_cachedRequires, "cachedRequires");
121 Meta::serializeRequires(obj, &component->m_cachedConflicts, "cachedConflicts");
122 if(component->m_cachedVolatile)
123 {
124 obj.insert("cachedVolatile", true);
125 }
126 return obj;
127}
128
129static ComponentPtr componentFromJsonV1(PackProfile * parent, const QString & componentJsonPattern, const QJsonObject &obj)
130{

Callers 1

savePackProfileFunction · 0.85

Calls 3

serializeRequiresFunction · 0.85
insertMethod · 0.80
isEmptyMethod · 0.80

Tested by

no test coverage detected