Mercurial > hg > orthanc-wsi
changeset 212:f1ea48f92d66
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Dec 2020 09:19:43 +0100 |
parents | 7459819f3176 |
children | 2a4e1f7de5ab |
files | Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Resources/Orthanc/LinuxStandardBaseToolchain.cmake Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Resources/Orthanc/Stone/DicomDatasetReader.cpp Resources/Orthanc/Stone/DicomDatasetReader.h Resources/Orthanc/Stone/DicomPath.cpp Resources/Orthanc/Stone/DicomPath.h Resources/Orthanc/Stone/FullOrthancDataset.cpp Resources/Orthanc/Stone/FullOrthancDataset.h Resources/Orthanc/Stone/IDicomDataset.h Resources/Orthanc/Stone/IOrthancConnection.cpp Resources/Orthanc/Stone/IOrthancConnection.h Resources/Orthanc/Stone/OrthancHttpConnection.cpp Resources/Orthanc/Stone/OrthancHttpConnection.h |
diffstat | 15 files changed, 247 insertions(+), 120 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Tue Dec 22 09:19:43 2020 +0100 @@ -112,6 +112,16 @@ set(ORTHANC_FRAMEWORK_MD5 "3c171217f930abe80246997bdbcaf7cc") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.2") set(ORTHANC_FRAMEWORK_MD5 "328f94dcbd78c169655a13f7ad58a2c2") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.3") + set(ORTHANC_FRAMEWORK_MD5 "3f1ba9502ec7c5449971d3b56087bcde") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.4") + set(ORTHANC_FRAMEWORK_MD5 "19fcb7c21876af86546baa048a22c6c0") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.0") + set(ORTHANC_FRAMEWORK_MD5 "f8ec7554ef5d23ea4ce474b1e8214de9") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.1") + set(ORTHANC_FRAMEWORK_MD5 "db094f96399cbe8b9bbdbce34884c220") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.2") + set(ORTHANC_FRAMEWORK_MD5 "8bfa10e66c9931e74111be0bfb1f4548") # Below this point are development snapshots that were used to # release some plugin, before an official release of the Orthanc @@ -123,6 +133,12 @@ elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "ae0e3fd609df") # DICOMweb 1.1 (framework pre-1.6.0) set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "82652c5fc04f") + # Stone Web viewer 1.0 (framework pre-1.8.1) + set(ORTHANC_FRAMEWORK_MD5 "d77331d68917e66a3f4f9b807bbdab7f") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "4a3ba4bf4ba7") + # PostgreSQL 3.3 (framework pre-1.8.2) + set(ORTHANC_FRAMEWORK_MD5 "2d82bddf06f9cfe82095495cb3b8abde") endif() endif() endif() @@ -518,6 +534,16 @@ include_directories(${DCMTK_INCLUDE_DIRS}) link_libraries(${DCMTK_LIBRARIES}) endif() + + # Optional component - OpenSSL + if (ENABLE_SSL) + include(FindOpenSSL) + if (NOT ${OPENSSL_FOUND}) + message(FATAL_ERROR "Unable to find OpenSSL") + endif() + include_directories(${OPENSSL_INCLUDE_DIR}) + link_libraries(${OPENSSL_LIBRARIES}) + endif() endif() # Look for Orthanc framework shared library
--- a/Resources/Orthanc/LinuxStandardBaseToolchain.cmake Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/LinuxStandardBaseToolchain.cmake Tue Dec 22 09:19:43 2020 +0100 @@ -21,11 +21,11 @@ # # Full build, as used on the BuildBot CIS: # -# $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON -DBOOST_LOCALE_BACKEND=icu -DENABLE_PKCS11=ON -G Ninja +# $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake ../OrthancServer/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON -DBOOST_LOCALE_BACKEND=icu -DENABLE_PKCS11=ON -G Ninja # # Or, more lightweight version (without libp11 and ICU): # -# $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -G Ninja +# $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake ../OrthancServer/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -G Ninja # INCLUDE(CMakeForceCompiler)
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Tue Dec 22 09:19:43 2020 +0100 @@ -24,9 +24,33 @@ #include <boost/algorithm/string/predicate.hpp> #include <boost/move/unique_ptr.hpp> #include <boost/thread.hpp> + + #include <json/reader.h> +#include <json/version.h> #include <json/writer.h> +#if !defined(JSONCPP_VERSION_MAJOR) || !defined(JSONCPP_VERSION_MINOR) +# error Cannot access the version of JsonCpp +#endif + + +/** + * We use deprecated "Json::Reader", "Json::StyledWriter" and + * "Json::FastWriter" if JsonCpp < 1.7.0. This choice is rather + * arbitrary, but if Json >= 1.9.0, gcc generates explicit deprecation + * warnings (clang was warning in earlier versions). For reference, + * these classes seem to have been deprecated since JsonCpp 1.4.0 (on + * February 2015) by the following changeset: + * https://github.com/open-source-parsers/jsoncpp/commit/8df98f6112890d6272734975dd6d70cf8999bb22 + **/ +#if (JSONCPP_VERSION_MAJOR >= 2 || \ + (JSONCPP_VERSION_MAJOR == 1 && JSONCPP_VERSION_MINOR >= 8)) +# define JSONCPP_USE_DEPRECATED 0 +#else +# define JSONCPP_USE_DEPRECATED 1 +#endif + #if !ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 2, 0) static const OrthancPluginErrorCode OrthancPluginErrorCode_NullPointer = OrthancPluginErrorCode_Plugin; @@ -202,10 +226,7 @@ ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); } - const char* tmp = reinterpret_cast<const char*>(buffer_.data); - - Json::Reader reader; - if (!reader.parse(tmp, tmp + buffer_.size, target)) + if (!ReadJson(target, buffer_.data, buffer_.size)) { LogError("Cannot convert some memory buffer to JSON"); ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); @@ -292,12 +313,75 @@ } + bool ReadJson(Json::Value& target, + const std::string& source) + { + return ReadJson(target, source.empty() ? NULL : source.c_str(), source.size()); + } + + + bool ReadJson(Json::Value& target, + const void* buffer, + size_t size) + { +#if JSONCPP_USE_DEPRECATED == 1 + Json::Reader reader; + return reader.parse(reinterpret_cast<const char*>(buffer), + reinterpret_cast<const char*>(buffer) + size, target); +#else + Json::CharReaderBuilder builder; + const std::unique_ptr<Json::CharReader> reader(builder.newCharReader()); + assert(reader.get() != NULL); + JSONCPP_STRING err; + if (reader->parse(reinterpret_cast<const char*>(buffer), + reinterpret_cast<const char*>(buffer) + size, &target, &err)) + { + return true; + } + else + { + LogError("Cannot parse JSON: " + err); + return false; + } +#endif + } + + + void WriteFastJson(std::string& target, + const Json::Value& source) + { +#if JSONCPP_USE_DEPRECATED == 1 + Json::FastWriter writer; + target = writer.write(source); +#else + Json::StreamWriterBuilder builder; + builder.settings_["indentation"] = ""; + target = Json::writeString(builder, source); +#endif + } + + + void WriteStyledJson(std::string& target, + const Json::Value& source) + { +#if JSONCPP_USE_DEPRECATED == 1 + Json::StyledWriter writer; + target = writer.write(source); +#else + Json::StreamWriterBuilder builder; + builder.settings_["indentation"] = " "; + target = Json::writeString(builder, source); +#endif + } + + bool MemoryBuffer::RestApiPost(const std::string& uri, const Json::Value& body, bool applyPlugins) { - Json::FastWriter writer; - return RestApiPost(uri, writer.write(body), applyPlugins); + std::string s; + WriteFastJson(s, body); + return RestApiPost(uri, s, applyPlugins); } @@ -305,8 +389,9 @@ const Json::Value& body, bool applyPlugins) { - Json::FastWriter writer; - return RestApiPut(uri, writer.write(body), applyPlugins); + std::string s; + WriteFastJson(s, body); + return RestApiPut(uri, s, applyPlugins); } @@ -315,8 +400,8 @@ { Clear(); - Json::FastWriter writer; - std::string s = writer.write(tags); + std::string s; + WriteFastJson(s, tags); Check(OrthancPluginCreateDicom(GetGlobalContext(), &buffer_, s.c_str(), NULL, flags)); } @@ -327,8 +412,8 @@ { Clear(); - Json::FastWriter writer; - std::string s = writer.write(tags); + std::string s; + WriteFastJson(s, tags); Check(OrthancPluginCreateDicom(GetGlobalContext(), &buffer_, s.c_str(), pixelData.GetObject(), flags)); } @@ -390,8 +475,7 @@ ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); } - Json::Reader reader; - if (!reader.parse(str_, target)) + if (!ReadJson(target, str_)) { LogError("Cannot convert some memory buffer to JSON"); ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); @@ -1190,19 +1274,16 @@ #endif /* HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1 */ void AnswerJson(const Json::Value& value, - OrthancPluginRestOutput* output - ) + OrthancPluginRestOutput* output) { - Json::StyledWriter writer; - std::string bodyString = writer.write(value); - + std::string bodyString; + WriteStyledJson(bodyString, value); OrthancPluginAnswerBuffer(GetGlobalContext(), output, bodyString.c_str(), bodyString.size(), "application/json"); } void AnswerString(const std::string& answer, const char* mimeType, - OrthancPluginRestOutput* output - ) + OrthancPluginRestOutput* output) { OrthancPluginAnswerBuffer(GetGlobalContext(), output, answer.c_str(), answer.size(), mimeType); } @@ -1324,8 +1405,9 @@ const Json::Value& body, bool applyPlugins) { - Json::FastWriter writer; - return RestApiPost(result, uri, writer.write(body), applyPlugins); + std::string s; + WriteFastJson(s, body); + return RestApiPost(result, uri, s, applyPlugins); } @@ -1357,8 +1439,9 @@ const Json::Value& body, bool applyPlugins) { - Json::FastWriter writer; - return RestApiPut(result, uri, writer.write(body), applyPlugins); + std::string s; + WriteFastJson(s, body); + return RestApiPut(result, uri, s, applyPlugins); } @@ -2020,8 +2103,7 @@ } else { - Json::FastWriter writer; - content_ = writer.write(content); + WriteFastJson(content_, content); } } @@ -2041,8 +2123,7 @@ } else { - Json::FastWriter writer; - serialized_ = writer.write(serialized); + WriteFastJson(serialized_, serialized); hasSerialized_ = true; } } @@ -2902,8 +2983,7 @@ std::string body; Execute(answerHeaders, body); - Json::Reader reader; - if (!reader.parse(body, answerBody)) + if (!ReadJson(answerBody, body)) { LogError("Cannot convert HTTP answer body to JSON"); ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Tue Dec 22 09:19:43 2020 +0100 @@ -476,6 +476,19 @@ #endif + bool ReadJson(Json::Value& target, + const std::string& source); + + bool ReadJson(Json::Value& target, + const void* buffer, + size_t size); + + void WriteFastJson(std::string& target, + const Json::Value& source); + + void WriteStyledJson(std::string& target, + const Json::Value& source); + bool RestApiGet(Json::Value& result, const std::string& uri, bool applyPlugins); @@ -779,7 +792,7 @@ void UpdateProgress(float progress); public: - OrthancJob(const std::string& jobType); + explicit OrthancJob(const std::string& jobType); virtual ~OrthancJob() {
--- a/Resources/Orthanc/Stone/DicomDatasetReader.cpp Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/DicomDatasetReader.cpp Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/
--- a/Resources/Orthanc/Stone/DicomDatasetReader.h Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/DicomDatasetReader.h Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/ @@ -34,7 +35,7 @@ const IDicomDataset& dataset_; public: - DicomDatasetReader(const IDicomDataset& dataset); + explicit DicomDatasetReader(const IDicomDataset& dataset); const IDicomDataset& GetDataset() const {
--- a/Resources/Orthanc/Stone/DicomPath.cpp Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/DicomPath.cpp Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/
--- a/Resources/Orthanc/Stone/DicomPath.h Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/DicomPath.h Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/ @@ -41,7 +42,7 @@ Prefix& GetPrefixItem(size_t depth); public: - DicomPath(const Orthanc::DicomTag& finalTag) : + explicit DicomPath(const Orthanc::DicomTag& finalTag) : finalTag_(finalTag) { }
--- a/Resources/Orthanc/Stone/FullOrthancDataset.cpp Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/FullOrthancDataset.cpp Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/
--- a/Resources/Orthanc/Stone/FullOrthancDataset.h Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/FullOrthancDataset.h Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/ @@ -24,6 +25,8 @@ #include "IOrthancConnection.h" #include "IDicomDataset.h" +#include <Compatibility.h> // For ORTHANC_OVERRIDE + #include <json/value.h> namespace OrthancStone @@ -41,18 +44,18 @@ FullOrthancDataset(IOrthancConnection& orthanc, const std::string& uri); - FullOrthancDataset(const std::string& content); + explicit FullOrthancDataset(const std::string& content); FullOrthancDataset(const void* content, size_t size); - FullOrthancDataset(const Json::Value& root); + explicit FullOrthancDataset(const Json::Value& root); virtual bool GetStringValue(std::string& result, - const DicomPath& path) const; + const DicomPath& path) const ORTHANC_OVERRIDE; virtual bool GetSequenceSize(size_t& size, - const DicomPath& path) const; + const DicomPath& path) const ORTHANC_OVERRIDE; FullOrthancDataset* Clone() const {
--- a/Resources/Orthanc/Stone/IDicomDataset.h Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/IDicomDataset.h Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/
--- a/Resources/Orthanc/Stone/IOrthancConnection.cpp Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/IOrthancConnection.cpp Tue Dec 22 09:19:43 2020 +0100 @@ -5,34 +5,32 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/ #include "IOrthancConnection.h" #include <OrthancException.h> - -#include <json/reader.h> +#include <Toolbox.h> namespace OrthancStone { void IOrthancConnection::ParseJson(Json::Value& result, const std::string& content) { - Json::Reader reader; - - if (!reader.parse(content, result)) + if (!Orthanc::Toolbox::ReadJson(result, content)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } @@ -43,10 +41,7 @@ const void* content, size_t size) { - Json::Reader reader; - - if (!reader.parse(reinterpret_cast<const char*>(content), - reinterpret_cast<const char*>(content) + size, result)) + if (!Orthanc::Toolbox::ReadJson(result, content, size)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); }
--- a/Resources/Orthanc/Stone/IOrthancConnection.h Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/IOrthancConnection.h Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/
--- a/Resources/Orthanc/Stone/OrthancHttpConnection.cpp Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/OrthancHttpConnection.cpp Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/
--- a/Resources/Orthanc/Stone/OrthancHttpConnection.h Mon Nov 09 15:09:05 2020 +0100 +++ b/Resources/Orthanc/Stone/OrthancHttpConnection.h Tue Dec 22 09:19:43 2020 +0100 @@ -5,17 +5,18 @@ * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License + * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. **/ @@ -23,6 +24,7 @@ #include "IOrthancConnection.h" +#include <Compatibility.h> // For ORTHANC_OVERRIDE #include <HttpClient.h> #include <boost/thread/mutex.hpp> @@ -42,19 +44,19 @@ public: OrthancHttpConnection(); - OrthancHttpConnection(const Orthanc::WebServiceParameters& parameters); + explicit OrthancHttpConnection(const Orthanc::WebServiceParameters& parameters); virtual void RestApiGet(std::string& result, - const std::string& uri); + const std::string& uri) ORTHANC_OVERRIDE; virtual void RestApiPost(std::string& result, const std::string& uri, - const std::string& body); + const std::string& body) ORTHANC_OVERRIDE; virtual void RestApiPut(std::string& result, const std::string& uri, - const std::string& body); + const std::string& body) ORTHANC_OVERRIDE; - virtual void RestApiDelete(const std::string& uri); + virtual void RestApiDelete(const std::string& uri) ORTHANC_OVERRIDE; }; }