mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-05-14 19:31:23 +00:00
Added depth as constructor argument to XMLPrinter. This way, XML files that are not written with XMLDocument can be properly indented.
Removed unused forward declaration
This commit is contained in:
parent
95060350bd
commit
1bfb95488f
@ -1729,11 +1729,11 @@ void XMLDocument::PrintError() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XMLPrinter::XMLPrinter( FILE* file, bool compact ) :
|
XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) :
|
||||||
_elementJustOpened( false ),
|
_elementJustOpened( false ),
|
||||||
_firstElement( true ),
|
_firstElement( true ),
|
||||||
_fp( file ),
|
_fp( file ),
|
||||||
_depth( 0 ),
|
_depth( depth ),
|
||||||
_textDepth( -1 ),
|
_textDepth( -1 ),
|
||||||
_processEntities( true ),
|
_processEntities( true ),
|
||||||
_compactMode( compact )
|
_compactMode( compact )
|
||||||
@ -1858,6 +1858,8 @@ void XMLPrinter::OpenElement( const char* name )
|
|||||||
|
|
||||||
if ( _textDepth < 0 && !_firstElement && !_compactMode ) {
|
if ( _textDepth < 0 && !_firstElement && !_compactMode ) {
|
||||||
Print( "\n" );
|
Print( "\n" );
|
||||||
|
}
|
||||||
|
if ( !_compactMode ) {
|
||||||
PrintSpace( _depth );
|
PrintSpace( _depth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,11 +125,9 @@ class XMLDocument;
|
|||||||
class XMLElement;
|
class XMLElement;
|
||||||
class XMLAttribute;
|
class XMLAttribute;
|
||||||
class XMLComment;
|
class XMLComment;
|
||||||
class XMLNode;
|
|
||||||
class XMLText;
|
class XMLText;
|
||||||
class XMLDeclaration;
|
class XMLDeclaration;
|
||||||
class XMLUnknown;
|
class XMLUnknown;
|
||||||
|
|
||||||
class XMLPrinter;
|
class XMLPrinter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1884,7 +1882,7 @@ public:
|
|||||||
If 'compact' is set to true, then output is created
|
If 'compact' is set to true, then output is created
|
||||||
with only required whitespace and newlines.
|
with only required whitespace and newlines.
|
||||||
*/
|
*/
|
||||||
XMLPrinter( FILE* file=0, bool compact = false );
|
XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 );
|
||||||
~XMLPrinter() {}
|
~XMLPrinter() {}
|
||||||
|
|
||||||
/** If streaming, write the BOM and declaration. */
|
/** If streaming, write the BOM and declaration. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user