kviewshell
ByteStream::Wrapper Class Reference
ByteStream::Wrapper implements wrapping bytestream. More...
#include <ByteStream.h>
Public Member Functions | |
virtual void | flush (void) |
ByteStream * | operator& () |
ByteStream * | operator& () const |
virtual size_t | read (void *buffer, size_t size) |
virtual int | seek (long offset, int whence=SEEK_SET, bool nothrow=false) |
virtual long | tell (void) const |
virtual size_t | write (const void *buffer, size_t size) |
~Wrapper () | |
Protected Member Functions | |
Wrapper (const GP< ByteStream > &xbs) | |
Wrapper (void) | |
Protected Attributes | |
ByteStream * | bs |
GP< ByteStream > | gbs |
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.
Constructor & Destructor Documentation
ByteStream::Wrapper::Wrapper | ( | void | ) | [inline, protected] |
Definition at line 386 of file ByteStream.h.
ByteStream::Wrapper::Wrapper | ( | const GP< ByteStream > & | xbs | ) | [inline, protected] |
Definition at line 387 of file ByteStream.h.
ByteStream::Wrapper::~Wrapper | ( | ) |
Definition at line 1287 of file ByteStream.cpp.
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.
ByteStream* ByteStream::Wrapper::operator& | ( | ) | [inline] |
Definition at line 391 of file ByteStream.h.
ByteStream* ByteStream::Wrapper::operator& | ( | ) | const [inline] |
Definition at line 390 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.
Member Data Documentation
ByteStream* ByteStream::Wrapper::bs [protected] |
Definition at line 385 of file ByteStream.h.
GP<ByteStream> ByteStream::Wrapper::gbs [protected] |
Definition at line 384 of file ByteStream.h.
The documentation for this class was generated from the following files: