SourcePro® API Reference Guide

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

Handle class for all narrow character input stream implementation classes. More...

#include <rw/stream/RWCharInputStream.h>

Inheritance diagram for RWCharInputStream:
RWHandleBase

Public Member Functions

 RWCharInputStream (RWCharInputStreamImp *ptr)
 
 RWCharInputStream (const RWCharInputStream &handle)
 
RWSize available () const
 
void close ()
 
bool isBad () const
 
bool isEof () const
 
bool isFail () const
 
bool isGood () const
 
RWCharInputStreamoperator= (const RWCharInputStream &handle)
 
RWCharInputStreamoperator>> (RWCharInputStream &(*pf)(RWCharInputStream &))
 
RWCharInputStream operator>> (RWCharInputStream(*pf)(RWCharInputStream &))
 
RWCharInputStreamoperator>> (char &charValue)
 
char read ()
 
RWSize read (char *charArray, RWSize numChars)
 
void readStringUntil (RWCString &string, char delim= ' ')
 
RWSize readUntil (char *charArray, RWSize maxSize, char delim)
 
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.)

RWCharInputStreamrwDisc (RWCharInputStream &stream)
 
RWCharInputStream rwGuard (RWCharInputStream &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 narrow character input stream implementation classes. Implements the handle idiom from the handle-body pattern.

Constructor & Destructor Documentation

RWCharInputStream::RWCharInputStream ( RWCharInputStreamImp ptr)
inlineexplicit

Constructor.

RWCharInputStream::RWCharInputStream ( const RWCharInputStream handle)
inline

Copy constructor.

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

Member Function Documentation

RWSize RWCharInputStream::available ( ) const
inline

Returns the number of narrow characters that can be read from the attached source stream without blocking. Throws no exceptions.

void RWCharInputStream::close ( )
inline

Closes the stream.

bool RWCharInputStream::isBad ( ) const
inline

Returns true to indicate a loss of integrity resulting from an input, such as an irrecoverable read error from a file.

bool RWCharInputStream::isEof ( ) const
inline

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

bool RWCharInputStream::isFail ( ) const
inline

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

bool RWCharInputStream::isGood ( ) const
inline

Returns true to indicate a stream in a valid state.

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

Assignment operator. Throws no exceptions.

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

Extractor executing a manipulator function.

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

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.
RWCharInputStream& RWCharInputStream::operator>> ( char &  charValue)
inline

Reads a single narrow character from the stream.

Parameters
charValueThe narrow character to be read from the stream.
char RWCharInputStream::read ( )
inline

Reads a single narrow character from the stream.

RWSize RWCharInputStream::read ( char *  charArray,
RWSize  numChars 
)
inline

Reads an array of narrow characters from the stream. The array must be pre-allocated to contain at list numChars elements. The function returns the actual number of narrow characters read from the stream.

Parameters
charArrayA pointer to the first element of the array.
numCharsThe number of narrow characters to be read from the stream.
void RWCharInputStream::readStringUntil ( RWCString string,
char  delim = ' ' 
)
inline

Reads narrow character(s) from the attached source stream until the last character read is equal to delim, or the end of the input sequence is reached. The narrow character(s) read are stored in a narrow string object.

Parameters
stringA string object receiving the narrow character(s) extracted from the stream.
delimThe narrow character used as a delimiter.
RWSize RWCharInputStream::readUntil ( char *  charArray,
RWSize  maxSize,
char  delim 
)
inline

Reads narrow character(s) from the attached source stream until the last narrow character read is equal to delim, or maxSize narrow character(s) have been read, or the end of the input sequence is reached. The narrow character(s) read are stored in charArray. The function returns the actual number of narrow character(s) read from the stream.

Parameters
charArrayA pointer to the array receiving the narrow character(s) extracted from the stream.
maxSizeThe maximum number of narrow character(s) to be read.
delimThe narrow character value used as a delimiter.
RWSize RWCharInputStream::skip ( RWSize  numUnits)
inline

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.

Parameters
numUnitsThe number of narrow characters to be skipped.

Friends And Related Function Documentation

RWCharInputStream & rwDisc ( RWCharInputStream stream)
related

Manipulator that discards a narrow character from a stream input sequence.

Parameters
streamThe narrow character stream.
RWCharInputStream rwGuard ( RWCharInputStream stream)
related
Header File
#include <rw/stream/RWGuardedCharInputStreamImp.h>

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

Parameters
streamA narrow character 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.