Public Member Functions
imagen::iFileStream Class Reference

File stream. More...

#include <iDataStream.h>

Inheritance diagram for imagen::iFileStream:
imagen::iDataStream

List of all members.

Public Member Functions

 iFileStream ()
 Default constructor.
 iFileStream (const char *filename, iFileMode mode)
 Convenience constructor.
 ~iFileStream ()
 Destructor.
bool open (const char *filename, iFileMode 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.
int getc ()
 Reads a character from the stream.
int putc (int chr)
 Writes a character to the stream.
bool flush ()
 Flushes the stream.
long size () const
 Returns the size of the stream.
long tell () const
 Returns the current value of the stream's position indicator.
bool seek (long offset, iDataSeek 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 stream.


Constructor & Destructor Documentation

Default constructor.

imagen::iFileStream::iFileStream ( const char *  filename,
iFileMode  mode 
)

Convenience constructor.

Opens a file from disk.

See also:
open()

Destructor.

Closes the file associated with this stream.

See also:
close()

Member Function Documentation

bool imagen::iFileStream::open ( const char *  filename,
iFileMode  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 imagen::iFileStream::close ( ) [virtual]

Closes the file associated with this stream.

Even though the stream is closed on destruction, it's still good practice to call this function when you're done with the stream.

Returns:
True if the file was closed successfully, else false.

Implements imagen::iDataStream.

long imagen::iFileStream::read ( void *  data,
long  size,
long  count 
) [virtual]

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.

Implements imagen::iDataStream.

long imagen::iFileStream::write ( const void *  data,
long  size,
long  count 
) [virtual]

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.

Implements imagen::iDataStream.

int imagen::iFileStream::getc ( ) [virtual]

Reads a character from the stream.

Returns:
If successful, the character read as an integer value, else 0.

Implements imagen::iDataStream.

int imagen::iFileStream::putc ( int  chr) [virtual]

Writes a character to the stream.

Returns:
If successful, the character that was written, else 0.

Implements imagen::iDataStream.

bool imagen::iFileStream::flush ( ) [virtual]

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.

Implements imagen::iDataStream.

long imagen::iFileStream::size ( ) const [inline, virtual]

Returns the size of the stream.

Implements imagen::iDataStream.

long imagen::iFileStream::tell ( ) const [virtual]

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

Implements imagen::iDataStream.

bool imagen::iFileStream::seek ( long  offset,
iDataSeek  origin 
) [virtual]

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.

Implements imagen::iDataStream.

bool imagen::iFileStream::atEnd ( ) const [virtual]

Checks if the end of the stream has been reached.

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

Implements imagen::iDataStream.


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