Main Page   Modules   Class Hierarchy   Compound List   Compound Members  

GAUGE3D::GStringFile Class Reference

File represented by a string. More...

#include <gauge3d/files/stringfile.h>

Inherits GAUGE3D::GFile.

List of all members.

Public Methods

 GStringFile ()
 Construct an empty file.

 GStringFile (GString data)
 Construct a GStringFile with the given contents.

virtual ~GStringFile ()
 Destructor.

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...

void Name (GString name)
 Set the internal name of the file.

void Data (GString data)
 Set the data contained by the file.

virtual operator GString ()
 Create a string containing the complete file. More...


Detailed Description

File represented by a string.

The data in a GStringFile is stored as a GString. The idea here is that we want a file which can easily be cast to a string. This is used heavily by GConfigFile, which loads config files into a virtual filesystem where directories are sections of the config file and files are individual settings.


Member Function Documentation

virtual pFileMap GAUGE3D::GStringFile::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::GStringFile::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.

GString GAUGE3D::GStringFile::Name ( ) [inline, 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.

GAUGE3D::GStringFile::operator GString ( ) [inline, virtual]
 

Create a string containing the complete file.

Remarks:
This function pretty much just calls Map and makes a string out of the results. Do not use this on large files. Note that derived classes may define their own implementation of this, but they are not required to.

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