Module: Advanced Tools Package: Streams
RWCharFromStreambufInputStreamImp RWCharInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase
available() close() getSourceBuff() isBad() |
isEof() isFail() isGood() make() |
read() readUntil() RWCharFromStreambufInputStreamImp() skip() |
~RWCharFromStreambufInputStreamImp() |
#include <rw/stream/RWCharFromStreambufInputStreamImp.h>
Concrete class connecting a narrow character stream, to an iostreams narrow character buffer. The iostreams buffer is used as 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.
RWCharFromStreambufInputStreamImp(streambuf& sourceBuff);
Initializes the reference to the iostreams std::streambuf, that will be used as the source of narrow characters. Throws no exceptions.
Parameter List
sourceBuff |
The iostreams std::streambuf that will serve as the source of narrow characters. |
virtual ~RWCharFromStreambufInputStreamImp();
Destructor.
static RWCharInputStream make(streambuf& source);
Constructs an RWCharFromStreambufInputStreamImp instance that uses source as its source of narrow characters, and returns a handle to it. Throws no exceptions.
Parameter List
source |
The iostreams std::streambuf that is used as the source of narrow characters. |
virtual RWSize available() const;
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.
virtual void close();
This function does nothing. The user is responsible for closing the iostreams std::streambuf, which is used as the source of narrow characters.
virtual bool isBad() const; virtual bool isFail() const;
These functions return true if the last operation performed on the iostreams std::streambuf failed.
virtual bool isEof() const;
Returns true if there is no narrow character available from the iostreams std::streambuf, used as the source of narrow characters.
virtual bool isGood() const;
Returns true if the last operation performed on the iostreams std::streambuf succeeded.
virtual RWSize read(char* charArray, RWSize numChars);
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 streambuf. Throws exception RWExternalStreamException and propagates any other exception thrown by the internal iostreams stream buffer object.
Parameter List
charArray |
A pointer to the first element of the array. |
numChars |
The number of narrow characters to be read from the stream. |
virtual char read();
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.
virtual void readUntil(RWCString& string, char delim);
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.
Parameter List
string |
Reference to the narrow string receiving the narrow characters extracted from the iostreams std::streambuf. |
delim |
Narrow character value used as a delimiter. |
virtual RWSize skip(RWSize numUnits);
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.
Parameter List
numUnits |
The number of narrow characters to be skipped. |
streambuf& getSourceBuff(); const streambuf& getSourceBuff() const;
These functions return a reference to the iostreams std::streambuf, which is used as the source of narrow characters.
© 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.