Mercurial > hg > orthanc
comparison OrthancServer/ServerToolbox.cpp @ 226:8a26a8e85edf
refactoring to read files
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 30 Nov 2012 09:45:29 +0100 |
parents | 4ce7fdcc8879 |
children | 7c1faef915a4 |
comparison
equal
deleted
inserted
replaced
225:03aa59ecf6d8 | 226:8a26a8e85edf |
---|---|
34 | 34 |
35 #include "../Core/OrthancException.h" | 35 #include "../Core/OrthancException.h" |
36 | 36 |
37 namespace Orthanc | 37 namespace Orthanc |
38 { | 38 { |
39 void ReadJson(Json::Value& target, | |
40 const FileStorage& storage, | |
41 const std::string& fileUuid) | |
42 { | |
43 std::string s; | |
44 storage.ReadFile(s, fileUuid); | |
45 | |
46 Json::Reader reader; | |
47 if (!reader.parse(s, target)) | |
48 { | |
49 throw OrthancException("Corrupted JSON file"); | |
50 } | |
51 } | |
52 | |
53 void SimplifyTags(Json::Value& target, | 39 void SimplifyTags(Json::Value& target, |
54 const Json::Value& source) | 40 const Json::Value& source) |
55 { | 41 { |
56 assert(source.isObject()); | 42 assert(source.isObject()); |
57 | 43 |