Panda3D
Public Member Functions | List of all members
TiXmlPrinter Class Reference

Print to memory functionality. More...

Inheritance diagram for TiXmlPrinter:
TiXmlVisitor

Public Member Functions

 __init__ ()
 
 __init__ (const TiXmlPrinter)
 
str CStr ()
 Return the result. More...
 
str Indent ()
 Query the indention string. More...
 
str LineBreak ()
 Query the current line breaking string. More...
 
 SetIndent (str _indent)
 Set the indent characters for printing. More...
 
 SetLineBreak (str _lineBreak)
 Set the line breaking string. More...
 
 SetStreamPrinting ()
 Switch over to "stream printing" which is the most dense formatting without linebreaks. More...
 
int Size ()
 Return the length of the result string. More...
 
str Str ()
 Return the result. More...
 
- Public Member Functions inherited from TiXmlVisitor
 __init__ ()
 
 __init__ (const TiXmlVisitor)
 
bool Visit (const TiXmlComment)
 
bool Visit (const TiXmlDeclaration)
 
bool Visit (const TiXmlText)
 
bool Visit (const TiXmlUnknown)
 
bool VisitEnter (const TiXmlDocument)
 
bool VisitEnter (const TiXmlElement, const TiXmlAttribute)
 
bool VisitExit (const TiXmlDocument)
 
bool VisitExit (const TiXmlElement)
 

Detailed Description

Print to memory functionality.

The TiXmlPrinter is useful when you need to:

  1. Print to memory (especially in non-STL mode)
  2. Control formatting (line endings, etc.)

When constructed, the TiXmlPrinter is in its default "pretty printing" mode. Before calling Accept() you can call methods to control the printing of the XML document. After TiXmlNode::Accept() is called, the printed document can be accessed via the CStr(), Str(), and Size() methods.

TiXmlPrinter uses the Visitor API.

TiXmlPrinter printer;
printer.SetIndent( "\t" );

doc.Accept( &printer );
fprintf( stdout, "%s", printer.CStr() );

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

◆ __init__() [2/2]

__init__ ( const  TiXmlPrinter)

◆ CStr()

str CStr ( )

Return the result.

◆ Indent()

str Indent ( )

Query the indention string.

◆ LineBreak()

str LineBreak ( )

Query the current line breaking string.

◆ SetIndent()

SetIndent ( str  _indent)

Set the indent characters for printing.

By default 4 spaces but tab (\t) is also useful, or null/empty string for no indentation.

◆ SetLineBreak()

SetLineBreak ( str  _lineBreak)

Set the line breaking string.

By default set to newline (
). Some operating systems prefer other characters, or can be set to the null/empty string for no indenation.

◆ SetStreamPrinting()

SetStreamPrinting ( )

Switch over to "stream printing" which is the most dense formatting without linebreaks.

Common when the XML is needed for network transmission.

◆ Size()

int Size ( )

Return the length of the result string.

◆ Str()

str Str ( )

Return the result.