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

Method Print

ogsr_engine/xrCore/XML_Parser/tinyxml.cpp:718–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716#endif
717
718void TiXmlElement::Print(FILE* cfile, int depth) const
719{
720 int i;
721 assert(cfile);
722 for (i = 0; i < depth; i++)
723 {
724 fprintf(cfile, " ");
725 }
726
727 fprintf(cfile, "<%s", value.c_str());
728
729 const TiXmlAttribute* attrib;
730 for (attrib = attributeSet.First(); attrib; attrib = attrib->Next())
731 {
732 fprintf(cfile, " ");
733 attrib->Print(cfile, depth);
734 }
735
736 // There are 3 different formatting approaches:
737 // 1) An element without children is printed as a <foo /> node
738 // 2) An element with only a text child is printed as <foo> text </foo>
739 // 3) An element with children is printed on multiple lines.
740 TiXmlNode* node;
741 if (!firstChild)
742 {
743 fprintf(cfile, " />");
744 }
745 else if (firstChild == lastChild && firstChild->ToText())
746 {
747 fprintf(cfile, ">");
748 firstChild->Print(cfile, depth + 1);
749 fprintf(cfile, "</%s>", value.c_str());
750 }
751 else
752 {
753 fprintf(cfile, ">");
754
755 for (node = firstChild; node; node = node->NextSibling())
756 {
757 if (!node->ToText())
758 {
759 fprintf(cfile, "\n");
760 }
761 node->Print(cfile, depth + 1);
762 }
763 fprintf(cfile, "\n");
764 for (i = 0; i < depth; ++i)
765 {
766 fprintf(cfile, " ");
767 }
768 fprintf(cfile, "</%s>", value.c_str());
769 }
770}
771
772void TiXmlElement::CopyTo(TiXmlElement* target) const
773{

Callers 2

VisitEnterMethod · 0.45
VisitMethod · 0.45

Calls 7

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

Tested by

no test coverage detected