MCPcopy Create free account
hub / github.com/Samsung/UTopia / readObject

Method readObject

external/jsoncpp/jsoncpp.cpp:671–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

669}
670
671bool Reader::readObject(Token &token) {
672 Token tokenName;
673 String name;
674 Value init(objectValue);
675 currentValue().swapPayload(init);
676 currentValue().setOffsetStart(token.start_ - begin_);
677 while (readToken(tokenName)) {
678 bool initialTokenOk = true;
679 while (tokenName.type_ == tokenComment && initialTokenOk)
680 initialTokenOk = readToken(tokenName);
681 if (!initialTokenOk)
682 break;
683 if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
684 return true;
685 name.clear();
686 if (tokenName.type_ == tokenString) {
687 if (!decodeString(tokenName, name))
688 return recoverFromError(tokenObjectEnd);
689 } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
690 Value numberName;
691 if (!decodeNumber(tokenName, numberName))
692 return recoverFromError(tokenObjectEnd);
693 name = String(numberName.asCString());
694 } else {
695 break;
696 }
697
698 Token colon;
699 if (!readToken(colon) || colon.type_ != tokenMemberSeparator) {
700 return addErrorAndRecover("Missing ':' after object member name", colon,
701 tokenObjectEnd);
702 }
703 Value &value = currentValue()[name];
704 nodes_.push(&value);
705 bool ok = readValue();
706 nodes_.pop();
707 if (!ok) // error already set
708 return recoverFromError(tokenObjectEnd);
709
710 Token comma;
711 if (!readToken(comma) ||
712 (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator &&
713 comma.type_ != tokenComment)) {
714 return addErrorAndRecover("Missing ',' or '}' in object declaration",
715 comma, tokenObjectEnd);
716 }
717 bool finalizeTokenOk = true;
718 while (comma.type_ == tokenComment && finalizeTokenOk)
719 finalizeTokenOk = readToken(comma);
720 if (comma.type_ == tokenObjectEnd)
721 return true;
722 }
723 return addErrorAndRecover("Missing '}' or object member name", tokenName,
724 tokenObjectEnd);
725}
726
727bool Reader::readArray(Token &token) {
728 Value init(arrayValue);

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected