MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / componentToJsonV1

Function componentToJsonV1

launcher/minecraft/PackProfile.cpp:94–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

savePackProfileFunction · 0.85

Calls 3

serializeRequiresFunction · 0.85
insertMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected