Mercurial > hg > orthanc
comparison Core/SerializationToolbox.h @ 3991:5d2348b39392
turning toolbox namespaces into classes to control visibility in shared libraries
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 29 May 2020 21:23:57 +0200 |
parents | 09798f2b985f |
children | f9863630ec7f |
comparison
equal
deleted
inserted
replaced
3990:226ab94a33cd | 3991:5d2348b39392 |
---|---|
32 | 32 |
33 | 33 |
34 #pragma once | 34 #pragma once |
35 | 35 |
36 #include "DicomFormat/DicomTag.h" | 36 #include "DicomFormat/DicomTag.h" |
37 #include "Exports.h" | |
37 | 38 |
38 #include <json/value.h> | 39 #include <json/value.h> |
39 #include <list> | 40 #include <list> |
40 #include <map> | 41 #include <map> |
41 | 42 |
42 namespace Orthanc | 43 namespace Orthanc |
43 { | 44 { |
44 namespace SerializationToolbox | 45 class ORTHANC_PUBLIC SerializationToolbox |
45 { | 46 { |
46 std::string ReadString(const Json::Value& value, | 47 public: |
48 static std::string ReadString(const Json::Value& value, | |
49 const std::string& field); | |
50 | |
51 static int ReadInteger(const Json::Value& value, | |
47 const std::string& field); | 52 const std::string& field); |
48 | 53 |
49 int ReadInteger(const Json::Value& value, | 54 static int ReadInteger(const Json::Value& value, |
50 const std::string& field); | 55 const std::string& field, |
56 int defaultValue); | |
51 | 57 |
52 int ReadInteger(const Json::Value& value, | 58 static unsigned int ReadUnsignedInteger(const Json::Value& value, |
53 const std::string& field, | 59 const std::string& field); |
54 int defaultValue); | |
55 | 60 |
56 unsigned int ReadUnsignedInteger(const Json::Value& value, | 61 static bool ReadBoolean(const Json::Value& value, |
57 const std::string& field); | |
58 | |
59 bool ReadBoolean(const Json::Value& value, | |
60 const std::string& field); | |
61 | |
62 void ReadArrayOfStrings(std::vector<std::string>& target, | |
63 const Json::Value& value, | |
64 const std::string& field); | 62 const std::string& field); |
65 | 63 |
66 void ReadListOfStrings(std::list<std::string>& target, | 64 static void ReadArrayOfStrings(std::vector<std::string>& target, |
67 const Json::Value& value, | 65 const Json::Value& value, |
68 const std::string& field); | 66 const std::string& field); |
69 | 67 |
70 void ReadSetOfStrings(std::set<std::string>& target, | 68 static void ReadListOfStrings(std::list<std::string>& target, |
71 const Json::Value& value, | 69 const Json::Value& value, |
72 const std::string& field); | 70 const std::string& field); |
73 | 71 |
74 void ReadSetOfTags(std::set<DicomTag>& target, | 72 static void ReadSetOfStrings(std::set<std::string>& target, |
75 const Json::Value& value, | 73 const Json::Value& value, |
76 const std::string& field); | 74 const std::string& field); |
77 | 75 |
78 void ReadMapOfStrings(std::map<std::string, std::string>& values, | 76 static void ReadSetOfTags(std::set<DicomTag>& target, |
79 const Json::Value& target, | 77 const Json::Value& value, |
80 const std::string& field); | 78 const std::string& field); |
81 | 79 |
82 void ReadMapOfTags(std::map<DicomTag, std::string>& values, | 80 static void ReadMapOfStrings(std::map<std::string, std::string>& values, |
83 const Json::Value& target, | 81 const Json::Value& target, |
84 const std::string& field); | 82 const std::string& field); |
85 | 83 |
86 void WriteArrayOfStrings(Json::Value& target, | 84 static void ReadMapOfTags(std::map<DicomTag, std::string>& values, |
87 const std::vector<std::string>& values, | 85 const Json::Value& target, |
88 const std::string& field); | 86 const std::string& field); |
89 | 87 |
90 void WriteListOfStrings(Json::Value& target, | 88 static void WriteArrayOfStrings(Json::Value& target, |
91 const std::list<std::string>& values, | 89 const std::vector<std::string>& values, |
92 const std::string& field); | 90 const std::string& field); |
93 | 91 |
94 void WriteSetOfStrings(Json::Value& target, | 92 static void WriteListOfStrings(Json::Value& target, |
95 const std::set<std::string>& values, | 93 const std::list<std::string>& values, |
96 const std::string& field); | 94 const std::string& field); |
97 | 95 |
98 void WriteSetOfTags(Json::Value& target, | 96 static void WriteSetOfStrings(Json::Value& target, |
99 const std::set<DicomTag>& tags, | 97 const std::set<std::string>& values, |
100 const std::string& field); | 98 const std::string& field); |
101 | 99 |
102 void WriteMapOfStrings(Json::Value& target, | 100 static void WriteSetOfTags(Json::Value& target, |
103 const std::map<std::string, std::string>& values, | 101 const std::set<DicomTag>& tags, |
104 const std::string& field); | 102 const std::string& field); |
105 | 103 |
106 void WriteMapOfTags(Json::Value& target, | 104 static void WriteMapOfStrings(Json::Value& target, |
107 const std::map<DicomTag, std::string>& values, | 105 const std::map<std::string, std::string>& values, |
108 const std::string& field); | 106 const std::string& field); |
109 } | 107 |
108 static void WriteMapOfTags(Json::Value& target, | |
109 const std::map<DicomTag, std::string>& values, | |
110 const std::string& field); | |
111 }; | |
110 } | 112 } |