Mercurial > hg > orthanc
changeset 6242:67f9625abb90
added OrthancPlugins::MemoryBuffer::AssignJson()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 11 Jul 2025 13:58:27 +0200 |
parents | 54c8e2398c94 |
children | ec3044e6d41f |
files | OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Fri Jul 11 10:00:55 2025 +0200 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Fri Jul 11 13:58:27 2025 +0200 @@ -266,6 +266,16 @@ #endif +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0) + void MemoryBuffer::AssignJson(const Json::Value& value) + { + std::string s; + WriteFastJson(s, value); + Assign(s); + } +#endif + + void MemoryBuffer::Assign(OrthancPluginMemoryBuffer& other) { Clear();
--- a/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h Fri Jul 11 10:00:55 2025 +0200 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h Fri Jul 11 13:58:27 2025 +0200 @@ -231,6 +231,10 @@ void Assign(const std::string& s); #endif +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 7, 0) + void AssignJson(const Json::Value& value); +#endif + // This transfers ownership from "other" to "this" void Assign(OrthancPluginMemoryBuffer& other);