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

Function requireDocument

launcher/Json.cpp:71–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 15

getLibraryStringFunction · 0.85
parseMethod · 0.85
runMethod · 0.85
parseDirectoryFunction · 0.85
loadManifestMethod · 0.85
netJobFinishedMethod · 0.85
parseApiResponseMethod · 0.85
parseManifestMethod · 0.85
readIndexFunction · 0.85
parseReleasePageMethod · 0.85
processURLsMethod · 0.85
updateStateMethod · 0.85

Calls 4

isBinaryJsonFunction · 0.85
JsonExceptionClass · 0.85
readFunction · 0.85
errorStringMethod · 0.80

Tested by

no test coverage detected