comparison Core/Toolbox.cpp @ 1424:fe384a9d3b51

OrthancPluginGetConfiguration
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Jun 2015 15:32:45 +0200
parents 704de8c30ff5
children 0a355eeeb351
comparison
equal deleted inserted replaced
1423:7b7d597a190c 1424:fe384a9d3b51
1135 pos++; 1135 pos++;
1136 } 1136 }
1137 1137
1138 return true; 1138 return true;
1139 } 1139 }
1140
1141
1142 void Toolbox::CopyJsonWithoutComments(Json::Value& target,
1143 const Json::Value& source)
1144 {
1145 switch (source.type())
1146 {
1147 case Json::nullValue:
1148 target = Json::nullValue;
1149 break;
1150
1151 case Json::intValue:
1152 target = source.asInt64();
1153 break;
1154
1155 case Json::uintValue:
1156 target = source.asUInt64();
1157 break;
1158
1159 case Json::realValue:
1160 target = source.asDouble();
1161 break;
1162
1163 case Json::stringValue:
1164 target = source.asString();
1165 break;
1166
1167 case Json::booleanValue:
1168 target = source.asBool();
1169 break;
1170
1171 case Json::arrayValue:
1172 {
1173 target = Json::arrayValue;
1174 for (Json::Value::ArrayIndex i = 0; i < source.size(); i++)
1175 {
1176 Json::Value& item = target.append(Json::nullValue);
1177 CopyJsonWithoutComments(item, source[i]);
1178 }
1179
1180 break;
1181 }
1182
1183 case Json::objectValue:
1184 {
1185 target = Json::objectValue;
1186 Json::Value::Members members = source.getMemberNames();
1187 for (Json::Value::ArrayIndex i = 0; i < members.size(); i++)
1188 {
1189 const std::string item = members[i];
1190 CopyJsonWithoutComments(target[item], source[item]);
1191 }
1192
1193 break;
1194 }
1195
1196 default:
1197 break;
1198 }
1199 }
1140 } 1200 }
1141 1201