comparison OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4394:f7104e9d044c

functions to read/write JSON in OrthancPluginCppWrapper.h
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Dec 2020 08:11:37 +0100
parents 3af1d763763a
children d9473bd5ed43
comparison
equal deleted inserted replaced
4393:e8e95b80194f 4394:f7104e9d044c
2672 { 2672 {
2673 std::string s; 2673 std::string s;
2674 2674
2675 if (service == _OrthancPluginService_GetInstanceJson) 2675 if (service == _OrthancPluginService_GetInstanceJson)
2676 { 2676 {
2677 Toolbox::WriteJson(s, instance.GetJson(), false /* styled writer */); 2677 Toolbox::WriteStyledJson(s, instance.GetJson());
2678 } 2678 }
2679 else 2679 else
2680 { 2680 {
2681 Json::Value simplified; 2681 Json::Value simplified;
2682 Toolbox::SimplifyDicomAsJson(simplified, instance.GetJson(), DicomToJsonFormat_Human); 2682 Toolbox::SimplifyDicomAsJson(simplified, instance.GetJson(), DicomToJsonFormat_Human);
2683 Toolbox::WriteJson(s, simplified, false /* styled writer */); 2683 Toolbox::WriteStyledJson(s, simplified);
2684 } 2684 }
2685 2685
2686 *p.resultStringToFree = CopyString(s); 2686 *p.resultStringToFree = CopyString(s);
2687 return; 2687 return;
2688 } 2688 }
2880 instance.GetParsedDicomFile().DatasetToJson( 2880 instance.GetParsedDicomFile().DatasetToJson(
2881 json, Plugins::Convert(p.format), 2881 json, Plugins::Convert(p.format),
2882 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength); 2882 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength);
2883 2883
2884 std::string s; 2884 std::string s;
2885 Toolbox::WriteJson(s, json, true /* fast */); 2885 Toolbox::WriteFastJson(s, json);
2886 *p.targetStringToFree = CopyString(s); 2886 *p.targetStringToFree = CopyString(s);
2887 return; 2887 return;
2888 } 2888 }
2889 2889
2890 case _OrthancPluginService_GetInstanceDicomWebJson: 2890 case _OrthancPluginService_GetInstanceDicomWebJson:
3378 Json::Value json; 3378 Json::Value json;
3379 dicom->DatasetToJson(json, Plugins::Convert(p.format), 3379 dicom->DatasetToJson(json, Plugins::Convert(p.format),
3380 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength); 3380 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength);
3381 3381
3382 std::string s; 3382 std::string s;
3383 Toolbox::WriteJson(s, json, true /* fast */); 3383 Toolbox::WriteFastJson(s, json);
3384 *p.result = CopyString(s); 3384 *p.result = CopyString(s);
3385 } 3385 }
3386 3386
3387 3387
3388 void OrthancPlugins::ApplyCreateDicom(_OrthancPluginService service, 3388 void OrthancPlugins::ApplyCreateDicom(_OrthancPluginService service,