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

Function requireDocument

launcher/Json.cpp:72–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 return memcmp(data.constData(), &tag, sizeof(QJsonDocument::BinaryFormatTag)) == 0;
71}
72QJsonDocument requireDocument(const QByteArray &data, const QString &what)
73{
74 if (isBinaryJson(data))
75 {
76 // FIXME: Is this needed?
77 throw JsonException(what + ": Invalid JSON. Binary JSON unsupported");
78 }
79 else
80 {
81 QJsonParseError error;
82 QJsonDocument doc = QJsonDocument::fromJson(data, &error);
83 if (error.error != QJsonParseError::NoError)
84 {
85 throw JsonException(what + ": Error parsing JSON: " + error.errorString());
86 }
87 return doc;
88 }
89}
90QJsonDocument requireDocument(const QString &filename, const QString &what)
91{
92 return requireDocument(FS::read(filename), what);

Callers 12

parseMethod · 0.85
runMethod · 0.85
loadManifestMethod · 0.85
netJobFinishedMethod · 0.85
parseManifestMethod · 0.85
readIndexFunction · 0.85
fromManifestContentsMethod · 0.85
fromManifestFileMethod · 0.85
readThemeJsonFunction · 0.85
reprocessCommitsFunction · 0.85
validateMethod · 0.85
loadLocalFileMethod · 0.85

Calls 4

isBinaryJsonFunction · 0.85
JsonExceptionClass · 0.85
fromJsonFunction · 0.85
readFunction · 0.85

Tested by

no test coverage detected