MCPcopy Create free account
hub / github.com/Kitware/VTK / readObject

Method readObject

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:681–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected