ByteStream::Wrapper Class Reference

#include <ByteStream.h>

Inheritance diagram for ByteStream::Wrapper:

ByteStream GPEnabled IFFByteStream List of all members.

Detailed Description

ByteStream::Wrapper implements wrapping bytestream.

This is useful for derived classes that take a GP<ByteStream> as a creation argument, and the backwards compatible bytestreams.

Definition at line 381 of file ByteStream.h.


Public Member Functions

 ~Wrapper ()
ByteStreamoperator & () const
ByteStreamoperator & ()
virtual size_t read (void *buffer, size_t size)
virtual size_t write (const void *buffer, size_t size)
virtual long tell (void) const
virtual int seek (long offset, int whence=SEEK_SET, bool nothrow=false)
virtual void flush (void)

Protected Member Functions

 Wrapper (void)
 Wrapper (const GP< ByteStream > &xbs)

Protected Attributes

GP< ByteStreamgbs
ByteStreambs

Member Function Documentation

virtual void ByteStream::Wrapper::flush ( void   )  [inline, virtual]

Flushes all buffers in the ByteStream.

Calling this function guarantees that pending data have been actually written (i.e. passed to the operating system). Class ByteStream# provides a default implementation which does nothing.

Reimplemented from ByteStream.

Reimplemented in IFFByteStream.

Definition at line 400 of file ByteStream.h.

virtual size_t ByteStream::Wrapper::read ( void *  buffer,
size_t  size 
) [inline, virtual]

Reads data from a ByteStream.

This function {must} be implemented by each subclass of ByteStream#. At most size# bytes are read from the ByteStream and stored in the memory area pointed to by buffer#. Function read# returns immediately if size# is zero. The actual number of bytes read is returned. Function read# returns a number of bytes smaller than size# if the end-of-file mark is reached before filling the buffer. Subsequent invocations will always return value #0#. Function read# may also return a value greater than zero but smaller than size# for internal reasons. Programs must be ready to handle these cases or use function readall}. Exception GException} is thrown with a plain text error message whenever an error occurs.

Reimplemented from ByteStream.

Reimplemented in IFFByteStream.

Definition at line 392 of file ByteStream.h.

virtual int ByteStream::Wrapper::seek ( long  offset,
int  whence = SEEK_SET,
bool  nothrow = false 
) [inline, virtual]

Sets the current position for reading or writing the ByteStream.

Class ByteStream# provides a default implementation able to seek forward by calling function read# until reaching the desired position. Subclasses implementing better seek capabilities must override this default implementation. The new current position is computed by applying displacement offset# to the position represented by argument whence#. The following values are recognized for argument whence#: {description} [SEEK_SET#] Argument offset# indicates the position relative to the beginning of the ByteStream. [SEEK_CUR#] Argument offset# is a signed displacement relative to the current position. [SEEK_END#] Argument offset# is a displacement relative to the end of the file. It is then advisable to provide a negative value for offset#. {description} Results are undefined whenever the new position is greater than the total size of the ByteStream.

{ Error reporting}: If seek()# succeeds, #0# is returned. Otherwise it either returns #-1# (if nothrow# is set to FALSE#) or throws the GException} exception.

Reimplemented from ByteStream.

Definition at line 398 of file ByteStream.h.

virtual long ByteStream::Wrapper::tell ( void   )  const [inline, virtual]

Returns the offset of the current position in the ByteStream.

This function {must} be implemented by each subclass of ByteStream#.

Implements ByteStream.

Reimplemented in IFFByteStream.

Definition at line 396 of file ByteStream.h.

virtual size_t ByteStream::Wrapper::write ( const void *  buffer,
size_t  size 
) [inline, virtual]

Writes data to a ByteStream.

This function {must} be implemented by each subclass of ByteStream#. At most size# bytes from buffer buffer# are written to the ByteStream. Function write# returns immediately if size# is zero. The actual number of bytes written is returned. Function write# may also return a value greater than zero but smaller than size# for internal reasons. Programs must be ready to handle these cases or use function writall}. Exception GException} is thrown with a plain text error message whenever an error occurs.

Reimplemented from ByteStream.

Reimplemented in IFFByteStream.

Definition at line 394 of file ByteStream.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys