SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWCharFromStreambufInputStreamImp Class Reference

Concrete class connecting a narrow character stream to an iostreams narrow character buffer. More...

#include <rw/stream/RWCharFromStreambufInputStreamImp.h>

Inheritance diagram for RWCharFromStreambufInputStreamImp:
RWCharInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

Public Member Functions

virtual ~RWCharFromStreambufInputStreamImp ()
 
virtual RWSize available () const
 
virtual void close ()
 
virtual bool isBad () const
 
virtual bool isEof () const
 
virtual bool isFail () const
 
virtual bool isGood () const
 
virtual char read ()
 
virtual RWSize read (char *charArray, RWSize numChars)
 
virtual void readStringUntil (RWCString &string, char delim)
 
virtual RWSize readUntil (char *charArray, RWSize maxSize, char delim)
 
virtual RWSize skip (RWSize numUnits)
 
- Public Member Functions inherited from RWCharInputStreamImp
virtual ~RWCharInputStreamImp ()
 
virtual RWCharInputStream 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 RWCharInputStream make (std::streambuf &source)
 

Protected Member Functions

 RWCharFromStreambufInputStreamImp (std::streambuf &sourceBuff)
 
std::streambuf & getSourceBuff ()
 
const std::streambuf & getSourceBuff () const
 
- Protected Member Functions inherited from RWCharInputStreamImp
 RWCharInputStreamImp ()
 
- 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 narrow character 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

◆ ~RWCharFromStreambufInputStreamImp()

virtual RWCharFromStreambufInputStreamImp::~RWCharFromStreambufInputStreamImp ( )
virtual

Destructor.

◆ RWCharFromStreambufInputStreamImp()

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

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

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

Member Function Documentation

◆ available()

virtual RWSize RWCharFromStreambufInputStreamImp::available ( ) const
virtual

Returns the number of narrow characters that can be read from the iostreams std::streambuf, which is used as the source of narrow characters without blocking.

Implements RWInputStreamImp.

◆ close()

virtual void RWCharFromStreambufInputStreamImp::close ( )
virtual

This function does nothing. The user is responsible for closing the iostreams std::streambuf, which is used as the source of narrow characters.

Implements RWStreamImp.

◆ getSourceBuff() [1/2]

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

These functions return a reference to the iostreams std::streambuf, which is used as the source of narrow characters.

◆ getSourceBuff() [2/2]

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

These functions return a reference to the iostreams std::streambuf, which is used as the source of narrow characters.

◆ isBad()

virtual bool RWCharFromStreambufInputStreamImp::isBad ( ) const
virtual

These functions return true if the last operation performed on the iostreams std::streambuf failed.

Implements RWStreamImp.

◆ isEof()

virtual bool RWCharFromStreambufInputStreamImp::isEof ( ) const
virtual

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

Implements RWInputStreamImp.

◆ isFail()

virtual bool RWCharFromStreambufInputStreamImp::isFail ( ) const
virtual

These functions return true if the last operation performed on the iostreams std::streambuf failed.

Implements RWStreamImp.

◆ isGood()

virtual bool RWCharFromStreambufInputStreamImp::isGood ( ) const
virtual

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

Implements RWStreamImp.

◆ make()

static RWCharInputStream RWCharFromStreambufInputStreamImp::make ( std::streambuf & source)
inlinestatic

Constructs an RWCharFromStreambufInputStreamImp instance that uses source as its source of narrow characters, and returns a handle to it. Throws no exceptions.

Parameters
sourceThe iostreams std::streambuf that is used as the source of narrow characters.

◆ read() [1/2]

virtual char RWCharFromStreambufInputStreamImp::read ( )
virtual

Reads a single narrow character from the iostreams std::streambuf used as the source of narrow characters. Throws exception RWExternalStreamException and propagates any other exception thrown by the internal iostreams stream buffer object.

Implements RWCharInputStreamImp.

◆ read() [2/2]

virtual RWSize RWCharFromStreambufInputStreamImp::read ( char * charArray,
RWSize numChars )
virtual

Reads an array of narrow characters from the iostreams std::streambuf used as the source of narrow characters. The array must be pre-allocated to contain at least numChars elements. The function returns the actual number of narrow characters extracted from the iostreams std::streambuf. Throws exception RWExternalStreamException and propagates any other exception thrown by the internal iostreams stream buffer object.

Parameters
charArrayA pointer to the first element of the array.
numCharsThe number of narrow characters to be read from the stream.

Implements RWCharInputStreamImp.

◆ readStringUntil()

virtual void RWCharFromStreambufInputStreamImp::readStringUntil ( RWCString & string,
char delim )
virtual

Reads narrow characters from the iostreams std::streambuf used as the source of narrow characters until the last narrow character read is equal to delim, or until the end of the input sequence is reached. The narrow characters read are stored in string. If the last narrow character extracted is equal to delim, then it is not stored in string.

Parameters
stringReference to the narrow string receiving the narrow characters extracted from the iostreams std::streambuf.
delimNarrow character value used as a delimiter.

Implements RWCharInputStreamImp.

◆ readUntil()

virtual RWSize RWCharFromStreambufInputStreamImp::readUntil ( char * charArray,
RWSize maxSize,
char delim )
virtual

Reads narrow character(s) from the iostreams std::streambuf, used as its source of narrow characters, until the last narrow character read is equal to delim, or maxSize narrow character(s) have been read, or the end of the input sequence is reached. The narrow character(s) read are stored in charArray. The function returns the actual number of narrow character(s) inserted into charArray. If the last narrow character extracted is equal to delim, then it is not stored in charArray.

Parameters
charArrayA pointer to the array receiving the narrow characters(s) extracted from the iostreams std::streambuf.
maxSizeThe maximum number of narrow character(s) to be read.
delimThe narrow character value used as a delimiter.

Implements RWCharInputStreamImp.

◆ skip()

virtual RWSize RWCharFromStreambufInputStreamImp::skip ( RWSize numUnits)
virtual

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

Parameters
numUnitsThe number of narrow characters to be skipped.

Implements RWInputStreamImp.

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