# HG changeset patch # User Sebastien Jodogne # Date 1495051534 -7200 # Node ID fd5869e3ed5e08306514ad27e7c6061c7216902d # Parent b85f68a98474814dbf444a078ca1bb5154d083cf new constructors in FullOrthancDataset diff -r b85f68a98474 -r fd5869e3ed5e Plugins/Samples/Common/FullOrthancDataset.cpp --- a/Plugins/Samples/Common/FullOrthancDataset.cpp Wed Apr 12 18:01:04 2017 +0200 +++ b/Plugins/Samples/Common/FullOrthancDataset.cpp Wed May 17 22:05:34 2017 +0200 @@ -166,6 +166,14 @@ } + FullOrthancDataset::FullOrthancDataset(const void* content, + size_t size) + { + IOrthancConnection::ParseJson(root_, content, size); + CheckRoot(); + } + + bool FullOrthancDataset::GetStringValue(std::string& result, const DicomPath& path) const { diff -r b85f68a98474 -r fd5869e3ed5e Plugins/Samples/Common/FullOrthancDataset.h --- a/Plugins/Samples/Common/FullOrthancDataset.h Wed Apr 12 18:01:04 2017 +0200 +++ b/Plugins/Samples/Common/FullOrthancDataset.h Wed May 17 22:05:34 2017 +0200 @@ -55,6 +55,9 @@ FullOrthancDataset(const std::string& content); + FullOrthancDataset(const void* content, + size_t size); + virtual bool GetStringValue(std::string& result, const DicomPath& path) const; diff -r b85f68a98474 -r fd5869e3ed5e Plugins/Samples/Common/IOrthancConnection.cpp --- a/Plugins/Samples/Common/IOrthancConnection.cpp Wed Apr 12 18:01:04 2017 +0200 +++ b/Plugins/Samples/Common/IOrthancConnection.cpp Wed May 17 22:05:34 2017 +0200 @@ -51,6 +51,20 @@ } + void IOrthancConnection::ParseJson(Json::Value& result, + const void* content, + size_t size) + { + Json::Reader reader; + + if (!reader.parse(reinterpret_cast(content), + reinterpret_cast(content) + size, result)) + { + ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); + } + } + + void IOrthancConnection::RestApiGet(Json::Value& result, IOrthancConnection& orthanc, const std::string& uri) diff -r b85f68a98474 -r fd5869e3ed5e Plugins/Samples/Common/IOrthancConnection.h --- a/Plugins/Samples/Common/IOrthancConnection.h Wed Apr 12 18:01:04 2017 +0200 +++ b/Plugins/Samples/Common/IOrthancConnection.h Wed May 17 22:05:34 2017 +0200 @@ -64,6 +64,10 @@ static void ParseJson(Json::Value& result, const std::string& content); + static void ParseJson(Json::Value& result, + const void* content, + size_t size); + static void RestApiGet(Json::Value& result, IOrthancConnection& orthanc, const std::string& uri);