XMLPrinter Class Reference
Inheritance diagram for XMLPrinter:
XMLVisitor

Public Member Functions

 XMLPrinter (FILE *file=nullptr, bool compact=false, int depth=0)
 
void PushHeader (bool writeBOM, bool writeDeclaration)
 
void OpenElement (const char *name, bool compactMode=false)
 
void PushAttribute (const char *name, const char *value)
 If streaming, add an attribute to an open element. More...
 
void PushAttribute (const char *name, int value)
 
void PushAttribute (const char *name, unsigned value)
 
void PushAttribute (const char *name, int64_t value)
 
void PushAttribute (const char *name, bool value)
 
void PushAttribute (const char *name, double value)
 
virtual void CloseElement (bool compactMode=false)
 If streaming, close the Element. More...
 
void PushText (const char *text, bool cdata=false)
 Add a text node. More...
 
void PushText (int value)
 Add a text node from an integer. More...
 
void PushText (unsigned value)
 Add a text node from an unsigned. More...
 
void PushText (int64_t value)
 Add a text node from an unsigned. More...
 
void PushText (bool value)
 Add a text node from a bool. More...
 
void PushText (float value)
 Add a text node from a float. More...
 
void PushText (double value)
 Add a text node from a double. More...
 
void PushComment (const char *comment)
 Add a comment. More...
 
void PushDeclaration (const char *value)
 
void PushUnknown (const char *value)
 
virtual bool VisitEnter (const XMLDocument &)
 Visit a document. More...
 
virtual bool VisitExit (const XMLDocument &)
 Visit a document. More...
 
virtual bool VisitEnter (const XMLElement &element, const XMLAttribute *attribute)
 Visit an element. More...
 
virtual bool VisitExit (const XMLElement &element)
 Visit an element. More...
 
virtual bool Visit (const XMLText &text)
 Visit a text node. More...
 
virtual bool Visit (const XMLComment &comment)
 Visit a comment node. More...
 
virtual bool Visit (const XMLDeclaration &declaration)
 Visit a declaration. More...
 
virtual bool Visit (const XMLUnknown &unknown)
 Visit an unknown node. More...
 
const char * CStr () const
 
int CStrSize () const
 
void ClearBuffer ()
 

Protected Member Functions

virtual bool CompactMode (const XMLElement &)
 
virtual void PrintSpace (int depth)
 
void Print (const char *format,...)
 
void Write (const char *data, int size)
 
void Write (const char *data)
 
void Putc (char ch)
 
void SealElementIfJustOpened ()
 

Protected Attributes

bool _elementJustOpened
 
DynArray< const char *, 10 > _stack
 

Private Types

enum  { ENTITY_RANGE = 64 , BUF_SIZE = 200 }
 

Private Member Functions

void PrintString (const char *, bool restrictedEntitySet)
 
 XMLPrinter (const XMLPrinter &)
 
XMLPrinteroperator= (const XMLPrinter &)
 

Private Attributes

bool _firstElement
 
FILE * _fp
 
int _depth
 
int _textDepth
 
bool _processEntities
 
bool _compactMode
 
bool _entityFlag [ENTITY_RANGE]
 
bool _restrictedEntityFlag [ENTITY_RANGE]
 
DynArray< char, 20 > _buffer
 

Detailed Description

Definition at line 2153 of file tinyxml2.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Definition at line 2266 of file tinyxml2.h.

Constructor & Destructor Documentation

◆ XMLPrinter()

XMLPrinter ( FILE *  file = nullptr,
bool  compact = false,
int  depth = 0 
)

Definition at line 2591 of file tinyxml2.cpp.

◆ ~XMLPrinter()

virtual ~XMLPrinter ( )
inlinevirtual

Definition at line 2163 of file tinyxml2.h.

Member Function Documentation

◆ ClearBuffer()

void ClearBuffer ( )
inline

Definition at line 2234 of file tinyxml2.h.

◆ CloseElement()

void CloseElement ( bool  compactMode = false)
virtual

If streaming, close the Element.

Definition at line 2834 of file tinyxml2.cpp.

◆ CompactMode()

virtual bool CompactMode ( const XMLElement )
inlineprotectedvirtual

Definition at line 2241 of file tinyxml2.h.

◆ CStr()

const char * CStr ( ) const
inline

Definition at line 2219 of file tinyxml2.h.

◆ CStrSize()

int CStrSize ( ) const
inline

Definition at line 2227 of file tinyxml2.h.

◆ OpenElement()

void OpenElement ( const char *  name,
bool  compactMode = false 
)

Definition at line 2760 of file tinyxml2.cpp.

◆ Print()

void Print ( const char *  format,
  ... 
)
protected

Definition at line 2621 of file tinyxml2.cpp.

◆ PrintSpace()

void PrintSpace ( int  depth)
protectedvirtual

Definition at line 2675 of file tinyxml2.cpp.

◆ PrintString()

void PrintString ( const char *  p,
bool  restrictedEntitySet 
)
private

Definition at line 2684 of file tinyxml2.cpp.

◆ PushAttribute() [1/6]

void PushAttribute ( const char *  name,
bool  value 
)

Definition at line 2818 of file tinyxml2.cpp.

◆ PushAttribute() [2/6]

void PushAttribute ( const char *  name,
const char *  value 
)

If streaming, add an attribute to an open element.

Definition at line 2783 of file tinyxml2.cpp.

◆ PushAttribute() [3/6]

void PushAttribute ( const char *  name,
double  value 
)

Definition at line 2826 of file tinyxml2.cpp.

◆ PushAttribute() [4/6]

