MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / SetJson

Method SetJson

src/Timeline.cpp:1245–1262  ·  view source on GitHub ↗

Load JSON string into this object

Source from the content-addressed store, hash-verified

1243
1244// Load JSON string into this object
1245void Timeline::SetJson(const std::string value) {
1246
1247 // Get lock (prevent getting frames while this happens)
1248 const std::lock_guard<std::recursive_mutex> lock(getFrameMutex);
1249
1250 // Parse JSON string into JSON objects
1251 try
1252 {
1253 const Json::Value root = openshot::stringToJson(value);
1254 // Set all values that match
1255 SetJsonValue(root);
1256 }
1257 catch (const std::exception& e)
1258 {
1259 // Error parsing JSON (or missing keys)
1260 throw InvalidJSON("JSON is invalid (missing keys or invalid data types)");
1261 }
1262}
1263
1264// Load Json::Value into this object
1265void Timeline::SetJsonValue(const Json::Value root) {

Callers

nothing calls this directly

Calls 1

InvalidJSONClass · 0.85

Tested by

no test coverage detected