Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Oracle/OrthancRestApiCommand.cpp @ 1737:ef2f56c0311c
remove calls to deprecated classes of JsonCpp
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Dec 2020 09:16:42 +0100 |
parents | 59f95b9ea858 |
children | 9ac2a65d4172 |
comparison
equal
deleted
inserted
replaced
1736:77038e2bd074 | 1737:ef2f56c0311c |
---|---|
22 | 22 |
23 #include "OrthancRestApiCommand.h" | 23 #include "OrthancRestApiCommand.h" |
24 | 24 |
25 #include <Logging.h> | 25 #include <Logging.h> |
26 #include <OrthancException.h> | 26 #include <OrthancException.h> |
27 #include <Toolbox.h> | |
27 | 28 |
28 #ifdef _MSC_VER | |
29 // 'Json::Reader': Use CharReader and CharReaderBuilder instead | |
30 #pragma warning(disable:4996) | |
31 #endif | |
32 | |
33 #include <json/reader.h> | |
34 #include <json/writer.h> | |
35 | 29 |
36 namespace OrthancStone | 30 namespace OrthancStone |
37 { | 31 { |
38 void OrthancRestApiCommand::SuccessMessage::ParseJsonBody(Json::Value& target) const | 32 void OrthancRestApiCommand::SuccessMessage::ParseJsonBody(Json::Value& target) const |
39 { | 33 { |
40 Json::Reader reader; | 34 if (!Orthanc::Toolbox::ReadJson(target, answer_)) |
41 if (!reader.parse(answer_, target)) | |
42 { | 35 { |
43 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 36 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
44 } | 37 } |
45 } | 38 } |
46 | 39 |
54 } | 47 } |
55 | 48 |
56 | 49 |
57 void OrthancRestApiCommand::SetBody(const Json::Value& json) | 50 void OrthancRestApiCommand::SetBody(const Json::Value& json) |
58 { | 51 { |
59 Json::FastWriter writer; | 52 Orthanc::Toolbox::WriteFastJson(body_, json); |
60 body_ = writer.write(json); | |
61 } | 53 } |
62 | 54 |
63 | 55 |
64 const std::string& OrthancRestApiCommand::GetBody() const | 56 const std::string& OrthancRestApiCommand::GetBody() const |
65 { | 57 { |