void PushAttribute ( const char *  name,
int  value 
)

Definition at line 2794 of file tinyxml2.cpp.

◆ PushAttribute() [5/6]

void PushAttribute ( const char *  name,
int64_t  value 
)

Definition at line 2810 of file tinyxml2.cpp.

◆ PushAttribute() [6/6]

void PushAttribute ( const char *  name,
unsigned  value 
)

Definition at line 2802 of file tinyxml2.cpp.

◆ PushComment()

void PushComment ( const char *  comment)

Add a comment.

Definition at line 2942 of file tinyxml2.cpp.

◆ PushDeclaration()

void PushDeclaration ( const char *  value)

Definition at line 2958 of file tinyxml2.cpp.

◆ PushHeader()

void PushHeader ( bool  writeBOM,
bool  writeDeclaration 
)

Definition at line 2746 of file tinyxml2.cpp.

◆ PushText() [1/7]

void PushText ( bool  value)

Add a text node from a bool.

Definition at line 2918 of file tinyxml2.cpp.

◆ PushText() [2/7]

void PushText ( const char *  text,
bool  cdata = false 
)

Add a text node.

Definition at line 2878 of file tinyxml2.cpp.

◆ PushText() [3/7]

void PushText ( double  value)

Add a text node from a double.

Definition at line 2934 of file tinyxml2.cpp.

◆ PushText() [4/7]

void PushText ( float  value)

Add a text node from a float.

Definition at line 2926 of file tinyxml2.cpp.

◆ PushText() [5/7]

void PushText ( int  value)

Add a text node from an integer.

Definition at line 2902 of file tinyxml2.cpp.

◆ PushText() [6/7]

void PushText ( int64_t  value)

Add a text node from an unsigned.

Definition at line 2895 of file tinyxml2.cpp.

◆ PushText() [7/7]

void PushText ( unsigned  value)

Add a text node from an unsigned.

Definition at line 2910 of file tinyxml2.cpp.

◆ PushUnknown()

void PushUnknown ( const char *  value)

Definition at line 2974 of file tinyxml2.cpp.

◆ Putc()

void Putc ( char  ch)
protected

Definition at line 2660 of file tinyxml2.cpp.

◆ SealElementIfJustOpened()

void SealElementIfJustOpened ( )
protected

Definition at line 2867 of file tinyxml2.cpp.

◆ Visit() [1/4]

bool Visit ( const XMLComment )
virtual

Visit a comment node.

Reimplemented from XMLVisitor.

Definition at line 3033 of file tinyxml2.cpp.

◆ Visit() [2/4]

bool Visit ( const XMLDeclaration )
virtual

Visit a declaration.

Reimplemented from XMLVisitor.

Definition at line 3039 of file tinyxml2.cpp.

◆ Visit() [3/4]

bool Visit ( const XMLText )
virtual

Visit a text node.

Reimplemented from XMLVisitor.

Definition at line 3026 of file tinyxml2.cpp.

◆ Visit() [4/4]

bool Visit ( const XMLUnknown )
virtual

Visit an unknown node.

Reimplemented from XMLVisitor.

Definition at line 3046 of file tinyxml2.cpp.

◆ VisitEnter() [1/2]

bool VisitEnter ( const XMLDocument )
virtual

Visit a document.

Reimplemented from XMLVisitor.

Definition at line 2990 of file tinyxml2.cpp.

◆ VisitEnter() [2/2]

bool VisitEnter ( const XMLElement ,
const XMLAttribute  
)
virtual

Visit an element.

Reimplemented from XMLVisitor.

Definition at line 3001 of file tinyxml2.cpp.

◆ VisitExit() [1/2]

virtual bool VisitExit ( const XMLDocument )
inlinevirtual

Visit a document.

Reimplemented from XMLVisitor.

Definition at line 2203 of file tinyxml2.h.

◆ VisitExit() [2/2]

bool VisitExit ( const XMLElement )
virtual

Visit an element.

Reimplemented from XMLVisitor.

Definition at line 3019 of file tinyxml2.cpp.

◆ Write() [1/2]

void Write ( const char *  data)
inlineprotected

Definition at line 2249 of file tinyxml2.h.

◆ Write() [2/2]

void Write ( const char *  data,
int  size 
)
protected

Definition at line 2645 of file tinyxml2.cpp.

Member Data Documentation

◆ _buffer

DynArray< char, 20 > _buffer
private

Definition at line 2273 of file tinyxml2.h.

◆ _compactMode

bool _compactMode
private

Definition at line 2264 of file tinyxml2.h.

◆ _depth

int _depth
private

Definition at line 2261 of file tinyxml2.h.

◆ _elementJustOpened

bool _elementJustOpened
protected

Definition at line 2253 of file tinyxml2.h.

◆ _entityFlag

bool _entityFlag[ENTITY_RANGE]
private

Definition at line 2270 of file tinyxml2.h.

◆ _firstElement

bool _firstElement
private

Definition at line 2259 of file tinyxml2.h.

◆ _fp

FILE* _fp
private

Definition at line 2260 of file tinyxml2.h.

◆ _processEntities

bool _processEntities
private

Definition at line 2263 of file tinyxml2.h.

◆ _restrictedEntityFlag

bool _restrictedEntityFlag[ENTITY_RANGE]
private

Definition at line 2271 of file tinyxml2.h.

◆ _stack

DynArray< const char*, 10 > _stack
protected

Definition at line 2254 of file tinyxml2.h.

◆ _textDepth

int _textDepth
private

Definition at line 2262 of file tinyxml2.h.


The documentation for this class was generated from the following files: