MCPcopy Create free account
hub / github.com/cinder/Cinder / readArray

Method readArray

src/jsoncpp/jsoncpp.cpp:664–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

662}
663
664bool Reader::readArray(Token& tokenStart) {
665 Value init(arrayValue);
666 currentValue().swapPayload(init);
667 currentValue().setOffsetStart(tokenStart.start_ - begin_);
668 skipSpaces();
669 if (*current_ == ']') // empty array
670 {
671 Token endArray;
672 readToken(endArray);
673 return true;
674 }
675 int index = 0;
676 for (;;) {
677 Value& value = currentValue()[index++];
678 nodes_.push(&value);
679 bool ok = readValue();
680 nodes_.pop();
681 if (!ok) // error already set
682 return recoverFromError(tokenArrayEnd);
683
684 Token token;
685 // Accept Comment after last item in the array.
686 ok = readToken(token);
687 while (token.type_ == tokenComment && ok) {
688 ok = readToken(token);
689 }
690 bool badTokenType =
691 (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
692 if (!ok || badTokenType) {
693 return addErrorAndRecover(
694 "Missing ',' or ']' in array declaration", token, tokenArrayEnd);
695 }
696 if (token.type_ == tokenArrayEnd)
697 break;
698 }
699 return true;
700}
701
702bool Reader::decodeNumber(Token& token) {
703 Value decoded;

Callers

nothing calls this directly

Calls 5

readValueFunction · 0.85
swapPayloadMethod · 0.80
setOffsetStartMethod · 0.80
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected