MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / readObject

Method readObject

json/jsoncpp.cpp:699–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

697}
698
699bool Reader::readObject(Token& tokenStart) {
700 Token tokenName;
701 JSONCPP_STRING name;
702 Value init(objectValue);
703 currentValue().swapPayload(init);
704 currentValue().setOffsetStart(tokenStart.start_ - begin_);
705 while (readToken(tokenName)) {
706 bool initialTokenOk = true;
707 while (tokenName.type_ == tokenComment && initialTokenOk)
708 initialTokenOk = readToken(tokenName);
709 if (!initialTokenOk)
710 break;
711 if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
712 return true;
713 name.clear();
714 if (tokenName.type_ == tokenString) {
715 if (!decodeString(tokenName, name))
716 return recoverFromError(tokenObjectEnd);
717 } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
718 Value numberName;
719 if (!decodeNumber(tokenName, numberName))
720 return recoverFromError(tokenObjectEnd);
721 name = JSONCPP_STRING(numberName.asCString());
722 } else {
723 break;
724 }
725
726 Token colon;
727 if (!readToken(colon) || colon.type_ != tokenMemberSeparator) {
728 return addErrorAndRecover("Missing ':' after object member name", colon,
729 tokenObjectEnd);
730 }
731 Value& value = currentValue()[name];
732 nodes_.push(&value);
733 bool ok = readValue();
734 nodes_.pop();
735 if (!ok) // error already set
736 return recoverFromError(tokenObjectEnd);
737
738 Token comma;
739 if (!readToken(comma) ||
740 (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator &&
741 comma.type_ != tokenComment)) {
742 return addErrorAndRecover("Missing ',' or '}' in object declaration",
743 comma, tokenObjectEnd);
744 }
745 bool finalizeTokenOk = true;
746 while (comma.type_ == tokenComment && finalizeTokenOk)
747 finalizeTokenOk = readToken(comma);
748 if (comma.type_ == tokenObjectEnd)
749 return true;
750 }
751 return addErrorAndRecover("Missing '}' or object member name", tokenName,
752 tokenObjectEnd);
753}
754
755bool Reader::readArray(Token& tokenStart) {
756 Value init(arrayValue);

Callers

nothing calls this directly

Calls 11

throwRuntimeErrorFunction · 0.85
swapPayloadMethod · 0.80
setOffsetStartMethod · 0.80
asCStringMethod · 0.80
asStringMethod · 0.80
isMemberMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
pushMethod · 0.45
popMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected