SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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 (const RWBodyBase &second)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (void)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (unsigned initCount=0)
 
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 (const RWTMonitor< RWMutexLock > &second)
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (void)
 
 ~RWTMonitor (void)
 
void acquire (void)
 
bool isAcquired (void) const
 
RWTMonitor< RWMutexLock > & monitor (void) const
 
RWMutexLockmutex (void)
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release (void)
 
bool tryAcquire (void)
 

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

◆ ~RWByteFromStreambufInputStreamImp()

virtual RWByteFromStreambufInputStreamImp::~RWByteFromStreambufInputStreamImp ( )
virtual

Destructor.

◆ RWByteFromStreambufInputStreamImp()

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

◆ available()

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.

◆ close()

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.

◆ getSourceBuff() [1/2]

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

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

◆ getSourceBuff() [2/2]

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

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

◆ isBad()

virtual bool RWByteFromStreambufInputStreamImp::isBad ( ) const
virtual

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

Implements RWStreamImp.

◆ isEof()

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.

◆ isFail()

virtual bool RWByteFromStreambufInputStreamImp::isFail ( ) const
virtual

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

Implements RWStreamImp.

◆ isGood()

virtual bool RWByteFromStreambufInputStreamImp::isGood ( ) const
virtual

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

Implements RWStreamImp.

◆ make()

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.

◆ read() [1/2]

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.

◆ read() [2/2]

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.

◆ readUntil()

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.

◆ skip()

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 © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.