MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / Print

Method Print

tinyxml/src/tinyxml.cpp:800–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

798
799
800void TiXmlElement::Print( FILE* cfile, int depth ) const
801{
802 int i;
803 assert( cfile );
804 for ( i=0; i<depth; i++ ) {
805 fprintf( cfile, " " );
806 }
807
808 fprintf( cfile, "<%s", value.c_str() );
809
810 const TiXmlAttribute* attrib;
811 for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
812 {
813 fprintf( cfile, " " );
814 attrib->Print( cfile, depth );
815 }
816
817 // There are 3 different formatting approaches:
818 // 1) An element without children is printed as a <foo /> node
819 // 2) An element with only a text child is printed as <foo> text </foo>
820 // 3) An element with children is printed on multiple lines.
821 TiXmlNode* node;
822 if ( !firstChild )
823 {
824 fprintf( cfile, " />" );
825 }
826 else if ( firstChild == lastChild && firstChild->ToText() )
827 {
828 fprintf( cfile, ">" );
829 firstChild->Print( cfile, depth + 1 );
830 fprintf( cfile, "</%s>", value.c_str() );
831 }
832 else
833 {
834 fprintf( cfile, ">" );
835
836 for ( node = firstChild; node; node=node->NextSibling() )
837 {
838 if ( !node->ToText() )
839 {
840 fprintf( cfile, "\n" );
841 }
842 node->Print( cfile, depth+1 );
843 }
844 fprintf( cfile, "\n" );
845 for( i=0; i<depth; ++i ) {
846 fprintf( cfile, " " );
847 }
848 fprintf( cfile, "</%s>", value.c_str() );
849 }
850}
851
852
853void TiXmlElement::CopyTo( TiXmlElement* target ) const

Callers 2

VisitEnterMethod · 0.45
VisitMethod · 0.45

Calls 7

c_strMethod · 0.80
FirstMethod · 0.80
findMethod · 0.80
emptyMethod · 0.80
NextMethod · 0.45
ToTextMethod · 0.45
NextSiblingMethod · 0.45

Tested by

no test coverage detected