Module: Advanced Tools Package: Streams
RWIstreamDataFromCharInputStreamImp RWDataFromCharInputStreamImp RWDataInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase
#include <rw/stream/RWIstreamDataFromCharInputStreamImp.h>
The class RWIstreamDataFromCharInputStreamImp reads data in ascii format from a narrow character stream. The RWOstreamDataToCharOutputStreamImp or iostreams std::ostream class generates the format being read. Implements the body idiom from the handle-body pattern.
RWIstreamDataFromCharInputStreamImp(RWCharInputStream&
sourceStream);
Initializes the reference to the narrow character stream that will be used as the source of characters.
Parameter List
sourceStream |
The narrow character stream that will serve as the source of characters. |
RWIstreamDataFromCharInputStreamImp
(RWCharInputStream& sourceStream, ios*& formatter);
Initializes the reference to the narrow character stream that will be used as the source of characters.
Parameter List
sourceStream |
The narrow character stream that will serve as the source of characters. |
formatter |
An object that can be used to modify the format recognized by the stream. This object is initialized by the stream and then returned to the caller. |
virtual ~RWIstreamDataFromCharInputStreamImp();
Destructor.
static RWDataInputStream make(RWCharInputStream& source);
Constructs an RWIstreamDataFromCharInputStreamImp instance that uses source as its source of narrow characters, and returns a handle to it. Throws no exceptions.
Parameter List
source |
The narrow character stream that is used as the source of characters. |
static RWDataInputStream make(RWCharInputStream& source, ios*& formatter);
Constructs an RWIstreamDataFromCharInputStreamImp instance that uses source as its source of narrow characters, and returns a handle to it. Throws no exceptions.
Parameter List
source |
The narrow character stream that is used as the source of characters. stream. This object is initialized by the stream, and then returned to the caller. |
formatter |
An object that can be used to modify the format recognized by the stream. This object is initialized by the stream and then returned to the caller. |
virtual RWSize available() const;
Returns the number of narrow characters that can be read from the embedded iostreams istream object without blocking. Throws no exceptions.
virtual void close();
Forwards the close() call to the next processing narrow character input stream.
virtual void getBool(bool& value); virtual void getChar(char& value); virtual void getDouble(double& value); virtual void getFloat(float& value); virtual void getInt(int& value); virtual void getLongDouble(long double& value); virtual void getLongLong(long long& value); virtual void getLong(long& value); virtual void getShort(short& value); virtual void getSignedChar(signed char& value); virtual void getUCharacter(RWUChar& value); virtual void getUnsignedChar(unsigned char& value); virtual void getUnsignedInt(unsigned int& value); virtual void getUnsignedLong(unsigned long& value); virtual void getUnsignedShort(unsigned short& value); virtual void getWCharacter(wchar_t& value); virtual void getWchar_t(wchar_t& value);
These functions read a value from the stream.
Parameter List
value |
The value to be read from the stream. |
virtual RWSize getBools(bool* arrayPt, RWSize count); virtual RWSize getChars(char* arrayPt, RWSize count); virtual RWSize getDoubles(double* arrayPt, RWSize count); virtual RWSize getFloats(float* arrayPt, RWSize count); virtual RWSize getInts(int* arrayPt, RWSize count); virtual RWSize getLongs(long* arrayPt, RWSize count); virtual RWSize getLongDoubles(long double* arrayPt, RWSize count); virtual RWSize getLongLongs(long long* arrayPt, RWSize count); virtual RWSize getShorts(short* arrayPt, RWSize count); virtual RWSize getSignedChars(signed char* arrayPt, RWSize count); virtual RWSize getUnsignedChars(unsigned char* arrayPt, RWSize count); virtual RWSize getUnsignedInts(unsigned int* arrayPt, RWSize count); virtual RWSize getUnsignedLongs(unsigned long* arrayPt, RWSize count); virtual RWSize getUnsignedShorts(unsigned short* arrayPt, RWSize count); virtual RWSize getWchar_ts(wchar_t* arrayPt, RWSize count);
These functions read an array of values from the stream. The array must have been pre-allocated to contain at least count elements. The functions return the number of elements read. Throws RWIncompleteStreamException.
Parameter List
arrayPt |
A pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
virtual void getCharacter(char& value);
Reads a narrow character from the stream.
Parameter List
value |
The narrow character to be read from the stream. |
virtual RWSize getDelimitedString(char* string, RWSize maxCount, char delim);
Reads narrow characters from the stream until the last character read is equal to delim, or maxCount narrow characters have been read, or the end of the input sequence is reached. The narrow characters read are stored in string. The function returns the actual number of narrow characters read from the stream. Throws RWIncompleteStreamException.
Parameter List
string |
A pointer to the string receiving the narrow characters extracted from the stream. |
maxCount |
The maximum number of narrow characters to be read. |
delim |
The narrow character used as a delimiter. |
virtual RWSize getDelimitedUString(RWUChar* ustring, RWSize maxCount,
RWUChar delim);
Reads UTF-16 characters from the stream until the last character read is equal to delim, or maxCount UTF-16 characters have been read, or the end of the input sequence is reached. The UTF-16 characters read are stored in ustring. The function returns the actual number of UTF-16 characters read from the stream. Throws RWIncompleteStreamException.
Parameter List
ustring |
A pointer to the string receiving the UTF-16 characters extracted from the stream. |
maxCount |
The maximum number of UTF-16 characters to be read. |
delim |
The UTF-16 character used as a delimiter. |
virtual RWSize getDelimitedWString(wchar_t* wstring, RWSize maxCount,
wchar_t delim);
Reads wide characters from the stream until the last character read is equal to delim, or maxCount wide characters have been read, or the end of the input sequence is reached. The wide characters read are stored in wstring. The function returns the actual number of wide characters read from the stream. Throws RWIncompleteStreamException.
Parameter List
wstring |
A pointer to the string receiving the wide characters extracted from the stream. |
maxCount |
The maximum number of wide characters to be read. |
delim |
The wide character used as a delimiter. |
virtual RWSize getString(char* string, RWSize count);
Reads a narrow character string from the stream. The string must have been pre-allocated to contain at least count elements. The function returns the number of elements read.
Parameter List
string |
A pointer to the string's first element. |
virtual RWSize getUString(RWUChar* arrayPt, RWSize count);
Reads a UTF-16 character string from the stream. The string must have been pre-allocated to contain at least count elements. The function returns the number of elements read.
Parameter List
ustring |
A pointer to the string's first element. |
virtual RWSize getWString(wchar_t* wstring, RWSize count);
Reads a wide character string from the stream. The string must have been pre-allocated to contain at least count elements. The function returns the number of elements read.
Parameter List
wstring |
A pointer to the string's first element. |
count |
The number of elements to be read from the stream. |
virtual bool isBad() const;
Returns true if either one of the embedded iostreams istream objects, or the next processing narrow character input stream object is in a bad state. Throws no exceptions.
virtual bool isEof() const;
Returns true if either one of the embedded iostreams istream objects or the next processing narrow character input stream object is in an eof state. Throws no exceptions.
virtual bool isFail() const;
Returns true if either one of the embedded iostreams istream objects or the next processing narrow character input stream object is in a failed state. Throws no exceptions.
virtual bool isGood() const;
Returns true if both the embedded iostreams istream object, and the next processing narrow character input stream object are in good state. Throws no exceptions.
virtual RWSize skip(RWSize numUnits);
Skips numUnits narrow characters(s) from the embedded iostreams istream object 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. |
ios& getIos();
Returns a reference to the std::ios base class of the embedded istream object. The ios reference can then be used to modify the format flags used by the embedded istream object when decoding formatted ascii representation of the data inserted in this input stream.
istream& getCheckedIstream();
Returns the embedded iostreams istream object that is used to format data. If the embedded istream object is in a failed or bad state, then it throws RWExternalStreamException.
istream& getIstream();
Returns the embedded iostreams istream object that is used to format data. Throws no exceptions.
const istream& getCheckedIstream() const;
Returns the embedded iostreams istream object that is used to format data. If the embedded istream object is in a failed or bad state, then it throws RWExternalStreamException.
const istream& getIstream() const;
Returns the embedded iostreams istream object that is used to format data. Throws no exceptions.
© 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.