MCPcopy Create free account
hub / github.com/cuberite/cuberite / readObject

Method readObject

lib/jsoncpp/src/lib_json/json_reader.cpp:479–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477
478
479bool
480Reader::readObject( Token &tokenStart )
481{
482 Token tokenName;
483 std::string name;
484 currentValue() = Value( objectValue );
485 while ( readToken( tokenName ) )
486 {
487 bool initialTokenOk = true;
488 while ( tokenName.type_ == tokenComment && initialTokenOk )
489 initialTokenOk = readToken( tokenName );
490 if ( !initialTokenOk )
491 break;
492 if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object
493 return true;
494 if ( tokenName.type_ != tokenString )
495 break;
496
497 name = "";
498 if ( !decodeString( tokenName, name ) )
499 return recoverFromError( tokenObjectEnd );
500
501 Token colon;
502 if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator )
503 {
504 return addErrorAndRecover( "Missing ':' after object member name",
505 colon,
506 tokenObjectEnd );
507 }
508 Value &value = currentValue()[ name ];
509 nodes_.push( &value );
510 bool ok = readValue();
511 nodes_.pop();
512 if ( !ok ) // error already set
513 return recoverFromError( tokenObjectEnd );
514
515 Token comma;
516 if ( !readToken( comma )
517 || ( comma.type_ != tokenObjectEnd &&
518 comma.type_ != tokenArraySeparator &&
519 comma.type_ != tokenComment ) )
520 {
521 return addErrorAndRecover( "Missing ',' or '}' in object declaration",
522 comma,
523 tokenObjectEnd );
524 }
525 bool finalizeTokenOk = true;
526 while ( comma.type_ == tokenComment &&
527 finalizeTokenOk )
528 finalizeTokenOk = readToken( comma );
529 if ( comma.type_ == tokenObjectEnd )
530 return true;
531 }
532 return addErrorAndRecover( "Missing '}' or object member name",
533 tokenName,
534 tokenObjectEnd );
535}
536

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.80
ValueClass · 0.50

Tested by

no test coverage detected