From 312a20fdd4c2af6e7a7fe1b5824785a8b9bfd872 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sat, 8 Sep 2012 19:33:57 -0400 Subject: [PATCH] Add support to XMLDocument to save file in compact mode. --- tinyxml2.cpp | 8 ++++---- tinyxml2.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 8069d04..86a76a9 100644 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -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) #pragma warning ( push ) @@ -1577,15 +1577,15 @@ int XMLDocument::SaveFile( const char* filename ) SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 ); return errorID; } - SaveFile(fp); + SaveFile(fp, compact); fclose( fp ); return errorID; } -int XMLDocument::SaveFile( FILE* fp ) +int XMLDocument::SaveFile( FILE* fp, bool compact ) { - XMLPrinter stream( fp ); + XMLPrinter stream( fp, compact ); Print( &stream ); return errorID; } diff --git a/tinyxml2.h b/tinyxml2.h index e1c22c5..18555ca 100644 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -1075,7 +1075,7 @@ public: Returns XML_NO_ERROR (0) on success, or an errorID. */ - int SaveFile( const char* filename ); + int SaveFile( const char* filename, bool compact = false ); /** Save the XML file to disk. You are responsible @@ -1084,7 +1084,7 @@ public: Returns XML_NO_ERROR (0) on success, or an errorID. */ - int SaveFile( FILE* ); + int SaveFile( FILE* fp, bool compact = false ); bool ProcessEntities() const { return processEntities; }