MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / StreamIn

Method StreamIn

cpp/tinyxml/tinyxmlparser.cpp:642–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

tinyxml.cppFile · 0.80

Calls 6

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

Tested by

no test coverage detected