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

Method readArray

external/jsoncpp/jsoncpp.cpp:727–763  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725}
726
727bool Reader::readArray(Token &token) {
728 Value init(arrayValue);
729 currentValue().swapPayload(init);
730 currentValue().setOffsetStart(token.start_ - begin_);
731 skipSpaces();
732 if (current_ != end_ && *current_ == ']') // empty array
733 {
734 Token endArray;
735 readToken(endArray);
736 return true;
737 }
738 int index = 0;
739 for (;;) {
740 Value &value = currentValue()[index++];
741 nodes_.push(&value);
742 bool ok = readValue();
743 nodes_.pop();
744 if (!ok) // error already set
745 return recoverFromError(tokenArrayEnd);
746
747 Token currentToken;
748 // Accept Comment after last item in the array.
749 ok = readToken(currentToken);
750 while (currentToken.type_ == tokenComment && ok) {
751 ok = readToken(currentToken);
752 }
753 bool badTokenType = (currentToken.type_ != tokenArraySeparator &&
754 currentToken.type_ != tokenArrayEnd);
755 if (!ok || badTokenType) {
756 return addErrorAndRecover("Missing ',' or ']' in array declaration",
757 currentToken, tokenArrayEnd);
758 }
759 if (currentToken.type_ == tokenArrayEnd)
760 break;
761 }
762 return true;
763}
764
765bool Reader::decodeNumber(Token &token) {
766 Value decoded;

Callers

nothing calls this directly

Calls 4

swapPayloadMethod · 0.80
setOffsetStartMethod · 0.80
pushMethod · 0.80
popMethod · 0.80

Tested by

no test coverage detected