Added File::Write(ByteArray)

Former-commit-id: 7f064cc17d940b5d2e3229264598cb0f1c778c80
This commit is contained in:
Lynix 2013-08-03 17:13:34 +02:00
parent ccb3adfc1c
commit ae53b01ca1
2 changed files with 8 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#define NAZARA_FILE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/Directory.hpp>
#include <Nazara/Core/Endianness.hpp>
#include <Nazara/Core/Hashable.hpp>
@ -88,6 +89,7 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
bool SetFile(const NzString& filePath);
bool SetOpenMode(unsigned int openMode);
bool Write(const NzByteArray& byteArray);
bool Write(const NzString& string);
std::size_t Write(const void* buffer, std::size_t typeSize, unsigned int count);

View File

@ -398,10 +398,14 @@ bool NzFile::SetOpenMode(unsigned int openMode)
return true;
}
bool NzFile::Write(const NzByteArray& byteArray)
{
unsigned int size = byteArray.GetSize();
return Write(byteArray.GetConstBuffer(), 1, size) == size;
}
bool NzFile::Write(const NzString& string)
{
NazaraLock(m_mutex)
NzString temp(string);
if (m_streamOptions & nzStreamOption_Text)