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

Function ParseStringIntegerProperty

external/tinygltf/tiny_gltf.h:4106–4158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4104}
4105
4106static bool ParseStringIntegerProperty(std::map<std::string, int> *ret,
4107 std::string *err, const detail::json &o,
4108 const std::string &property,
4109 bool required,
4110 const std::string &parent = "") {
4111 detail::json_const_iterator it;
4112 if (!detail::FindMember(o, property.c_str(), it)) {
4113 if (required) {
4114 if (err) {
4115 if (!parent.empty()) {
4116 (*err) +=
4117 "'" + property + "' property is missing in " + parent + ".\n";
4118 } else {
4119 (*err) += "'" + property + "' property is missing.\n";
4120 }
4121 }
4122 }
4123 return false;
4124 }
4125
4126 const detail::json &dict = detail::GetValue(it);
4127
4128 // Make sure we are dealing with an object / dictionary.
4129 if (!detail::IsObject(dict)) {
4130 if (required) {
4131 if (err) {
4132 (*err) += "'" + property + "' property is not an object.\n";
4133 }
4134 }
4135 return false;
4136 }
4137
4138 ret->clear();
4139
4140 detail::json_const_iterator dictIt(detail::ObjectBegin(dict));
4141 detail::json_const_iterator dictItEnd(detail::ObjectEnd(dict));
4142
4143 for (; dictIt != dictItEnd; ++dictIt) {
4144 int intVal;
4145 if (!detail::GetInt(detail::GetValue(dictIt), intVal)) {
4146 if (required) {
4147 if (err) {
4148 (*err) += "'" + property + "' value is not an integer type.\n";
4149 }
4150 }
4151 return false;
4152 }
4153
4154 // Insert into the list.
4155 (*ret)[detail::GetKey(dictIt)] = intVal;
4156 }
4157 return true;
4158}
4159
4160static bool ParseJSONProperty(std::map<std::string, double> *ret,
4161 std::string *err, const detail::json &o,

Callers 1

ParsePrimitiveFunction · 0.85

Calls 8

FindMemberFunction · 0.85
IsObjectFunction · 0.85
ObjectBeginFunction · 0.85
ObjectEndFunction · 0.85
GetIntFunction · 0.85
GetKeyFunction · 0.70
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected