MCPcopy Create free account
hub / github.com/PlayFab/gsdk / readObject

Method readObject

cpp/cppsdk/jsoncpp.cpp:697–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected