diff OrthancFramework/Sources/WebServiceParameters.cpp @ 4834:bec432ee1094

download of numpy arrays from the REST API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Nov 2021 19:03:32 +0100
parents 7053502fbf97
children 43e613a7756b
line wrap: on
line diff
--- a/OrthancFramework/Sources/WebServiceParameters.cpp	Thu Nov 25 19:05:41 2021 +0100
+++ b/OrthancFramework/Sources/WebServiceParameters.cpp	Fri Nov 26 19:03:32 2021 +0100
@@ -505,21 +505,19 @@
     {
       return defaultValue;
     }
-    else if (found->second == "0" ||
-             found->second == "false")
-    {
-      return false;
-    }
-    else if (found->second == "1" ||
-             found->second == "true")
-    {
-      return true;
-    }
     else
     {
-      throw OrthancException(ErrorCode_BadFileFormat, "Bad value for a Boolean user property in the parameters "
-                             "of a Web service: Property \"" + key + "\" equals: " + found->second);
-    }    
+      bool value;
+      if (SerializationToolbox::ParseBoolean(value, found->second))
+      {
+        return value;
+      }
+      else
+      {
+        throw OrthancException(ErrorCode_BadFileFormat, "Bad value for a Boolean user property in the parameters "
+                               "of a Web service: Property \"" + key + "\" equals: " + found->second);
+      }
+    }
   }