MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / StreamIn

Method StreamIn

Engine/lib/tinyxml/tinyxmlparser.cpp:618–677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616#ifdef TIXML_USE_STL
617
618void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag )
619{
620 // The basic issue with a document is that we don't know what we're
621 // streaming. Read something presumed to be a tag (and hope), then
622 // identify it, and call the appropriate stream method on the tag.
623 //
624 // This "pre-streaming" will never read the closing ">" so the
625 // sub-tag can orient itself.
626
627 if ( !StreamTo( in, '<', tag ) )
628 {
629 SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
630 return;
631 }
632
633 while ( in->good() )
634 {
635 int tagIndex = (int) tag->length();
636 while ( in->good() && in->peek() != '>' )
637 {
638 int c = in->get();
639 if ( c <= 0 )
640 {
641 SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
642 break;
643 }
644 (*tag) += (char) c;
645 }
646
647 if ( in->good() )
648 {
649 // We now have something we presume to be a node of
650 // some sort. Identify it, and call the node to
651 // continue streaming.
652 TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
653
654 if ( node )
655 {
656 node->StreamIn( in, tag );
657 bool isElement = node->ToElement() != 0;
658 delete node;
659 node = 0;
660
661 // If this is the root element, we're done. Parsing will be
662 // done by the >> operator.
663 if ( isElement )
664 {
665 return;
666 }
667 }
668 else
669 {
670 SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
671 return;
672 }
673 }
674 }
675 // We should have returned sooner.

Callers 1

tinyxml.cppFile · 0.80

Calls 7

SetErrorMethod · 0.80
lengthMethod · 0.45
getMethod · 0.45
c_strMethod · 0.45
ToElementMethod · 0.45
atMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected