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

Method readArray

cpp/cppsdk/jsoncpp.cpp:753–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

751}
752
753bool Reader::readArray(Token& token) {
754 Value init(arrayValue);
755 currentValue().swapPayload(init);
756 currentValue().setOffsetStart(token.start_ - begin_);
757 skipSpaces();
758 if (current_ != end_ && *current_ == ']') // empty array
759 {
760 Token endArray;
761 readToken(endArray);
762 return true;
763 }
764 int index = 0;
765 for (;;) {
766 Value& value = currentValue()[index++];
767 nodes_.push(&value);
768 bool ok = readValue();
769 nodes_.pop();
770 if (!ok) // error already set
771 return recoverFromError(tokenArrayEnd);
772
773 Token currentToken;
774 // Accept Comment after last item in the array.
775 ok = readToken(currentToken);
776 while (currentToken.type_ == tokenComment && ok) {
777 ok = readToken(currentToken);
778 }
779 bool badTokenType = (currentToken.type_ != tokenArraySeparator &&
780 currentToken.type_ != tokenArrayEnd);
781 if (!ok || badTokenType) {
782 return addErrorAndRecover("Missing ',' or ']' in array declaration",
783 currentToken, tokenArrayEnd);
784 }
785 if (currentToken.type_ == tokenArrayEnd)
786 break;
787 }
788 return true;
789}
790
791bool Reader::decodeNumber(Token& token) {
792 Value decoded;

Callers

nothing calls this directly

Calls 2

swapPayloadMethod · 0.80
setOffsetStartMethod · 0.80

Tested by

no test coverage detected