Module: Advanced Tools Package: Streams
RWDataInputStream RWHandleBase
#include <rw/stream/RWDataInputStream.h>
Handle class for all the data input stream implementation classes. Implements the handle idiom from the handle-body pattern.
RW_EXPLICIT RWDataInputStream(RWDataInputStreamImp* body);
Constructor.
RWDataInputStream(const RWDataInputStream& handle) ;
Copy constructor.
Parameter List
handle |
A data stream handle used to initialize the newly created handle. |
RWDataInputStream& operator=(const RWDataInputStream& handle);
Assignment operator. Throws no exceptions.
Parameter List
handle |
A data stream handle used to initialize this handle. |
RWDataInputStream& operator>>(RWDataInputStream& (*pf)(RWDataInputStream&));
Extractor executing a manipulator function.
Parameter List
pf |
The manipulator's function pointer. |
RWDataInputStream& operator>>(bool& value); RWDataInputStream& operator>>(char& value); RWDataInputStream& operator>>(double& value); RWDataInputStream& operator>>(float& value); RWDataInputStream& operator>>(int& value); RWDataInputStream& operator>>(long& value); RWDataInputStream& operator>>(long double& value); RWDataInputStream& operator>>(long long& value); RWDataInputStream& operator>>(short& value); RWDataInputStream& operator>>(signed char& value); RWDataInputStream& operator>>(unsigned char& value); RWDataInputStream& operator>>(unsigned int& value); RWDataInputStream& operator>>(unsigned long& value); RWDataInputStream& operator>>(unsigned short& value); RWDataInputStream& operator>>(wchar_t& value);
These operator functions read a specified value from the stream.
Parameter List
value |
The value to be read from the stream, as defined by the first element. |
RWSize available() const;
Returns the number of available elements that can be read from the stream without blocking. The type of the elements read is specified by implementation classes and can be one of the following: RWByte, char, RWUChar, or wchar_t. Throws no exceptions.
void close();
Closes the stream. May throw exceptions.
RWSize getBools(bool* arrayPt, RWSize count); RWSize getChars(char* arrayPt, RWSize count); RWSize getDoubles(double* arrayPt, RWSize count); RWSize getFloats(float* arrayPt, RWSize count); RWSize getInts(int* arrayPt, RWSize count); RWSize getLongs(long* arrayPt, RWSize count); RWSize getLongDoubles(long double* arrayPt, RWSize count); RWSize getLongLongs(long long* arrayPt, RWSize count); RWSize getShorts(short* arrayPt, RWSize count); RWSize getSignedChars(signed char* arrayPt, RWSize count); RWSize getUnsignedChars(unsigned char* arrayPt, RWSize count); RWSize getUnsignedInts(unsigned int* arrayPt, RWSize count); RWSize getUnsignedLongs(unsigned long* arrayPt, RWSize count); RWSize getUnsignedShorts(unsigned short* arrayPt, RWSize count);
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.
Parameter List
arrayPt |
A pointer to the array's first element. |
count |
The number of elements to be read from the stream. |
void getBool(bool& value); void getChar(char& value); void getDouble(double& value); void getFloat(float& value); void getInt(int& value); void getLong(long& value); void getLongDouble(long double& value); void getLongLong(long long& value);
void getShort(short& value); void getSignedChar(signed char& value); void getUnsignedChar(unsigned char& value); void getUnsignedInt(unsigned int& value);
void getUnsignedLong(unsigned long& value); void getUnsignedShort(unsigned short& value); void getWchar_t(wchar_t& value);
These functions read a value from the stream.
Parameter List
value |
The type of value to be read from the stream. |
void getCharacter(char& value);
Reads a narrow character from the stream.
Parameter List
value |
The narrow character to be read from the stream. |
RWSize getDelimitedString(char* string, RWSize maxCount, char delim= '\0');
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.
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. |
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.
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. |
RWSize getDelimitedWString(wchar_t* wstring, RWSize maxCount,
wchar_t delim= L'\0');
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 wstring stores the wide characters read. The function returns the actual number of wide characters read from the stream.
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. |
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. |
count |
The number of elements to be read from the stream. |
void getUCharacter(RWUChar& value);
Reads a UTF-16 character from the stream.
Parameter List
value |
The UTF-16 character to be read from the stream. |
RWSize getUString(RWUChar* ustring, 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. |
count |
The number of elements to be read from the stream. |
void getWCharacter(wchar_t& value);
Reads a wide character from the stream.
Parameter List
value |
The wide character to be read from the stream. |
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. |
bool isBad() const;
Returns true to indicate a loss of integrity resulting from an input, such as an irrecoverable read error from a file. Throws no exceptions.
bool isEof() const;
Returns true to indicate that an input operation reached the end of an input sequence. Throws no exceptions.
bool isFail() const;
Returns true to indicate that an input operation failed to read the expected data. Throws no exceptions.
bool isGood() const;
Returns true to indicate a stream in a valid state. Throws no exceptions.
RWSize skip(RWSize numUnits);
Skips numUnits elements from the input sequence if possible. The function returns the actual number of elements skipped, which can be any value between 0 and numUnits. The type of the elements skipped is specified by implementation classes and can be one of the following: RWByte, char, RWUChar, or wchar_t.
Parameter List
numUnits |
The number of elements to be skipped. |
© 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.