IFile Class Reference

This class provides an interface for file classes. More...

Inherited by MemoryFile, BinaryFile, EncryptedRandomAccessFile, and TextFile.

List of all members.

Public Types

enum  SeekDirection { DIRECTION_FORWARD = 1, DIRECTION_BACKWARD = 2, DIRECTION_START = 3, DIRECTION_END = 4 }
 

An enumeration for seek directions.

More...

Public Member Functions

virtual void Clear ()=0
 Erase contents of the current file, setting the size to 0.
virtual void Close ()=0
 Closes this file.
virtual simba_int64 Extend (simba_int64 in_size)=0
 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 ()=0
 Flush data to file.
virtual const simba_wstringGetName () const =0
 Gets the file name.
virtual simba_int64 GetPosition ()=0
 Gets current file position.
virtual bool IsOpen ()=0
 Determines if file is currently open.
virtual simba_int64 Read (void *io_buffer, simba_int64 in_size)=0
 Read from the file into buffer.
void Release ()
 Decrease the reference count by 1.
virtual bool ReOpen (FileOpenMode in_openmode)=0
 Re-open file with new mode.
void Retain ()
 Increase the reference count by 1.
virtual simba_int64 Seek (simba_int64 in_position, SeekDirection in_direction)=0
 Navigate to the certain position within file.
virtual simba_int64 Write (const void *in_buffer, simba_int64 in_size)=0
 Write from buffer to the file.
virtual ~IFile ()
 Destructor.

Protected Member Functions

 IFile ()
 Constructor.

Detailed Description

This class provides an interface for file classes.


Member Enumeration Documentation

An enumeration for seek directions.

Enumerator:
DIRECTION_FORWARD 
DIRECTION_BACKWARD 
DIRECTION_START 
DIRECTION_END 

Constructor & Destructor Documentation

virtual ~IFile (  )  [inline, virtual]

Destructor.

IFile (  )  [inline, protected]

Constructor.


Member Function Documentation

virtual void Clear (  )  [pure virtual]

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

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

Implemented in MemoryFile, BinaryFile, EncryptedRandomAccessFile, SwapFile, and TextFile.

virtual void Close (  )  [pure virtual]

Closes this file.

Implemented in MemoryFile, BinaryFile, EncryptedRandomAccessFile, SwapFile, and TextFile.

virtual simba_int64 Extend ( simba_int64  in_size  )  [pure 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.

Implemented in BinaryFile, EncryptedRandomAccessFile, and TextFile.

virtual void Flush (  )  [pure virtual]

Flush data to file.

Implemented in MemoryFile, BinaryFile, EncryptedRandomAccessFile, and TextFile.

virtual const simba_wstring& GetName (  )  const [pure virtual]

Gets the file name.

Returns:
The name of the binary file.

Implemented in MemoryFile, BinaryFile, EncryptedRandomAccessFile, and TextFile.

virtual simba_int64 GetPosition (  )  [pure virtual]

Gets current file position.

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

Implemented in MemoryFile, BinaryFile, EncryptedRandomAccessFile, SwapFile, and TextFile.

virtual bool IsOpen (  )  [pure virtual]

Determines if file is currently open.

Returns:
true if file is open; false otherwise.

Implemented in MemoryFile, BinaryFile, EncryptedRandomAccessFile, and TextFile.

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

Read from the file into buffer.

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

Implemented in BinaryFile, EncryptedRandomAccessFile, SwapFile, and TextFile.

void Release (  )  [inline]

Decrease the reference count by 1.

This is part of the API to "qualify" as a shared object to be managed by SharedPtr. This default implementation is not thread-safe.

NOTE: This function is required since SwapFile is a type of object that can be managed by SharedPtr. Refer to SharedPtr.h for more information.

WARNING: This method is designed to be used by SharedPtr only. Never call this method directly.

virtual bool ReOpen ( FileOpenMode  in_openmode  )  [pure virtual]

Re-open file with new mode.

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

Implemented in MemoryFile, BinaryFile, EncryptedRandomAccessFile, SwapFile, and TextFile.

void Retain (  )  [inline]

Increase the reference count by 1.

This is part of the API to "qualify" as a shared object to be managed by SharedPtr. This default implementation is not thread-safe.

NOTE: This function is required since SwapFile is a type of object that can be managed by SharedPtr. Refer to SharedPtr.h for more information.

WARNING: This method is designed to be used by SharedPtr only. Never call this method directly.

virtual simba_int64 Seek ( simba_int64  in_position,
SeekDirection  in_direction 
) [pure 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.

Implemented in BinaryFile, EncryptedRandomAccessFile, SwapFile, and TextFile.

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

Write from buffer to the file.

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

Implemented in BinaryFile, EncryptedRandomAccessFile, SwapFile, and TextFile.


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

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