SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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 (const RWDataInputStream &handle)
 
 RWDataInputStream (RWDataInputStreamImp *ptr)
 
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>> (bool &value)
 
RWDataInputStreamoperator>> (char &value)
 
RWDataInputStreamoperator>> (double &value)
 
RWDataInputStreamoperator>> (float &value)
 
RWDataInputStreamoperator>> (int &value)
 
RWDataInputStreamoperator>> (long &value)
 
RWDataInputStreamoperator>> (long double &value)
 
RWDataInputStreamoperator>> (long long &value)
 
RWDataInputStreamoperator>> (RWDataInputStream &(*pf)(RWDataInputStream &))
 
RWDataInputStream operator>> (RWDataInputStream(*pf)(RWDataInputStream &))
 
RWDataInputStreamoperator>> (short &value)
 
RWDataInputStreamoperator>> (signed char &value)
 
RWDataInputStreamoperator>> (unsigned char &value)
 
RWDataInputStreamoperator>> (unsigned int &value)
 
RWDataInputStreamoperator>> (unsigned long &value)
 
RWDataInputStreamoperator>> (unsigned short &value)
 
RWDataInputStreamoperator>> (wchar_t &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
 

Friends

class RWTStreamGuardImp< RWDataInputStream, RWFilteredDataInputStreamImp >
 

Related Symbols

(Note that these are not member symbols.)

RWDataInputStream rwGuard (RWDataInputStream &stream)
 

Additional Inherited Members

- Protected Member Functions inherited from RWHandleBase
 RWHandleBase (const RWHandleBase &second)
 
 RWHandleBase (RWBodyBase *body)
 
 RWHandleBase (RWStaticCtor)
 
 RWHandleBase (void)
 
 ~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() [1/2]

RWDataInputStream::RWDataInputStream ( RWDataInputStreamImp * ptr)
inlineexplicit

Constructor.

◆ RWDataInputStream() [2/2]

RWDataInputStream::RWDataInputStream ( const RWDataInputStream & handle)
inline

Copy constructor.

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

Member Function Documentation

◆ available()

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.

◆ close()

void RWDataInputStream::close ( )
inline

Closes the stream. May throw exceptions.

◆ getBool()

void RWDataInputStream::getBool ( bool & value)
inline

Reads a bool value from the stream.

Parameters
valueThe bool to be read from the stream.

◆ getBools()

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.

◆ getChar()

void RWDataInputStream::getChar ( char & value)
inline

Reads a char value from the stream.

Parameters
valueThe char to be read from the stream.

◆ getCharacter()

void RWDataInputStream::getCharacter ( char & value)
inline

Reads a narrow character from the stream.

Parameters
valueThe narrow character to be read from the stream.

◆ getChars()

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.

◆ getDelimitedString()

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.

◆ getDelimitedUString()

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.

◆ getDelimitedWString()

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.

◆ getDouble()

void RWDataInputStream::getDouble ( double & value)
inline

Reads a double value from the stream.

Parameters
valueThe double value to be read from the stream.

◆ getDoubles()

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.

◆ getFloat()

void RWDataInputStream::getFloat ( float & value)
inline

Reads a float value from the stream.

Parameters
valueThe float value to be read from the stream.

◆ getFloats()

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.

◆ getInt()

void RWDataInputStream::getInt ( int & value)
inline

Reads a int value from the stream.

Parameters
valueThe int to be read from the stream.

◆ getInts()

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.

◆ getLong()

void RWDataInputStream::getLong ( long & value)
inline

Reads a long value from the stream.

Parameters
valueThe long to be read from the stream.

◆ getLongDouble()

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.

◆ getLongDoubles()

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.

◆ getLongLong()

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.

◆ getLongLongs()

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.

◆ getLongs()

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.

◆ getShort()

void RWDataInputStream::getShort ( short & value)
inline

Reads a short value from the stream.

Parameters
valueThe short to be read from the stream.

◆ getShorts()

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.

◆ getSignedChar()

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.

◆ getSignedChars()

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.

◆ getSizeT()

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.

◆ getString()

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.

◆ getUCharacter()

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.

◆ getUnsignedChar()

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.

◆ getUnsignedChars()

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.

◆ getUnsignedInt()

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.

◆ getUnsignedInts()

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.

◆ getUnsignedLong()

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.

◆ getUnsignedLongLongs()

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.

◆ getUnsignedLongs()

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.

◆ getUnsignedShort()

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.

◆ getUnsignedShorts()

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.

◆ getUString()

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.

◆ getWchar_t()

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.

◆ getWchar_ts()

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.

◆ getWCharacter()

void RWDataInputStream::getWCharacter ( wchar_t & value)
inline

Reads a wide character from the stream.

Parameters
valueThe wide character to be read from the stream.

◆ getWString()

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.

◆ isBad()

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.

◆ isEof()

bool RWDataInputStream::isEof ( ) const
inline

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

◆ isFail()

bool RWDataInputStream::isFail ( ) const
inline

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

◆ isGood()

bool RWDataInputStream::isGood ( ) const
inline

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

◆ operator=()

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

Assignment operator. Throws no exceptions.

Parameters
handleA data stream handle used to initialize this handle.

◆ operator>>() [1/17]

RWDataInputStream & RWDataInputStream::operator>> ( bool & value)
inline

Reads a char value from the stream.

Parameters
valueThe bool value to be read from the stream.

◆ operator>>() [2/17]

RWDataInputStream & RWDataInputStream::operator>> ( char & value)
inline

Reads a char value from the stream.

Parameters
valueThe char value to be read from the stream.

◆ operator>>() [3/17]

RWDataInputStream & RWDataInputStream::operator>> ( double & value)
inline

Reads a double value from the stream.

Parameters
valueThe double value to be read from the stream.

◆ operator>>() [4/17]

RWDataInputStream & RWDataInputStream::operator>> ( float & value)
inline

Reads a float value from the stream.

Parameters
valueThe float value to be read from the stream.

◆ operator>>() [5/17]

RWDataInputStream & RWDataInputStream::operator>> ( int & value)
inline

Reads a int value from the stream.

Parameters
valueThe int value to be read from the stream.

◆ operator>>() [6/17]

RWDataInputStream & RWDataInputStream::operator>> ( long & value)
inline

Reads a long value from the stream.

Parameters
valueThe long value to be read from the stream.

◆ operator>>() [7/17]

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.

◆ operator>>() [8/17]

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.

◆ operator>>() [9/17]

RWDataInputStream & RWDataInputStream::operator>> ( RWDataInputStream &(* pf )(RWDataInputStream &))
inline

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.

◆ operator>>() [10/17]

RWDataInputStream RWDataInputStream::operator>> ( RWDataInputStream(* pf )(RWDataInputStream &))
inline

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.

◆ operator>>() [11/17]

RWDataInputStream & RWDataInputStream::operator>> ( short & value)
inline

Reads a short value from the stream.

Parameters
valueThe short value to be read from the stream.

◆ operator>>() [12/17]

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.

◆ operator>>() [13/17]

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.

◆ operator>>() [14/17]

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.

◆ operator>>() [15/17]

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.

◆ operator>>() [16/17]

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.

◆ operator>>() [17/17]

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.

◆ skip()

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 Symbol Documentation

◆ rwGuard()

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;
RWDataInputStream rwGuard(RWDataInputStream &stream)

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