BinaryFile Class Reference

BinaryFile class. More...

Inherits Simba::Support::IFile.

Inherited by SwapFile.

List of all members.

Public Member Functions

 BinaryFile (const simba_wstring &in_filename, simba_filehandle in_handle)
 Constructor. Wraps an existing file handle. The BinayFile does not take ownership of the file handle.
 BinaryFile (const simba_wstring &in_filename, FileOpenMode in_openmode)
 Constructor.
virtual void Clear ()
 Erase contents of the current file, setting the size to 0.
virtual void Close ()
 Closes this file.
virtual void Delete ()
 Closes and deletes this file.
virtual simba_int64 Extend (simba_int64 in_size)
 Extend the file to a size of precisely length bytes. If the file previously was shorter, it is extended, and the content of extended part is not defined. If the file was same size, it is not extended and the actual size of the file is returned. If the file previously was larger than this size, return -1.
virtual void Flush ()
 Flush text to file.
const simba_wstringGetName () const
 Gets the file name.
virtual simba_int64 GetPosition ()
 Gets current file position.
virtual bool IsOpen ()
 Determines if file is currently open.
virtual simba_int64 Read (void *io_buffer, simba_int64 in_size)
virtual bool ReOpen (FileOpenMode in_openmode)
 Re-open wrapped file handle with new mode.
virtual simba_int64 Seek (simba_int64 in_position, SeekDirection in_direction)
 Navigate to the certain position within file.
virtual simba_int64 Write (const void *in_buffer, simba_int64 in_size)
 Write text from buffer to the file.
virtual ~BinaryFile ()
 Destructor.

Protected Attributes

simba_filehandle m_fileHandle
simba_wstring m_fileName
bool m_shouldCloseFile

Detailed Description

BinaryFile class.


Constructor & Destructor Documentation

BinaryFile ( const simba_wstring in_filename,
FileOpenMode  in_openmode 
)

Constructor.

Parameters:
in_filename The name of the file to open.
in_openmode The open mode for the file.
BinaryFile ( const simba_wstring in_filename,
simba_filehandle  in_handle 
)

Constructor. Wraps an existing file handle. The BinayFile does not take ownership of the file handle.

Parameters:
in_filename The name of the file associated with the handle.
in_handle The file handle to wrap. This does not get closed on destruction.
virtual ~BinaryFile (  )  [virtual]

Destructor.


Member Function Documentation

virtual void Clear (  )  [virtual]

Erase contents of the current file, setting the size to 0.

Exceptions:
ErrorException if there was an error clearing the file.

Implements IFile.

Reimplemented in SwapFile.

virtual void Close (  )  [virtual]

Closes this file.

Implements IFile.

Reimplemented in SwapFile.

virtual void Delete (  )  [virtual]

Closes and deletes this file.

Reimplemented in SwapFile.

virtual simba_int64 Extend ( simba_int64  in_size  )  [virtual]

Extend the file to a size of precisely length bytes. If the file previously was shorter, it is extended, and the content of extended part is not defined. If the file was same size, it is not extended and the actual size of the file is returned. If the file previously was larger than this size, return -1.

Parameters:
in_size New size in bytes.
Returns:
The new size of the file or -1.

Implements IFile.

virtual void Flush (  )  [virtual]

Flush text to file.

Implements IFile.

const simba_wstring& GetName (  )  const [virtual]

Gets the file name.

Returns:
The name of the binary file.

Implements IFile.

virtual simba_int64 GetPosition (  )  [virtual]

Gets current file position.

Returns:
Absolute position from the beginning of the file. Returns -1 on error.

Implements IFile.

Reimplemented in SwapFile.

virtual bool IsOpen (  )  [virtual]

Determines if file is currently open.

Returns:
True if file is open; false otherwise.

Implements IFile.

virtual simba_int64 Read ( void *  io_buffer,
simba_int64  in_size 
) [virtual]

Read from the file into buffer.

Parameters:
io_buffer Buffer to read into.
in_size Size of the provided buffer.
Returns:
Number of bytes read.

Implements IFile.

Reimplemented in SwapFile.

virtual bool ReOpen ( FileOpenMode  in_openmode  )  [virtual]

Re-open wrapped file handle with new mode.

Parameters:
in_openmode Open mode as defined in OPENMODE enum.
Returns:
true on success; false otherwise.

Implements IFile.

Reimplemented in SwapFile.

virtual simba_int64 Seek ( simba_int64  in_position,
SeekDirection  in_direction 
) [virtual]

Navigate to the certain position within file.

Parameters:
in_position Offset from the current position.
in_direction Direction.
Returns:
Absolute position from the beginning of the file. Returns -1 on error.

Implements IFile.

Reimplemented in SwapFile.

virtual simba_int64 Write ( const void *  in_buffer,
simba_int64  in_size 
) [virtual]

Write text from buffer to the file.

Parameters:
in_buffer Buffer containing text to write.
in_size Size of the provided buffer.
Returns:
Number of bytes written.

Implements IFile.

Reimplemented in SwapFile.


Member Data Documentation

bool m_shouldCloseFile [protected]

The documentation for this class was generated from the following file:

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba