Added Json methods to readers and readerBase classes.

This commit is contained in:
Jonathan Thomas
2013-12-07 16:52:09 -06:00
parent 109e88dddc
commit e3d41808b9
10 changed files with 312 additions and 10 deletions

View File

@@ -123,3 +123,28 @@ tr1::shared_ptr<Frame> ImageReader::GetFrame(int requested_frame) throw(ReaderCl
}
// Generate Json::JsonValue for this object
Json::Value ImageReader::JsonValue() {
// Create root json object
Json::Value root = ReaderBase::JsonValue(); // get parent properties
root["path"] = path;
// return JsonValue
return root;
}
// Load Json::JsonValue into this object
void ImageReader::Json(Json::Value root) throw(InvalidFile) {
// Set parent data
ReaderBase::Json(root);
// Set data from Json (if key is found)
if (root["path"] != Json::nullValue)
path = root["path"].asString();
// Open path, and re-init everything
Close();
Open();
}