MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / ParseJSONProperty

Function ParseJSONProperty

external/tinygltf/tiny_gltf.h:4160–4195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4158}
4159
4160static 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
4197static bool ParseParameterProperty(Parameter *param, std::string *err,
4198 const detail::json &o,

Callers 1

ParseParameterPropertyFunction · 0.85

Calls 8

FindMemberFunction · 0.85
IsObjectFunction · 0.85
ObjectBeginFunction · 0.85
ObjectEndFunction · 0.85
GetNumberFunction · 0.85
GetKeyFunction · 0.70
clearMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected