Main Page   Modules   Class Hierarchy   Compound List   Compound Members  

GAUGE3D::GDiskFile Class Reference

Access to files on disk. More...

#include <gauge3d/files/diskfile.h>

Inherits GAUGE3D::GFile.

List of all members.

Public Types

enum  tOpenFlags { NOCREATE = 0, CREATE = 1 << 8, NOREPLACE = 1 << 9, TRUNCATE = 1 << 10 }
 Flags specified with Open(). More...


Public Methods

 GDiskFile ()
 Create without openning a file.

 GDiskFile (GString filename,int flags)
 Create and open a file. More...

virtual ~GDiskFile ()
 Close the file.

bool Open (GString filename,int flags)
 Create and open a file. More...

void Close ()
 Close the file.

bool IsOpen ()
 Returns true if the file is open.

virtual int Size ()
 Gets the size of the file in bytes.

virtual bool Truncate ()
 Truncates the file to zero length. Returns false if file was not writable.

virtual pGRawIStream GetRawInputStream ()
 Get a GRawIStream for the file. May be null if the file is not readable.

virtual pGRawOStream GetRawOutputStream ()
 Get a GRawOStream for the file. May be null if the file is not writeable.

virtual pFileMap Map (int offset,int size,int flags)
 Maps a portion of the file to memory. More...

virtual GString MapToDisk ()
 Copies the file to a temporary file on disk, if it is not already on the disk. More...

virtual GString Name ()
 Get the name of the file. More...


Detailed Description

Access to files on disk.


Member Enumeration Documentation

enum GAUGE3D::GDiskFile::tOpenFlags
 

Flags specified with Open().

Enumeration values:
NOCREATE   Fail if the file does not exist.
CREATE   Create the file if it does not exist.
NOREPLACE   Fail if the file already exists.
TRUNCATE   Truncate the file to zero length if it exists.


Constructor & Destructor Documentation

GAUGE3D::GDiskFile::GDiskFile ( GString filename,
int flags )
 

Create and open a file.

Parameters:
filename   The path and name of the file to open.
flags   One or more of tOpenFlags, bitwise or'd.


Member Function Documentation

bool GAUGE3D::GDiskFile::Open ( GString filename,
int flags )
 

Create and open a file.

Parameters:
filename   The path and name of the file to open.
flags   One or more of tOpenFlags, bitwise or'd.
Returns:
True on success, false on error.

virtual pFileMap GAUGE3D::GDiskFile::Map ( int offset,
int size,
int flags ) [virtual]
 

Maps a portion of the file to memory.

Parameters:
offset   Where to start the map relative to the beginning of the file.
size   How many bytes to map to memory.
flags   One or more of tMapFlags, bitwise or'd.
Returns:
A pointer to a FileMap class describing the map, or NULL if the file could not be mapped.

Reimplemented from GAUGE3D::GFile.

virtual GString GAUGE3D::GDiskFile::MapToDisk ( ) [virtual]
 

Copies the file to a temporary file on disk, if it is not already on the disk.

Returns:
The path and name of the file on disk.

You should not write to the file on disk as other parts of the engine may be reading from it as well. The file on disk will be deleted when the GFile that created it is deleted (unless the file was on the disk to begin with).

Remarks:
Do not use this if you can avoid it. It is mainly meant for use with GLibrary, which must load shared libraries from disk due to the limitations of the library loading functions of every operating system I know of.

Reimplemented from GAUGE3D::GFile.

virtual GString GAUGE3D::GDiskFile::Name ( ) [virtual]
 

Get the name of the file.

Note:
This is not always the same as the name of the directory entry that points to the file, especially if the file is in a virtual filesystem.

Reimplemented from GAUGE3D::GFile.


The documentation for this class was generated from the following file:
Generated at Tue Jan 30 17:07:34 2001 for gauge3d by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000