Rocket::Core::FileInterface Class Reference

#include <FileInterface.h>

Inheritance diagram for Rocket::Core::FileInterface:
Collaboration diagram for Rocket::Core::FileInterface:

Public Member Functions

virtual FileHandle Open (const String &path)=0
virtual void Close (FileHandle file)=0
virtual size_t Read (void *buffer, size_t size, FileHandle file)=0
virtual bool Seek (FileHandle file, long offset, int origin)=0
virtual size_t Tell (FileHandle file)=0
virtual void Release ()
 Called when this file interface is released.

Protected Member Functions

virtual void OnReferenceDeactivate ()
 A hook method called when the reference count drops to 0.

Detailed Description

The abstract base class for application-specific file I/O.

By default, Rocket will use a file interface implementing the standard C file functions. If this is not sufficient, or your application wants more control over file I/O, this class should be derived, instanced, and installed through Core::SetFileInterface() before you initialise Rocket.

Author:
Peter Curry

Member Function Documentation

virtual FileHandle Rocket::Core::FileInterface::Open ( const String path  )  [pure virtual]

Opens a file.

Parameters:
file The file handle to write to.
Returns:
A valid file handle, or NULL on failure

Implemented in Rocket::Core::FileInterfaceDefault.

virtual void Rocket::Core::FileInterface::Close ( FileHandle  file  )  [pure virtual]

Closes a previously opened file.

Parameters:
file The file handle previously opened through Open().

Implemented in Rocket::Core::FileInterfaceDefault.

virtual size_t Rocket::Core::FileInterface::Read ( void *  buffer,
size_t  size,
FileHandle  file 
) [pure virtual]

Reads data from a previously opened file.

Parameters:
buffer The buffer to be read into.
size The number of bytes to read into the buffer.
file The handle of the file.
Returns:
The total number of bytes read into the buffer.

Implemented in Rocket::Core::FileInterfaceDefault.

virtual bool Rocket::Core::FileInterface::Seek ( FileHandle  file,
long  offset,
int  origin 
) [pure virtual]

Seeks to a point in a previously opened file.

Parameters:
file The handle of the file to seek.
offset The number of bytes to seek.
origin One of either SEEK_SET (seek from the beginning of the file), SEEK_END (seek from the end of the file) or SEEK_CUR (seek from the current file position).
Returns:
True if the operation completed successfully, false otherwise.

Implemented in Rocket::Core::FileInterfaceDefault.

virtual size_t Rocket::Core::FileInterface::Tell ( FileHandle  file  )  [pure virtual]

Returns the current position of the file pointer.

Parameters:
file The handle of the file to be queried.
Returns:
The number of bytes from the origin of the file.

Implemented in Rocket::Core::FileInterfaceDefault.


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