Public Member Functions
imagen::iMemoryStream Class Reference

Memory stream. More...

#include <iDataStream.h>

Inheritance diagram for imagen::iMemoryStream:
imagen::iDataStream

List of all members.

Public Member Functions

 iMemoryStream ()
 Default constructor.
 iMemoryStream (void *bdata, long bsize)
 Convenience constructor.
 ~iMemoryStream ()
 Destructor.
void deleteOnClose (bool del)
 Sets whether or not the memory buffer should be deleted when the stream is closed.
bool open (void *bdata, long bsize)
 Opens a memory buffer.
bool close ()
 Disassociate the memory buffer from this stream.
long read (void *bdata, long size, long count)
 Reads data from the stream.
long write (const void *bdata, 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

Memory stream.


Constructor & Destructor Documentation

Default constructor.

imagen::iMemoryStream::iMemoryStream ( void *  bdata,
long  bsize 
)

Convenience constructor.

Opens a memory buffer.

See also:
open()

Destructor.


Member Function Documentation

void imagen::iMemoryStream::deleteOnClose ( bool  del) [inline]

Sets whether or not the memory buffer should be deleted when the stream is closed.

By default, the buffer is not deleted.

Parameters:
del: True to delete the buffer, else false.
bool imagen::iMemoryStream::open ( void *  bdata,
long  bsize 
)

Opens a memory buffer.

Parameters:
bdata: The stream to open.
bsize: The size of the stream.
Returns:
True if successful, else false.
bool imagen::iMemoryStream::close ( ) [virtual]

Disassociate the memory buffer from 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 memory stream was closed successfully, else false.

Implements imagen::iDataStream.

long imagen::iMemoryStream::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::iMemoryStream::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::iMemoryStream::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::iMemoryStream::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::iMemoryStream::flush ( ) [virtual]

Flushes the stream.

This function currently does nothing.

Returns:
True if successful, else false.

Implements imagen::iDataStream.

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

Returns the size of the stream.

Implements imagen::iDataStream.

long imagen::iMemoryStream::tell ( ) const [inline, virtual]

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

Implements imagen::iDataStream.

bool imagen::iMemoryStream::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::iMemoryStream::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: