SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Related Functions
RWDataInputStream Class Reference

Handle class for all the data input stream implementation classes. More...

#include <rw/stream/RWDataInputStream.h>

Inheritance diagram for RWDataInputStream:
RWHandleBase RWObjectInputStream

Public Member Functions

 RWDataInputStream (RWDataInputStreamImp *ptr)
 
 RWDataInputStream (const RWDataInputStream &handle)
 
RWSize available () const
 
void close ()
 
void getBool (bool &value)
 
RWSize getBools (bool *arrayPt, RWSize count)
 
void getChar (char &value)
 
void getCharacter (char &value)
 
RWSize getChars (char *arrayPt, RWSize count)
 
RWSize getDelimitedString (char *string, RWSize maxCount, char delim= '\0')
 
RWSize getDelimitedUString (RWUChar *ustring, RWSize maxCount, RWUChar delim)
 
RWSize getDelimitedWString (wchar_t *wstring, RWSize maxCount, wchar_t delim=L'\0')
 
void getDouble (double &value)
 
RWSize getDoubles (double *arrayPt, RWSize count)
 
void getFloat (float &value)
 
RWSize getFloats (float *arrayPt, RWSize count)
 
void getInt (int &value)
 
RWSize getInts (int *arrayPt, RWSize count)
 
void getLong (long &value)
 
void getLongDouble (long double &value)
 
RWSize getLongDoubles (long double *arrayPt, RWSize count)
 
void getLongLong (long long &value)
 
RWSize getLongLongs (long long *arrayPt, RWSize count)
 
RWSize getLongs (long *arrayPt, RWSize count)
 
void getShort (short &value)
 
RWSize getShorts (short *arrayPt, RWSize count)
 
void getSignedChar (signed char &value)
 
RWSize getSignedChars (signed char *arrayPt, RWSize count)
 
void getSizeT (size_t &value)
 
RWSize getString (char *string, RWSize count)
 
void getUCharacter (RWUChar &value)
 
void getUnsignedChar (unsigned char &value)
 
RWSize getUnsignedChars (unsigned char *arrayPt, RWSize count)
 
void getUnsignedInt (unsigned int &value)
 
RWSize getUnsignedInts (unsigned int *arrayPt, RWSize count)
 
void getUnsignedLong (unsigned long &value)
 
RWSize getUnsignedLongLongs (unsigned long long *arrayPt, RWSize count)
 
RWSize getUnsignedLongs (unsigned long *arrayPt, RWSize count)
 
void getUnsignedShort (unsigned short &value)
 
RWSize getUnsignedShorts (unsigned short *arrayPt, RWSize count)
 
RWSize getUString (RWUChar *ustring, RWSize count)
 
void getWchar_t (wchar_t &value)
 
RWSize getWchar_ts (wchar_t *arrayPt, RWSize count)
 
void getWCharacter (wchar_t &value)
 
RWSize getWString (wchar_t *wstring, RWSize count)
 
bool isBad () const
 
bool isEof () const
 
bool isFail () const
 
bool isGood () const
 
RWDataInputStreamoperator= (const RWDataInputStream &handle)
 
RWDataInputStreamoperator>> (RWDataInputStream &(*pf)(RWDataInputStream &))
 
RWDataInputStream operator>> (RWDataInputStream(*pf)(RWDataInputStream &))
 
RWDataInputStreamoperator>> (bool &value)
 
RWDataInputStreamoperator>> (char &value)
 
RWDataInputStreamoperator>> (unsigned char &value)
 
RWDataInputStreamoperator>> (signed char &value)
 
RWDataInputStreamoperator>> (short &value)
 
RWDataInputStreamoperator>> (unsigned short &value)
 
RWDataInputStreamoperator>> (int &value)
 
RWDataInputStreamoperator>> (unsigned int &value)
 
RWDataInputStreamoperator>> (long &value)
 
RWDataInputStreamoperator>> (unsigned long &value)
 
