Gel2D - The free/open source game creation suite

Public Member Functions
gel::GelFileStream Class Reference

File data stream. More...

#include <gelDataStream.h>

List of all members.

Public Member Functions

 GelFileStream ()
 Default constructor.
 GelFileStream (const GelString &filename, FileMode mode)
 Convenience constructor.
 ~GelFileStream ()
 Destructor.
bool open (const GelString &filename, FileMode mode)
 Opens a file from disk.
bool close ()
 Closes the file associated with this stream.
long read (void *data, long size, long count)
 Reads data from the stream.
long write (const void *data, long size, long count)
 Writes data to the stream.
bool flush ()
 Flushes the stream.
long getSize () const
 Gets the size of the file.
long tell () const
 Gets the current value of the stream's position indicator.
bool seek (long offset, DataSeek origin)
 Sets the position of the stream's position indicator.
bool atEnd () const
 Checks if the end of the stream has been reached.

Detailed Description

File data stream.


Constructor & Destructor Documentation

gel::GelFileStream::GelFileStream ( ) [inline]

Default constructor.

gel::GelFileStream::GelFileStream ( const GelString filename,
FileMode  mode 
)

Convenience constructor.

Opens a file from disk.

See also:
open()
gel::GelFileStream::~GelFileStream ( )

Destructor.

Closes the file associated with this stream.

See also:
close()

Member Function Documentation

bool gel::GelFileStream::open ( const GelString filename,
FileMode  mode 
)

Opens a file from disk.

Parameters:
filename: The name of the file to open.
mode: The mode to open the file with.
Returns:
True if successful, else false.
bool gel::GelFileStream::close ( )

Closes the file associated with this stream.

Returns:
True if the file was closed successfully, else false.
long gel::GelFileStream::read ( void *  data,
long  size,
long  count 
)

Reads data from the stream.

Parameters:
data: The array to place the read data into.
size: The size in bytes of each element to read.
count: The number of elements to read.
Returns:
The number of elements read.
long gel::GelFileStream::write ( const void *  data,
long  size,
long  count 
)

Writes data to the stream.

Parameters:
data: The array of data to write.
size: The size in bytes of each element to write.
count: The number of elements to write.
Returns:
The number of elements written.
bool gel::GelFileStream::flush ( )

Flushes the stream.

If the file was open for writing, any unwritten data in the buffer will be written to the file.

Returns:
True if successful, else false.
long gel::GelFileStream::getSize ( ) const [inline]

Gets the size of the file.

Returns:
The size of the file.
long gel::GelFileStream::tell ( ) const

Gets the current value of the stream's position indicator.

Returns:
If successful, the current value of the stream's position indicator, else 0.
bool gel::GelFileStream::seek ( long  offset,
DataSeek  origin 
)

Sets the position of the stream's position indicator.

Parameters:
offset: The new position relative to origin
origin: The reference position to add offset to.
Returns:
True if successful, else false.
bool gel::GelFileStream::atEnd ( ) const

Checks if the end of the stream has been reached.

Returns:
True if the end of the stream has been reached, else false.

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