Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Oracle/HttpCommand.cpp @ 1738:05dc12df49db
remove calls to deprecated classes of JsonCpp
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Dec 2020 09:18:33 +0100 |
parents | 59f95b9ea858 |
children | 9ac2a65d4172 |
comparison
equal
deleted
inserted
replaced
1737:ef2f56c0311c | 1738:05dc12df49db |
---|---|
22 | 22 |
23 #include "HttpCommand.h" | 23 #include "HttpCommand.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 HttpCommand::SuccessMessage::ParseJsonBody(Json::Value& target) const | 32 void HttpCommand::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 |
53 } | 46 } |
54 | 47 |
55 | 48 |
56 void HttpCommand::SetBody(const Json::Value& json) | 49 void HttpCommand::SetBody(const Json::Value& json) |
57 { | 50 { |
58 Json::FastWriter writer; | 51 Orthanc::Toolbox::WriteFastJson(body_, json); |
59 body_ = writer.write(json); | |
60 } | 52 } |
61 | 53 |
62 | 54 |
63 const std::string& HttpCommand::GetBody() const | 55 const std::string& HttpCommand::GetBody() const |
64 { | 56 { |