RWDataInputStreamoperator>> (float &value)
 
RWDataInputStreamoperator>> (double &value)
 
RWDataInputStreamoperator>> (wchar_t &value)
 
RWDataInputStreamoperator>> (long long &value)
 
RWDataInputStreamoperator>> (long double &value)
 
RWSize skip (RWSize numUnits)
 
- Public Member Functions inherited from RWHandleBase
bool isValid (void) const
 
bool operator!= (const RWHandleBase &second) const
 
bool operator< (const RWHandleBase &second) const
 
bool operator== (const RWHandleBase &second) const
 

Related Functions

(Note that these are not member functions.)

RWDataInputStream rwGuard (RWDataInputStream &stream)
 

Additional Inherited Members

- Protected Member Functions inherited from RWHandleBase
 RWHandleBase (void)
 
 RWHandleBase (RWStaticCtor)
 
 RWHandleBase (RWBodyBase *body)
 
 RWHandleBase (const RWHandleBase &second)
 
 ~RWHandleBase (void)
 
RWBodyBasebody (void) const
 
RWHandleBaseoperator= (const RWHandleBase &second)
 

Detailed Description

Handle class for all the data input stream implementation classes. Implements the handle idiom from the handle-body pattern.

Constructor & Destructor Documentation

RWDataInputStream::RWDataInputStream ( RWDataInputStreamImp ptr)
inlineexplicit

Constructor.

RWDataInputStream::RWDataInputStream ( const RWDataInputStream handle)
inline

Copy constructor.

Parameters
handleA data stream handle used to initialize the newly created handle.

Member Function Documentation

RWSize RWDataInputStream::available ( ) const
inline

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 RWDataInputStream::close ( void  )
inline

Closes the stream. May throw exceptions.

void RWDataInputStream::getBool ( bool &  value)
inline

Reads a bool value from the stream.

Parameters
valueThe bool to be read from the stream.
RWSize RWDataInputStream::getBools ( bool *  arrayPt,
RWSize  count 
)
inline

Reads an array of bool value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getChar ( char &  value)
inline

Reads a char value from the stream.

Parameters
valueThe char to be read from the stream.
void RWDataInputStream::getCharacter ( char &  value)
inline

Reads a narrow character from the stream.

Parameters
valueThe narrow character to be read from the stream.
RWSize RWDataInputStream::getChars ( char *  arrayPt,
RWSize  count 
)
inline

Reads an array of char value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
RWSize RWDataInputStream::getDelimitedString ( char *  string,
RWSize  maxCount,
char  delim = '\0' 
)
inline

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.

Parameters
stringA pointer to the string receiving the narrow characters extracted from the stream.
maxCountThe maximum number of narrow characters to be read.
delimThe narrow character used as a delimiter.
RWSize RWDataInputStream::getDelimitedUString ( RWUChar ustring,
RWSize  maxCount,
RWUChar  delim 
)
inline

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.

Parameters
ustringA pointer to the string receiving the UTF-16 characters extracted from the stream.
maxCountThe maximum number of UTF-16 characters to be read.
delimThe UTF-16 character used as a delimiter.
RWSize RWDataInputStream::getDelimitedWString ( wchar_t *  wstring,
RWSize  maxCount,
wchar_t  delim = L'\0' 
)
inline

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.

Parameters
wstringA pointer to the string receiving the wide characters extracted from the stream.
maxCountThe maximum number of wide characters to be read.
delimThe wide character used as a delimiter.
void RWDataInputStream::getDouble ( double &  value)
inline

Reads a double value from the stream.

Parameters
valueThe double value to be read from the stream.
RWSize RWDataInputStream::getDoubles ( double *  arrayPt,
RWSize  count 
)
inline

Reads an array of double value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getFloat ( float &  value)
inline

Reads a float value from the stream.

Parameters
valueThe float value to be read from the stream.
RWSize RWDataInputStream::getFloats ( float *  arrayPt,
RWSize  count 
)
inline

