Provides a buffer which directly access the file's memory if its a memory file, otherwise return a temporary buffer that is written to the file when commit() is called or the buffer is destructed.
Example usage: sWriteBufferToFile buffer(apFile, olen); tSize bytesWritten = WriteSomethingToBuffer(buffer.begin(),buffer.size()); if (buffer.commit(bytesWritten) == bytesWritten) { ... data are now guaranteed to be written to the file ... }
Public Member Functions | |
| sWriteBufferToFile (iFile *apFile, tSize anSize) | |
| ~sWriteBufferToFile () | |
| tSize | commit (tInt aCommitSize) |
| Commit (write) the data to the file if its not a memory file. Can only be called successfuly once. Its automatically called by the destructor but its recommended to commit manually and check that all the data have been written. More... | |
| tPtr | begin () |
| tSize | size () const |
Public Attributes | |
| Ptr< iFile > | _file |
| tPtr | _ownedMemory |
| tPtr | _memory |
| tSize | _size |
| sWriteBufferToFile | ( | iFile * | apFile, |
| tSize | anSize | ||
| ) |
| ~sWriteBufferToFile | ( | ) |
Commit (write) the data to the file if its not a memory file. Can only be called successfuly once. Its automatically called by the destructor but its recommended to commit manually and check that all the data have been written.
| tPtr begin | ( | ) |
| tSize size | ( | ) | const |
| tPtr _ownedMemory |
| tPtr _memory |
| tSize _size |
1.8.7