Mercurial > hg > orthanc-neuro
changeset 10:8eb050609cb0
back to mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 26 Apr 2022 12:05:13 +0200 (2022-04-26) |
parents | de8c2347c362 (current diff) 2b0cbb10816a (diff) |
children | 12e36b1b84f3 |
files | CMakeLists.txt |
diffstat | 3 files changed, 35 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Mon Apr 25 18:52:26 2022 +0200 +++ b/NEWS Tue Apr 26 12:05:13 2022 +0200 @@ -1,6 +1,10 @@ Pending changes in the mainline =============================== + +Version 1.0 (2022-04-26) +======================== + => Minimum SDK version: 1.10.1 <= * Initial release
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Mon Apr 25 18:52:26 2022 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Tue Apr 26 12:05:13 2022 +0200 @@ -1546,24 +1546,18 @@ " is required)"); } - - bool CheckMinimalOrthancVersion(unsigned int major, - unsigned int minor, - unsigned int revision) + bool CheckMinimalVersion(const char* version, + unsigned int major, + unsigned int minor, + unsigned int revision) { - if (!HasGlobalContext()) - { - LogError("Bad Orthanc context in the plugin"); - return false; - } - - if (!strcmp(GetGlobalContext()->orthancVersion, "mainline")) + if (!strcmp(version, "mainline")) { // Assume compatibility with the mainline return true; } - // Parse the version of the Orthanc core + // Parse the version int aa, bb, cc; if ( #ifdef _MSC_VER @@ -1571,7 +1565,7 @@ #else sscanf #endif - (GetGlobalContext()->orthancVersion, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 || + (version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 || aa < 0 || bb < 0 || cc < 0) @@ -1595,7 +1589,6 @@ return false; } - // Check the minor version number assert(a == major); @@ -1623,6 +1616,21 @@ } + bool CheckMinimalOrthancVersion(unsigned int major, + unsigned int minor, + unsigned int revision) + { + if (!HasGlobalContext()) + { + LogError("Bad Orthanc context in the plugin"); + return false; + } + + return CheckMinimalVersion(GetGlobalContext()->orthancVersion, + major, minor, revision); + } + + #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0) const char* AutodetectMimeType(const std::string& path) {
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Mon Apr 25 18:52:26 2022 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Tue Apr 26 12:05:13 2022 +0200 @@ -303,6 +303,11 @@ return str_; } + bool IsNullOrEmpty() const + { + return str_ == NULL || str_[0] == 0; + } + void ToString(std::string& target) const; void ToJson(Json::Value& target) const; @@ -610,6 +615,10 @@ unsigned int minor, unsigned int revision); + bool CheckMinimalVersion(const char* version, + unsigned int major, + unsigned int minor, + unsigned int revision); namespace Internals {