Reads an array of float value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getInt ( int &  value)
inline

Reads a int value from the stream.

Parameters
valueThe int to be read from the stream.
RWSize RWDataInputStream::getInts ( int *  arrayPt,
RWSize  count 
)
inline

Reads an array of int value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getLong ( long &  value)
inline

Reads a long value from the stream.

Parameters
valueThe long to be read from the stream.
void RWDataInputStream::getLongDouble ( long double &  value)
inline

Reads a long double value from the stream.

Parameters
valueThe long double value to be read from the stream.
RWSize RWDataInputStream::getLongDoubles ( long double *  arrayPt,
RWSize  count 
)
inline

Reads an array of long double value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getLongLong ( long long &  value)
inline

Reads a long long value from the stream.

Parameters
valueThe long long value to be read from the stream.
RWSize RWDataInputStream::getLongLongs ( long long *  arrayPt,
RWSize  count 
)
inline

Reads an array of long long value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
RWSize RWDataInputStream::getLongs ( long *  arrayPt,
RWSize  count 
)
inline

Reads an array of long value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getShort ( short &  value)
inline

Reads a short value from the stream.

Parameters
valueThe short to be read from the stream.
RWSize RWDataInputStream::getShorts ( short *  arrayPt,
RWSize  count 
)
inline

Reads an array of short value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getSignedChar ( signed char &  value)
inline

Reads a signed char value from the stream.

Parameters
valueThe signed char value to be read from the stream.
RWSize RWDataInputStream::getSignedChars ( signed char *  arrayPt,
RWSize  count 
)
inline

Reads an array of signed char value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getSizeT ( size_t &  value)
inline

Reads a size_t character from the stream.

Parameters
valueThe size_t character to be read from the stream.
RWSize RWDataInputStream::getString ( char *  string,
RWSize  count 
)
inline

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.

Parameters
stringA pointer to the string's first element.
countThe number of elements to be read from the stream.
void RWDataInputStream::getUCharacter ( RWUChar value)
inline

Reads a UTF-16 character from the stream.

Parameters
valueThe UTF-16 character to be read from the stream.
void RWDataInputStream::getUnsignedChar ( unsigned char &  value)
inline

Reads a unsigned char value from the stream.

Parameters
valueThe unsigned char value to be read from the stream.
RWSize RWDataInputStream::getUnsignedChars ( unsigned char *  arrayPt,
RWSize  count 
)
inline

Reads an array of unsigned char value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getUnsignedInt ( unsigned int &  value)
inline

Reads a unsigned int value from the stream.

Parameters
valueThe unsigned int value to be read from the stream.
RWSize RWDataInputStream::getUnsignedInts ( unsigned int *  arrayPt,
RWSize  count 
)
inline

Reads an array of unsigned int value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getUnsignedLong ( unsigned long &  value)
inline

Reads a unsigned long value from the stream.

Parameters
valueThe unsigned long value to be read from the stream.
RWSize RWDataInputStream::getUnsignedLongLongs ( unsigned long long *  arrayPt,
RWSize  count 
)
inline

Reads an array of unsigned long long value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
RWSize RWDataInputStream::getUnsignedLongs ( unsigned long *  arrayPt,
RWSize  count 
)
inline

Reads an array of unsigned long value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getUnsignedShort ( unsigned short &  value)
inline

Reads a unsigned short value from the stream.

Parameters
valueThe unsigned short value to be read from the stream.
RWSize RWDataInputStream::getUnsignedShorts ( unsigned short *  arrayPt,
RWSize  count 
)
inline

Reads an array of unsigned short value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
RWSize RWDataInputStream::getUString ( RWUChar ustring,
RWSize  count 
)
inline

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.

Parameters
ustringA pointer to the string's first element.
countThe number of elements to be read from the stream.
void RWDataInputStream::getWchar_t ( wchar_t &  value)
inline

Reads a wchar_t value from the stream.

Parameters
valueThe wchar_t value to be read from the stream.
RWSize RWDataInputStream::getWchar_ts ( wchar_t *  arrayPt,
RWSize  count 
)
inline

Reads an array of wchar_t value(s) from the stream. The array must have been pre-allocated to contain at least count elements. The function returns the number of elements read.

Parameters
arrayPtA pointer to the array's first element.
countThe number of element(s) to be read from the stream.
void RWDataInputStream::getWCharacter ( wchar_t &  value)
inline

Reads a wide character from the stream.

Parameters
valueThe wide character to be read from the stream.
RWSize RWDataInputStream::getWString ( wchar_t *  wstring,
RWSize  count 
)
inline

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.

Parameters
wstringA pointer to the string's first element.
countThe number of elements to be read from the stream.
bool RWDataInputStream::isBad ( ) const
inline

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 RWDataInputStream::isEof ( ) const
inline

Returns true to indicate that an input operation reached the end of an input sequence. Throws no exceptions.

bool RWDataInputStream::isFail ( ) const
inline

Returns true to indicate that an input operation failed to read the expected data. Throws no exceptions.

bool RWDataInputStream::isGood ( ) const
inline

Returns true to indicate a stream in a valid state. Throws no exceptions.

RWDataInputStream& RWDataInputStream::operator= ( const RWDataInputStream handle)
inline

Assignment operator. Throws no exceptions.

Parameters
handleA data stream handle used to initialize this handle.
RWDataInputStream& RWDataInputStream::operator>> ( RWDataInputStream &(*)(RWDataInputStream &)  pf)
inline

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.
RWDataInputStream RWDataInputStream::operator>> ( RWDataInputStream(*)(RWDataInputStream &)  pf)
inline

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.
RWDataInputStream& RWDataInputStream::operator>> ( bool &  value)
inline

Reads a char value from the stream.

Parameters
valueThe bool value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( char &  value)
inline

Reads a char value from the stream.

Parameters
valueThe char value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( unsigned char &  value)
inline

Reads a unsigned char value from the stream.

Parameters
valueThe unsigned char value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( signed char &  value)
inline

Reads a signed char value from the stream.

Parameters
valueThe signed char value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( short &  value)
inline

Reads a short value from the stream.

Parameters
valueThe short value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( unsigned short &  value)
inline

Reads a unsigned short value from the stream.

Parameters
valueThe unsigned short value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( int &  value)
inline

Reads a int value from the stream.

Parameters
valueThe int value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( unsigned int &  value)
inline

Reads a unsigned int value from the stream.

Parameters
valueThe unsigned int value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( long &  value)
inline

Reads a long value from the stream.

Parameters
valueThe long value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( unsigned long &  value)
inline

Reads a unsigned long value from the stream.

Parameters
valueThe unsigned long value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( float &  value)
inline

Reads a float value from the stream.

Parameters
valueThe float value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( double &  value)
inline

Reads a double value from the stream.

Parameters
valueThe double value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( wchar_t &  value)
inline

Reads a wchar_t value from the stream.

Parameters
valueThe wchar_t value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( long long &  value)
inline

Reads a long long value from the stream.

Parameters
valueThe long long value to be read from the stream.
RWDataInputStream& RWDataInputStream::operator>> ( long double &  value)
inline

Reads a long double value from the stream.

Parameters
valueThe long double value to be read from the stream.
RWSize RWDataInputStream::skip ( RWSize  numUnits)
inline

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.

Parameters
numUnitsThe number of elements to be skipped.

Friends And Related Function Documentation

RWDataInputStream rwGuard ( RWDataInputStream stream)
related
Header File
#include <rw/stream/RWGuardedDataInputStreamImp.h>

Manipulator that is used to guard a series of extraction operations.

Parameters
streamA data input stream.

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any extractions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Example
// Lock the stream for the duration of all three insertions:
instr >> rwGuard >> data1 >> data2 >> data3;

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