MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / StreamIn

Method StreamIn

ogsr_engine/xrCore/XML_Parser/tinyxmlparser.cpp:614–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

tinyxml.cppFile · 0.80

Calls 9

xr_deleteFunction · 0.85
SetErrorMethod · 0.80
atMethod · 0.80
xr_strcmpFunction · 0.50
lengthMethod · 0.45
getMethod · 0.45
c_strMethod · 0.45
ToElementMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected