GStream Class Reference

Virtual base class for a data source or sink. More...

#include <GStream.h>

Inheritance diagram for GStream:

GDom GBytePipe GFile GMemStream GSocket GStringPipe

List of all members.

Public Member Functions

virtual int Open (char *Str=0, int Int=0)
virtual bool IsOpen ()
 Returns true is the connection is still open.
virtual int Close ()
virtual int64 GetSize ()
 Gets the size of the stream.
virtual int64 SetSize (int64 Size)
 Sets the size of the stream.
virtual int64 GetPos ()
 Gets the current position of the stream.
virtual int64 SetPos (int64 Pos)
 Sets the current position of the stream.
virtual int Read (void *Buffer, int Size, int Flags=0)
 Read bytes out of the stream.
virtual int Write (void *Buffer, int Size, int Flags=0)
 Write bytes to the stream.
virtual GStreamI * Clone ()
 Creates a dynamically allocated copy of the same type of stream. This new stream is not connected to anything.
virtual int Print (char *Format,...)
 Formats a string and then writes it.


Detailed Description

Virtual base class for a data source or sink.

Defines the API for all the streaming data classes. Allows applications to plug different types of date streams into functions that take a GStream. Typically this means being able to swap files with sockets or data buffers etc.


Member Function Documentation

virtual GStreamI* GStream::Clone (  )  [inline, virtual]

Creates a dynamically allocated copy of the same type of stream. This new stream is not connected to anything.

Returns:
The new stream or NULL on error.

Reimplemented in GMemStream.

virtual int GStream::Close (  )  [inline, virtual]

Closes the connection

Returns:
> zero on success

Reimplemented in GFile, GMemStream, GSocket, and GFile.

Referenced by GdcBmp::WriteImage().

virtual int64 GStream::GetPos (  )  [inline, virtual]

Gets the current position of the stream.

Returns:
Current position or -1 on error (e.g. the position is not known)

Reimplemented in GFile, GMemStream, and GSocket.

Referenced by GdcBmp::ReadImage().

virtual int64 GStream::GetSize (  )  [inline, virtual]

Gets the size of the stream.

Returns:
The size or -1 on error (e.g. the information is not available)

Reimplemented in GBytePipe, GFile, GMemStream, GSocket, and GFile.

Referenced by GdcBmp::ReadImage(), and GProcess::Run().

virtual int GStream::Open ( char *  Str = 0,
int  Int = 0 
) [inline, virtual]

Open a connection

Returns:
> zero on success
Parameters:
Str  A string connection parameter
Int  An integer connection parameter

Reimplemented in GFile, GMemStream, GSocket, and GFile.

virtual int GStream::Read ( void *  Buffer,
int  Size,
int  Flags = 0 
) [inline, virtual]

Read bytes out of the stream.

Returns:
> 0 on succes, which indicates the number of bytes read

Reimplemented in GBytePipe, GFile, GMemStream, and GSocket.

Referenced by GTarParser::Process(), GdcBmp::ReadImage(), and GProcess::Run().

virtual int64 GStream::SetPos ( int64  Pos  )  [inline, virtual]

Sets the current position of the stream.

Returns:
The new current position or -1 on error (e.g. the position can't be set)

Reimplemented in GFile, GMemStream, and GSocket.

Referenced by GdcBmp::ReadImage().

virtual int64 GStream::SetSize ( int64  Size  )  [inline, virtual]

Sets the size of the stream.

Returns:
The new size or -1 on error (e.g. the size is not set-able)

Reimplemented in GFile, GMemStream, and GSocket.

Referenced by GdcBmp::WriteImage().

virtual int GStream::Write ( void *  Buffer,
int  Size,
int  Flags = 0 
) [inline, virtual]

Write bytes to the stream.

Returns:
> 0 on succes, which indicates the number of bytes written

Reimplemented in GBytePipe, GFile, GMemStream, and GSocket.

Referenced by Print(), GBytePipe::Push(), GProcess::Run(), and GdcBmp::WriteImage().


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

Generated on Wed Dec 1 15:41:04 2010 for Lgi by  doxygen 1.5.7.1