MCPcopy Create free account
hub / github.com/chigraph/chigraph / parseObjectPair

Function parseObjectPair

libchigraph/src/JsonDeserializer.cpp:489–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487}
488
489std::pair<std::string, std::string> parseObjectPair(const nlohmann::json& object) {
490 if (!object.is_object()) { return {}; }
491
492 auto iter = object.begin();
493 if (iter == object.end()) { return {}; }
494
495 std::string key = iter.key();
496 std::string val = iter.value();
497
498 // make sure it's the only element
499 ++iter;
500 if (iter != object.end()) { return {}; }
501
502 return {key, val};
503}
504} // namespace chi

Callers 3

nodeTypeFromNameMethod · 0.85
jsonToGraphStructFunction · 0.85

Calls 5

is_objectMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
keyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected