changeset 3421:decbede6e3ad

OrthancPlugins::OrthancConfiguration(bool)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jun 2019 18:04:53 +0200
parents 0a0e7eca95ae
children 8b4169a88039 4c45e018bd3d
files Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Plugins/Samples/Common/OrthancPluginCppWrapper.h
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Wed Jun 12 12:11:58 2019 +0200
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Wed Jun 12 18:04:53 2019 +0200
@@ -494,7 +494,7 @@
   }
 
 
-  OrthancConfiguration::OrthancConfiguration()
+  void OrthancConfiguration::LoadConfiguration()
   {
     OrthancString str;
     str.Assign(OrthancPluginGetConfiguration(GetGlobalContext()));
@@ -513,6 +513,25 @@
       ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
     }
   }
+    
+
+  OrthancConfiguration::OrthancConfiguration()
+  {
+    LoadConfiguration();
+  }
+
+
+  OrthancConfiguration::OrthancConfiguration(bool loadConfiguration)
+  {
+    if (loadConfiguration)
+    {
+      LoadConfiguration();
+    }
+    else
+    {
+      configuration_ = Json::objectValue;
+    }
+  }
 
 
   std::string OrthancConfiguration::GetPath(const std::string& key) const
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Wed Jun 12 12:11:58 2019 +0200
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Wed Jun 12 18:04:53 2019 +0200
@@ -292,9 +292,13 @@
 
     std::string GetPath(const std::string& key) const;
 
+    void LoadConfiguration();
+    
   public:
     OrthancConfiguration();
 
+    OrthancConfiguration(bool load);
+
     const Json::Value& GetJson() const
     {
       return configuration_;