comparison Core/SerializationToolbox.cpp @ 3638:ae866fc06df5 storage-commitment

serialization of StorageCommitmentScpJob
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 31 Jan 2020 16:53:23 +0100
parents 972cc98959a3
children f6a73611ec5c
comparison
equal deleted inserted replaced
3637:06eb59faf4da 3638:ae866fc06df5
318 value.append(values[i]); 318 value.append(values[i]);
319 } 319 }
320 } 320 }
321 321
322 322
323 void WriteListOfStrings(Json::Value& target,
324 const std::list<std::string>& values,
325 const std::string& field)
326 {
327 if (target.type() != Json::objectValue ||
328 target.isMember(field.c_str()))
329 {
330 throw OrthancException(ErrorCode_BadFileFormat);
331 }
332
333 Json::Value& value = target[field];
334
335 value = Json::arrayValue;
336
337 for (std::list<std::string>::const_iterator it = values.begin();
338 it != values.end(); ++it)
339 {
340 value.append(*it);
341 }
342 }
343
344
323 void WriteSetOfStrings(Json::Value& target, 345 void WriteSetOfStrings(Json::Value& target,
324 const std::set<std::string>& values, 346 const std::set<std::string>& values,
325 const std::string& field) 347 const std::string& field)
326 { 348 {
327 if (target.type() != Json::objectValue || 349 if (target.type() != Json::objectValue ||