changeset 2266:a344e47e9c9a

OrthancConfiguration::LookupSetOfStrings
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 14 Feb 2017 16:03:18 +0100
parents e46b0ee6c19d
children f915aff7a866
files Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Plugins/Samples/Common/OrthancPluginCppWrapper.h
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Tue Feb 14 15:59:19 2017 +0100
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Tue Feb 14 16:03:18 2017 +0100
@@ -659,6 +659,31 @@
     ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
   }
 
+
+  bool OrthancConfiguration::LookupSetOfStrings(std::set<std::string>& target,
+                                                const std::string& key,
+                                                bool allowSingleString) const
+  {
+    std::list<std::string> lst;
+
+    if (LookupListOfStrings(lst, key, allowSingleString))
+    {
+      target.clear();
+
+      for (std::list<std::string>::const_iterator
+             it = lst.begin(); it != lst.end(); ++it)
+      {
+        target.insert(*it);
+      }
+
+      return true;
+    }
+    else
+    {
+      return false;
+    }
+  }
+
   
   std::string OrthancConfiguration::GetStringValue(const std::string& key,
                                                    const std::string& defaultValue) const
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Tue Feb 14 15:59:19 2017 +0100
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Tue Feb 14 16:03:18 2017 +0100
@@ -40,6 +40,7 @@
 #include <boost/lexical_cast.hpp>
 #include <json/value.h>
 #include <list>
+#include <set>
 
 
 #if (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER >= 2 ||   \
@@ -253,6 +254,10 @@
                              const std::string& key,
                              bool allowSingleString) const;
 
+    bool LookupSetOfStrings(std::set<std::string>& target,
+                            const std::string& key,
+                            bool allowSingleString) const;
+
     std::string GetStringValue(const std::string& key,
                                const std::string& defaultValue) const;