Add support to XMLDocument to save file in compact mode.

This commit is contained in:
Robert Reif 2012-09-08 19:33:57 -04:00
parent 77d7f206f6
commit 312a20fdd4
2 changed files with 6 additions and 6 deletions

View File

@ -1563,7 +1563,7 @@ int XMLDocument::LoadFile( FILE* fp )
} }
int XMLDocument::SaveFile( const char* filename ) int XMLDocument::SaveFile( const char* filename, bool compact )
{ {
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning ( push ) #pragma warning ( push )
@ -1577,15 +1577,15 @@ int XMLDocument::SaveFile( const char* filename )
SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 ); SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 );
return errorID; return errorID;
} }
SaveFile(fp); SaveFile(fp, compact);
fclose( fp ); fclose( fp );
return errorID; return errorID;
} }
int XMLDocument::SaveFile( FILE* fp ) int XMLDocument::SaveFile( FILE* fp, bool compact )
{ {
XMLPrinter stream( fp ); XMLPrinter stream( fp, compact );
Print( &stream ); Print( &stream );
return errorID; return errorID;
} }

View File

@ -1075,7 +1075,7 @@ public:
Returns XML_NO_ERROR (0) on success, or Returns XML_NO_ERROR (0) on success, or
an errorID. an errorID.
*/ */
int SaveFile( const char* filename ); int SaveFile( const char* filename, bool compact = false );
/** /**
Save the XML file to disk. You are responsible Save the XML file to disk. You are responsible
@ -1084,7 +1084,7 @@ public:
Returns XML_NO_ERROR (0) on success, or Returns XML_NO_ERROR (0) on success, or
an errorID. an errorID.
*/ */
int SaveFile( FILE* ); int SaveFile( FILE* fp, bool compact = false );
bool ProcessEntities() const { return processEntities; } bool ProcessEntities() const { return processEntities; }