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

Method libraryToJson

launcher/minecraft/MojangVersionFormat.cpp:381–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381QJsonObject MojangVersionFormat::libraryToJson(Library *library)
382{
383 QJsonObject libRoot;
384 libRoot.insert("name", library->m_name.serialize());
385 if (!library->m_repositoryURL.isEmpty())
386 {
387 libRoot.insert("url", library->m_repositoryURL);
388 }
389 if (library->isNative())
390 {
391 QJsonObject nativeList;
392 auto iter = library->m_nativeClassifiers.begin();
393 while (iter != library->m_nativeClassifiers.end())
394 {
395 nativeList.insert(iter.key(), iter.value());
396 iter++;
397 }
398 libRoot.insert("natives", nativeList);
399 if (library->m_extractExcludes.size())
400 {
401 QJsonArray excludes;
402 QJsonObject extract;
403 for (auto exclude : library->m_extractExcludes)
404 {
405 excludes.append(exclude);
406 }
407 extract.insert("exclude", excludes);
408 libRoot.insert("extract", extract);
409 }
410 }
411 if (library->m_rules.size())
412 {
413 QJsonArray allRules;
414 for (auto &rule : library->m_rules)
415 {
416 QJsonObject ruleObj = rule->toJson();
417 allRules.append(ruleObj);
418 }
419 libRoot.insert("rules", allRules);
420 }
421 if(library->m_mojangDownloads)
422 {
423 auto downloadsObj = libDownloadInfoToJson(library->m_mojangDownloads);
424 libRoot.insert("downloads", downloadsObj);
425 }
426 return libRoot;
427}

Callers

nothing calls this directly

Calls 10

libDownloadInfoToJsonFunction · 0.85
insertMethod · 0.80
isEmptyMethod · 0.80
isNativeMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
appendMethod · 0.80
toJsonMethod · 0.80
serializeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected