FS::File Class Reference

Open file on the filesystem. This is virtual class that is used to define interface to files. More...

#include <vfs.h>

List of all members.

Public Member Functions

 File ()
 Construct file object and open the file. You won't usually call constructor on your own: File objects are created using "object factory" methods of FileSystem objects like OpenFileRead() or CreateFile().

virtual ~File ()
 Destroy file object and close the file.

virtual int read (void *buf, int count)=0
 Read specified amount of bytes from file into user-specified buffer. Internal file pointer is updated. If you try to read past end of file - will read only the remainder of the file, and returned value will be less than requested count. buf - User specified buffer count - count of bytes to read.

virtual int write (void *buf, int count)=0
 Write specified amount of bytes from user-specified buffer to file. Internal file pointer is updated. If you try to write past end of file - will try to expand the file. Sometimes it's not possible (out of disk space, or other limitations of the file system that this file is bound to). Exception will be thrown in these cases. buf - User specified buffer count - count of bytes to read.

virtual long seek (long offset)=0
 Attempt to seek in file. Seek offset is always defined as absolute from beginning of file.

virtual long get_pos ()=0
 Retrieve current file pointer offset from start of file. The offset is counted in bytes.

virtual long get_size ()=0
 Retrieve current file size in bytes.

int safe_read (void *buf, int count)
 Exactly the same as read(), but in case of attempt to read past end of file will throw exception.

int safe_write (void *buf, int count)
 Exactly the same as write(), but in case write() could not complete (written less than requested) - will throw an exception.


Detailed Description

Open file on the filesystem. This is virtual class that is used to define interface to files.


Constructor & Destructor Documentation

FS::File::File  )  [inline]
 

Construct file object and open the file. You won't usually call constructor on your own: File objects are created using "object factory" methods of FileSystem objects like OpenFileRead() or CreateFile().

virtual FS::File::~File  )  [inline, virtual]
 

Destroy file object and close the file.


Member Function Documentation

virtual int FS::File::read void *  buf,
int  count
[pure virtual]
 

Read specified amount of bytes from file into user-specified buffer. Internal file pointer is updated. If you try to read past end of file - will read only the remainder of the file, and returned value will be less than requested count. buf - User specified buffer count - count of bytes to read.

virtual int FS::File::write void *  buf,
int  count
[pure virtual]
 

Write specified amount of bytes from user-specified buffer to file. Internal file pointer is updated. If you try to write past end of file - will try to expand the file. Sometimes it's not possible (out of disk space, or other limitations of the file system that this file is bound to). Exception will be thrown in these cases. buf - User specified buffer count - count of bytes to read.

virtual long FS::File::seek long  offset  )  [pure virtual]
 

Attempt to seek in file. Seek offset is always defined as absolute from beginning of file.

virtual long FS::File::get_pos  )  [pure virtual]
 

Retrieve current file pointer offset from start of file. The offset is counted in bytes.

virtual long FS::File::get_size  )  [pure virtual]
 

Retrieve current file size in bytes.

int FS::File::safe_read void *  buf,
int  count
[inline]
 

Exactly the same as read(), but in case of attempt to read past end of file will throw exception.

int FS::File::safe_write void *  buf,
int  count
[inline]
 

Exactly the same as write(), but in case write() could not complete (written less than requested) - will throw an exception.


The documentation for this class was generated from the following file:
Generated on Sun May 1 17:34:30 2005 for RealityStrike Game Engine API by doxygen 1.3.6