diff Core/SerializationToolbox.cpp @ 3799:320a2d224902

merge
author Alain Mazy <alain@mazy.be>
date Wed, 01 Apr 2020 10:15:33 +0200
parents f6a73611ec5c
children 09798f2b985f
line wrap: on
line diff
--- a/Core/SerializationToolbox.cpp	Wed Apr 01 10:14:49 2020 +0200
+++ b/Core/SerializationToolbox.cpp	Wed Apr 01 10:15:33 2020 +0200
@@ -320,6 +320,28 @@
     }
 
 
+    void WriteListOfStrings(Json::Value& target,
+                            const std::list<std::string>& values,
+                            const std::string& field)
+    {
+      if (target.type() != Json::objectValue ||
+          target.isMember(field.c_str()))
+      {
+        throw OrthancException(ErrorCode_BadFileFormat);
+      }
+
+      Json::Value& value = target[field];
+
+      value = Json::arrayValue;
+
+      for (std::list<std::string>::const_iterator it = values.begin();
+           it != values.end(); ++it)
+      {
+        value.append(*it);
+      }
+    }
+
+
     void WriteSetOfStrings(Json::Value& target,
                            const std::set<std::string>& values,
                            const std::string& field)