Commit 6ac1f8d5 authored by cutealien's avatar cutealien

Add IWriteFile::flush interface (thx @ JLouisB for the patch).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5114 dfc29bdd-3216-0410-991c-e03cc46cb475
parent a5325964
--------------------------
Changes in 1.9 (not yet released)
- Add IWriteFile::flush interface (thx @ JLouisB for the patch).
- CLightSceneNode::updateAbsolutePosition does now light recalculations. This is to fix using animators with lights.
- Fix collada export for objects with rotations around more than 1 axis.
- Add ISceneNodeAnimatorCameraMaya::setTargetMinDistance and getTargetMinDistance.
......
......@@ -38,6 +38,10 @@ namespace io
//! Get name of file.
/** \return File name as zero terminated character string. */
virtual const path& getFileName() const = 0;
//! Flush the content of the buffer in the file
/** \return True if successful, otherwise false. */
virtual bool flush() = 0;
};
} // end namespace io
......
......@@ -163,6 +163,10 @@ const io::path& CMemoryWriteFile::getFileName() const
return Filename;
}
bool CMemoryWriteFile::flush()
{
return true; // no buffering, so nothing to do
}
IReadFile* createMemoryReadFile(const void* memory, long size, const io::path& fileName, bool deleteMemoryWhenDropped)
{
......
......@@ -77,6 +77,8 @@ namespace io
//! returns name of file
virtual const io::path& getFileName() const _IRR_OVERRIDE_;
virtual bool flush() _IRR_OVERRIDE_;
private:
void *Buffer;
......
......@@ -105,7 +105,14 @@ const io::path& CWriteFile::getFileName() const
return Filename;
}
//! Flush the content of the buffer in the file
bool CWriteFile::flush()
{
if (!isOpen())
return false;
return !(bool) fflush(File);
}
IWriteFile* CWriteFile::createWriteFile(const io::path& fileName, bool append)
{
......
......@@ -38,6 +38,9 @@ namespace io
//! Returns name of file.
virtual const io::path& getFileName() const _IRR_OVERRIDE_;
//! Flush the content of the buffer in the file
virtual bool flush() _IRR_OVERRIDE_;
//! returns if file is open
bool isOpen() const;
......
......@@ -93,3 +93,7 @@ s32 CMemoryReadWriteFile::read(void* buffer, u32 sizeToRead)
return sizeToRead;
}
bool CMemoryReadWriteFile::flush()
{
return true; // no buffering, nothing to do
}
......@@ -55,6 +55,9 @@ namespace io
//! \return Returns the file name as zero terminated character string.
virtual const io::path& getFileName() const;
//! Flush the content of the buffer in the file
virtual bool flush() _IRR_OVERRIDE_;
//! Returns file data as an array
core::array<c8>& getData();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment