rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWCharFromStreambufInputStreamImp Class Reference
[Streams]

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 >

List of all members.

Public Member Functions

virtual ~RWCharFromStreambufInputStreamImp ()
virtual void close ()
virtual bool isEof () const
virtual bool isBad () 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 available () const
virtual RWSize skip (RWSize numUnits)

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

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

virtual RWCharFromStreambufInputStreamImp::~RWCharFromStreambufInputStreamImp (  )  [virtual]

Destructor.

RWCharFromStreambufInputStreamImp::RWCharFromStreambufInputStreamImp ( std::streambuf &  sourceBuff  )  [inline, protected]

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

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

Member Function Documentation

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.

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.

const std::streambuf& RWCharFromStreambufInputStreamImp::getSourceBuff (  )  const [inline, protected]

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

std::streambuf& RWCharFromStreambufInputStreamImp::getSourceBuff (  )  [inline, protected]

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

virtual bool RWCharFromStreambufInputStreamImp::isBad (  )  const [virtual]

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

Implements RWStreamImp.

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.

virtual bool RWCharFromStreambufInputStreamImp::isFail (  )  const [virtual]

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

Implements RWStreamImp.

virtual bool RWCharFromStreambufInputStreamImp::isGood (  )  const [virtual]

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

Implements RWStreamImp.

static RWCharInputStream RWCharFromStreambufInputStreamImp::make ( std::streambuf &  source  )  [inline, static]

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

Parameters:
source The iostreams std::streambuf that is used as the source of narrow characters.
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:
charArray A pointer to the first element of the array.
numChars The number of narrow characters to be read from the stream.

Implements RWCharInputStreamImp.

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.

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:
string Reference to the narrow string receiving the narrow characters extracted from the iostreams std::streambuf.
delim Narrow character value used as a delimiter.

Implements RWCharInputStreamImp.

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

Reads narrow character(s) from the attached source stream 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) read from the stream.

Parameters:
charArray A pointer to the array receiving the narrow character(s) extracted from the stream.
maxSize The maximum number of narrow character(s) to be read.
delim The narrow character value used as a delimeter.

Implements RWCharInputStreamImp.

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:
numUnits The number of narrow characters to be skipped.

Implements RWInputStreamImp.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.