| 4158 | } |
| 4159 | |
| 4160 | static bool ParseJSONProperty(std::map<std::string, double> *ret, |
| 4161 | std::string *err, const detail::json &o, |
| 4162 | const std::string &property, bool required) { |
| 4163 | detail::json_const_iterator it; |
| 4164 | if (!detail::FindMember(o, property.c_str(), it)) { |
| 4165 | if (required) { |
| 4166 | if (err) { |
| 4167 | (*err) += "'" + property + "' property is missing. \n'"; |
| 4168 | } |
| 4169 | } |
| 4170 | return false; |
| 4171 | } |
| 4172 | |
| 4173 | const detail::json &obj = detail::GetValue(it); |
| 4174 | |
| 4175 | if (!detail::IsObject(obj)) { |
| 4176 | if (required) { |
| 4177 | if (err) { |
| 4178 | (*err) += "'" + property + "' property is not a JSON object.\n"; |
| 4179 | } |
| 4180 | } |
| 4181 | return false; |
| 4182 | } |
| 4183 | |
| 4184 | ret->clear(); |
| 4185 | |
| 4186 | detail::json_const_iterator it2(detail::ObjectBegin(obj)); |
| 4187 | detail::json_const_iterator itEnd(detail::ObjectEnd(obj)); |
| 4188 | for (; it2 != itEnd; ++it2) { |
| 4189 | double numVal; |
| 4190 | if (detail::GetNumber(detail::GetValue(it2), numVal)) |
| 4191 | ret->emplace(std::string(detail::GetKey(it2)), numVal); |
| 4192 | } |
| 4193 | |
| 4194 | return true; |
| 4195 | } |
| 4196 | |
| 4197 | static bool ParseParameterProperty(Parameter *param, std::string *err, |
| 4198 | const detail::json &o, |
no test coverage detected