MCPcopy Create free account
hub / github.com/OpenMW/openmw / StreamIn

Method StreamIn

extern/oics/tinyxml/tinyxmlparser.cpp:633–692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

tinyxml.cppFile · 0.80

Calls 8

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

Tested by

no test coverage detected