Merge branch 'master' of github.com:leethomason/tinyxml2
This commit is contained in:
20
.github/workflows/ci-unixish.yml
vendored
Normal file
20
.github/workflows/ci-unixish.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: C/C++ CI Unixish
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- name: make check
|
||||||
|
run: make check
|
||||||
|
- name: Install
|
||||||
|
run: sudo make install
|
||||||
42
tinyxml2.cpp
42
tinyxml2.cpp
@@ -2659,22 +2659,33 @@ void XMLPrinter::PushHeader( bool writeBOM, bool writeDec )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XMLPrinter::PrepareForNewNode( bool compactMode )
|
||||||
void XMLPrinter::OpenElement( const char* name, bool compactMode )
|
|
||||||
{
|
{
|
||||||
SealElementIfJustOpened();
|
SealElementIfJustOpened();
|
||||||
_stack.Push( name );
|
|
||||||
|
|
||||||
if ( _textDepth < 0 && !_firstElement && !compactMode ) {
|
if ( compactMode ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( _firstElement ) {
|
||||||
|
PrintSpace (_depth);
|
||||||
|
} else if ( _textDepth < 0) {
|
||||||
Putc( '\n' );
|
Putc( '\n' );
|
||||||
PrintSpace( _depth );
|
PrintSpace( _depth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_firstElement = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XMLPrinter::OpenElement( const char* name, bool compactMode )
|
||||||
|
{
|
||||||
|
PrepareForNewNode( compactMode );
|
||||||
|
_stack.Push( name );
|
||||||
|
|
||||||
Write ( "<" );
|
Write ( "<" );
|
||||||
Write ( name );
|
Write ( name );
|
||||||
|
|
||||||
_elementJustOpened = true;
|
_elementJustOpened = true;
|
||||||
_firstElement = false;
|
|
||||||
++_depth;
|
++_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2850,12 +2861,7 @@ void XMLPrinter::PushText( double value )
|
|||||||
|
|
||||||
void XMLPrinter::PushComment( const char* comment )
|
void XMLPrinter::PushComment( const char* comment )
|
||||||
{
|
{
|
||||||
SealElementIfJustOpened();
|
PrepareForNewNode( _compactMode );
|
||||||
if ( _textDepth < 0 && !_firstElement && !_compactMode) {
|
|
||||||
Putc( '\n' );
|
|
||||||
PrintSpace( _depth );
|
|
||||||
}
|
|
||||||
_firstElement = false;
|
|
||||||
|
|
||||||
Write( "<!--" );
|
Write( "<!--" );
|
||||||
Write( comment );
|
Write( comment );
|
||||||
@@ -2865,12 +2871,7 @@ void XMLPrinter::PushComment( const char* comment )
|
|||||||
|
|
||||||
void XMLPrinter::PushDeclaration( const char* value )
|
void XMLPrinter::PushDeclaration( const char* value )
|
||||||
{
|
{
|
||||||
SealElementIfJustOpened();
|
PrepareForNewNode( _compactMode );
|
||||||
if ( _textDepth < 0 && !_firstElement && !_compactMode) {
|
|
||||||
Putc( '\n' );
|
|
||||||
PrintSpace( _depth );
|
|
||||||
}
|
|
||||||
_firstElement = false;
|
|
||||||
|
|
||||||
Write( "<?" );
|
Write( "<?" );
|
||||||
Write( value );
|
Write( value );
|
||||||
@@ -2880,12 +2881,7 @@ void XMLPrinter::PushDeclaration( const char* value )
|
|||||||
|
|
||||||
void XMLPrinter::PushUnknown( const char* value )
|
void XMLPrinter::PushUnknown( const char* value )
|
||||||
{
|
{
|
||||||
SealElementIfJustOpened();
|
PrepareForNewNode( _compactMode );
|
||||||
if ( _textDepth < 0 && !_firstElement && !_compactMode) {
|
|
||||||
Putc( '\n' );
|
|
||||||
PrintSpace( _depth );
|
|
||||||
}
|
|
||||||
_firstElement = false;
|
|
||||||
|
|
||||||
Write( "<!" );
|
Write( "<!" );
|
||||||
Write( value );
|
Write( value );
|
||||||
|
|||||||
@@ -2338,6 +2338,11 @@ protected:
|
|||||||
DynArray< const char*, 10 > _stack;
|
DynArray< const char*, 10 > _stack;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
Prepares to write a new node. This includes sealing an element that was
|
||||||
|
just opened, and writing any whitespace necessary if not in compact mode.
|
||||||
|
*/
|
||||||
|
void PrepareForNewNode( bool compactMode );
|
||||||
void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities.
|
void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities.
|
||||||
|
|
||||||
bool _firstElement;
|
bool _firstElement;
|
||||||
|
|||||||
Reference in New Issue
Block a user