SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
RWByteFromStreambufInputStreamImp Class Reference

Concrete class that connects a binary stream to an iostreams narrow character buffer. More...

#include <rw/stream/RWByteFromStreambufInputStreamImp.h>

Inheritance diagram for RWByteFromStreambufInputStreamImp:
RWByteInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

Public Member Functions

virtual ~RWByteFromStreambufInputStreamImp ()
 
virtual RWSize available () const
 
virtual void close ()
 
virtual bool isBad () const
 
virtual bool isEof () const
 
virtual bool isFail () const
 
virtual bool isGood () const
 
virtual RWByte read ()
 
virtual RWSize read (RWByte *byteArray, RWSize numBytes)
 
virtual RWSize readUntil (RWByte *byteArray, RWSize maxSize, RWByte delim)
 
virtual RWSize skip (RWSize numUnits)
 
- Public Member Functions inherited from RWByteInputStreamImp
virtual ~RWByteInputStreamImp ()
 
virtual RWByteInputStream acquire ()
 
virtual void release ()
 
- Public Member Functions inherited from RWInputStreamImp
virtual ~RWInputStreamImp ()
 
- Public Member Functions inherited from RWStreamImp
virtual ~RWStreamImp ()
 

Static Public Member Functions

static RWByteInputStream make (std::streambuf &source)
 

Protected Member Functions

 RWByteFromStreambufInputStreamImp (std::streambuf &sourceBuff)
 
std::streambuf & getSourceBuff ()
 
const std::streambuf & getSourceBuff () const
 
- Protected Member Functions inherited from RWByteInputStreamImp
 RWByteInputStreamImp ()
 
- Protected Member Functions inherited from RWInputStreamImp
 RWInputStreamImp ()
 
- Protected Member Functions inherited from RWStreamImp
 RWStreamImp ()
 
- Protected Member Functions inherited from RWBodyBase
 RWBodyBase (void)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (const RWBodyBase &second)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (unsigned initCount=0)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
RWTCountingBody< RWMutexLock > & operator= (const RWTCountingBody< RWMutexLock > &second)
 
 ~RWTCountingBody (void)
 
unsigned addReference (void)
 
unsigned references (void) const
 
unsigned removeReference (void)
 
- Protected Member Functions inherited from RWTMonitor< RWMutexLock >
 RWTMonitor ()
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (const RWTMonitor< RWMutexLock > &second)
 
 ~RWTMonitor ()
 
void acquire ()
 
bool isAcquired () const
 
RWTMonitor< RWMutexLock > & monitor () const
 
RWMutexLockmutex ()
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release ()
 
bool tryAcquire ()
 

Additional Inherited Members

- Protected Types inherited from RWTCountingBody< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 
- Protected Types inherited from RWTMonitor< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 

Detailed Description

Concrete class connecting a binary stream to an iostreams narrow character buffer. The iostreams buffer is used as the source for the data read from the binary stream. The iostreams buffer must be opened in binary mode. Implements the body idiom from the handle-body pattern.

Constructor & Destructor Documentation

virtual RWByteFromStreambufInputStreamImp::~RWByteFromStreambufInputStreamImp ( )
virtual

Destructor.

RWByteFromStreambufInputStreamImp::RWByteFromStreambufInputStreamImp ( std::streambuf &  sourceBuff)
inlineprotected

Initializes the reference to the iostreams std::streambuf, that will be used as the source of bytes. Throws no exceptions.

Parameters
sourceBuffThe iostreams std::streambuf that will serve as the source of bytes.

Member Function Documentation

virtual RWSize RWByteFromStreambufInputStreamImp::available ( ) const
virtual

Returns the number of bytes that can be read from the iostreams std::streambuf (used as the source of bytes), without blocking.

Implements RWInputStreamImp.

virtual void RWByteFromStreambufInputStreamImp::close ( )
virtual

This function does nothing. The user is responsible for closing the iostreams std::streambuf, used as the source of bytes, if necessary.

Implements RWStreamImp.

std::streambuf& RWByteFromStreambufInputStreamImp::getSourceBuff ( )
inlineprotected

Returns a reference to the iostreams std::streambuf, which is used as the source of bytes.

const std::streambuf& RWByteFromStreambufInputStreamImp::getSourceBuff ( ) const
inlineprotected

Returns a const reference to the iostreams std::streambuf, which is used as the source of bytes.

virtual bool RWByteFromStreambufInputStreamImp::isBad ( ) const
virtual

Returns true if the last operation performed on the iostreams std::streambuf failed.

Implements RWStreamImp.

virtual bool RWByteFromStreambufInputStreamImp::isEof ( ) const
virtual

Returns true if there is no bytes available from the iostreams std::streambuf, used as the source of bytes.

Implements RWInputStreamImp.

virtual bool RWByteFromStreambufInputStreamImp::isFail ( ) const
virtual

Returns true if the last operation performed on the iostreams std::streambuf failed.

Implements RWStreamImp.

virtual bool RWByteFromStreambufInputStreamImp::isGood ( ) const
virtual

Returns true if the last operation performed on the iostreams std::streambuf succeeded.

Implements RWStreamImp.

static RWByteInputStream RWByteFromStreambufInputStreamImp::make ( std::streambuf &  source)
inlinestatic

Constructs an RWByteFromStreambufInputStreamImp instance that uses source as the source of bytes, and returns a handle to it. Throws no exceptions.

Parameters
sourceThe iostreams std::streambuf that is used as the source of bytes.
virtual RWByte RWByteFromStreambufInputStreamImp::read ( )
virtual

Reads a single byte from the iostreams std::streambuf, used as the source of bytes.

Exceptions
RWExternalStreamExceptionThrown when the call to the internal iostreams std::streambuf object fails or any propagated exceptions from that call occur.

Implements RWByteInputStreamImp.

virtual RWSize RWByteFromStreambufInputStreamImp::read ( RWByte byteArray,
RWSize  numBytes 
)
virtual

Reads an array of bytes from the iostreams std::streambuf, used as the source of bytes. The array must be pre-allocated to contain at least numBytes elements. The function returns the actual number of bytes extracted from the iostreams std::streambuf.

Exceptions
RWExternalStreamExceptionThrown when the call to the internal iostreams std::streambuf object fails or any propagated exceptions from that call occur.
Parameters
byteArrayPointer to the first element of the array.
numBytesNumber of bytes to be read from the stream.

Implements RWByteInputStreamImp.

virtual RWSize RWByteFromStreambufInputStreamImp::readUntil ( RWByte byteArray,
RWSize  maxSize,
RWByte  delim 
)
virtual

Reads bytes from the iostreams std::streambuf, used as the source of bytes, until the last byte read is equal to delim, or maxSize bytes have been read, or the end of the input sequence is reached. The bytes read are stored in byteArray. The function returns the actual number of bytes inserted into byteArray. If the last byte extracted is equal to delim, then it is not stored in byteArray.

Parameters
byteArrayPointer to the array receiving the bytes extracted from the iostreams std::streambuf.
maxSizeMaximum number of bytes to be read.
delimByte value used as a delimiter.

Implements RWByteInputStreamImp.

virtual RWSize RWByteFromStreambufInputStreamImp::skip ( RWSize  numUnits)
virtual

Skips numUnits bytes from the input sequence if possible. The function returns the actual number of bytes skipped, which can be any value between 0 and numUnits.

Parameters
numUnitsThe number of bytes to be skipped.

Implements RWInputStreamImp.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.