Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 4925:8785d8442f90
skip json comments when loading config
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 24 Feb 2022 17:36:20 +0100 |
parents | 43e613a7756b |
children | 47d734fa30f6 1b76853e1797 |
comparison
equal
deleted
inserted
replaced
4924:b5994fb2a4d4 | 4925:8785d8442f90 |
---|---|
509 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); | 509 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); |
510 } | 510 } |
511 } | 511 } |
512 | 512 |
513 | 513 |
514 void OrthancString::ToJsonWithoutComments(Json::Value& target) const | |
515 { | |
516 if (str_ == NULL) | |
517 { | |
518 LogError("Cannot convert an empty memory buffer to JSON"); | |
519 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); | |
520 } | |
521 | |
522 if (!ReadJsonWithoutComments(target, str_)) | |
523 { | |
524 LogError("Cannot convert some memory buffer to JSON"); | |
525 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); | |
526 } | |
527 } | |
528 | |
529 | |
514 void MemoryBuffer::DicomToJson(Json::Value& target, | 530 void MemoryBuffer::DicomToJson(Json::Value& target, |
515 OrthancPluginDicomToJsonFormat format, | 531 OrthancPluginDicomToJsonFormat format, |
516 OrthancPluginDicomToJsonFlags flags, | 532 OrthancPluginDicomToJsonFlags flags, |
517 uint32_t maxStringLength) | 533 uint32_t maxStringLength) |
518 { | 534 { |
643 { | 659 { |
644 LogError("Cannot access the Orthanc configuration"); | 660 LogError("Cannot access the Orthanc configuration"); |
645 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); | 661 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); |
646 } | 662 } |
647 | 663 |
648 str.ToJson(configuration_); | 664 str.ToJsonWithoutComments(configuration_); |
649 | 665 |
650 if (configuration_.type() != Json::objectValue) | 666 if (configuration_.type() != Json::objectValue) |
651 { | 667 { |
652 LogError("Unable to read the Orthanc configuration"); | 668 LogError("Unable to read the Orthanc configuration"); |
653 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); | 669 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); |