TalanSoft Toolkits  201707
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Public Attributes | List of all members
sWriteBufferToFile Struct Reference

Detailed Description

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
 

Constructor & Destructor Documentation

sWriteBufferToFile ( iFile apFile,
tSize  anSize 
)

Member Function Documentation

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.

tPtr begin ( )
tSize size ( ) const

Member Data Documentation

Ptr<iFile> _file
tPtr _ownedMemory
tPtr _memory
tSize _size