comparison Plugin/Plugin.cpp @ 22:0bbb4e12b1f0

fix deprecated call
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Mar 2024 15:59:05 +0100
parents 1c407ba1d311
children
comparison
equal deleted inserted replaced
21:4ff1471ebe8b 22:0bbb4e12b1f0
45 45
46 #include <json/reader.h> 46 #include <json/reader.h>
47 47
48 #include "Mutex.h" 48 #include "Mutex.h"
49 49
50 #define ORTHANC_PLUGIN_NAME "java"
51
52
50 OrthancPluginContext* context_ = NULL; 53 OrthancPluginContext* context_ = NULL;
51 54
52 static std::unique_ptr<JavaVirtualMachine> java_; 55 static std::unique_ptr<JavaVirtualMachine> java_;
53 56
54 57
412 { 415 {
413 HasOption(json, key, Json::stringValue, true); 416 HasOption(json, key, Json::stringValue, true);
414 assert(json.isMember(key) && 417 assert(json.isMember(key) &&
415 json[key].type() == Json::stringValue); 418 json[key].type() == Json::stringValue);
416 return json[key].asString(); 419 return json[key].asString();
420 }
421
422
423 static void SetPluginDescription(const std::string& description)
424 {
425 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
426 OrthancPluginSetDescription2(context_, ORTHANC_PLUGIN_NAME, description.c_str());
427 #else
428 _OrthancPluginSetPluginProperty params;
429 params.plugin = ORTHANC_PLUGIN_NAME;
430 params.property = _OrthancPluginProperty_Description;
431 params.value = description.c_str();
432
433 context_->InvokeService(context_, _OrthancPluginService_SetPluginProperty, &params);
434 #endif
417 } 435 }
418 436
419 437
420 extern "C" 438 extern "C"
421 { 439 {
434 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); 452 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
435 OrthancPluginLogError(context, info); 453 OrthancPluginLogError(context, info);
436 return -1; 454 return -1;
437 } 455 }
438 456
439 OrthancPluginSetDescription(context, "Java plugin for Orthanc"); 457 SetPluginDescription("Java plugin for Orthanc");
440 458
441 try 459 try
442 { 460 {
443 { 461 {
444 // Sanity check to ensure that the compiler has created different callback functions 462 // Sanity check to ensure that the compiler has created different callback functions
544 } 562 }
545 563
546 564
547 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() 565 ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
548 { 566 {
549 return "java"; 567 return ORTHANC_PLUGIN_NAME;
550 } 568 }
551 569
552 570
553 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() 571 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
554 { 572 {