MCPcopy Create free account
hub / github.com/baldurk/renderdoc / SaveToJSON

Function SaveToJSON

qrenderdoc/Code/QRDUtils.cpp:2281–2306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2279}
2280
2281bool SaveToJSON(QVariantMap &data, QIODevice &f, const char *magicIdentifier, uint32_t magicVersion)
2282{
2283 // marker that this data is valid
2284 if(magicIdentifier)
2285 data[QString::fromLatin1(magicIdentifier)] = magicVersion;
2286
2287 QJsonDocument doc = validateAndMakeJSON(data);
2288
2289 if(doc.isEmpty() || doc.isNull())
2290 {
2291 qCritical() << "Failed to convert data to JSON document";
2292 return false;
2293 }
2294
2295 QByteArray jsontext = doc.toJson(QJsonDocument::Indented);
2296
2297 qint64 ret = f.write(jsontext);
2298
2299 if(ret != jsontext.size())
2300 {
2301 qCritical() << "Failed to write JSON data: " << ret << " " << f.errorString();
2302 return false;
2303 }
2304
2305 return true;
2306}
2307
2308bool LoadFromJSON(QVariantMap &data, QIODevice &f, const char *magicIdentifier, uint32_t magicVersion)
2309{

Callers 7

SaveMethod · 0.85
PromptMethod · 0.85
SerializeMethod · 0.85
SaveLayoutMethod · 0.85
CreateFilterDialogMethod · 0.85
SaveMethod · 0.85
SaveSettingsMethod · 0.85

Calls 7

fromLatin1Function · 0.85
validateAndMakeJSONFunction · 0.85
errorStringMethod · 0.80
isEmptyMethod · 0.45
isNullMethod · 0.45
writeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected