mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
************************************************************
* Merged Source Code from Development Trunk: Revision 4063 * ************************************************************ - Source Code is merged from: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP - This will be the Source for the Beta 2011 Test git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4064 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+18
-9
@@ -1,21 +1,30 @@
|
||||
#include "XMLWriter.h"
|
||||
#include "sgp_logger.h"
|
||||
|
||||
#include "VFS/vfs_file_raii.h"
|
||||
#include "VFS/File/vfs_file.h"
|
||||
#include <vfs/Core/vfs_file_raii.h>
|
||||
#include <vfs/Core/File/vfs_file.h>
|
||||
|
||||
void XMLWriter::addValue(utf8string const& key)
|
||||
void XMLWriter::addValue(vfs::String const& key)
|
||||
{
|
||||
m_ssBuffer << indent() << "<" << key.utf8();
|
||||
insertAttributesIntoBuffer();
|
||||
m_ssBuffer << " />\n";
|
||||
}
|
||||
|
||||
void XMLWriter::addComment(utf8string const& comment)
|
||||
void XMLWriter::addComment(vfs::String const& comment)
|
||||
{
|
||||
m_ssBuffer << indent() << "<!-- " << comment.utf8() << " -->\n";
|
||||
}
|
||||
|
||||
void XMLWriter::openNode(utf8string const& key)
|
||||
void XMLWriter::addFlag(UINT32 const& flags, UINT32 const& flag, vfs::String strFlag)
|
||||
{
|
||||
if( ( flags & flag) == flag )
|
||||
{
|
||||
this->addValue(strFlag);
|
||||
}
|
||||
}
|
||||
|
||||
void XMLWriter::openNode(vfs::String const& key)
|
||||
{
|
||||
std::string utf8key = key.utf8();
|
||||
m_ssBuffer << indent() << "<" << utf8key;
|
||||
@@ -49,9 +58,9 @@ bool XMLWriter::writeToFile(vfs::Path const& sFileName)
|
||||
vfs::COpenWriteFile file(sFileName,true,true);
|
||||
return writeToFile( &file.file() );
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(vfs::Exception& ex)
|
||||
{
|
||||
logException(ex);
|
||||
SGP_ERROR(ex.what());
|
||||
vfs::CFile file(sFileName);
|
||||
if(file.openWrite(true,true))
|
||||
{
|
||||
@@ -70,9 +79,9 @@ bool XMLWriter::writeToFile(vfs::tWritableFile* pFile)
|
||||
pFile->write(str.c_str(), str.length() * sizeof(std::string::value_type));
|
||||
return true;
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(vfs::Exception& ex)
|
||||
{
|
||||
logException(ex);
|
||||
SGP_ERROR(ex.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user