SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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 (const RWCharInputStream &handle)
 
 RWCharInputStream (RWCharInputStreamImp *ptr)
 
RWSize available () const
 
void close ()
 
bool isBad () const
 
bool isEof () const
 
bool isFail () const
 
bool isGood () const
 
RWCharInputStreamoperator= (const RWCharInputStream &handle)
 
RWCharInputStreamoperator>> (char &charValue)
 
RWCharInputStreamoperator>> (RWCharInputStream &(*pf)(RWCharInputStream &))
 
RWCharInputStream operator>> (RWCharInputStream(*pf)(RWCharInputStream &))
 
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
 

Friends

class RWTStreamGuardImp< RWCharInputStream, RWFilteredCharInputStreamImp >
 

Related Symbols

(Note that these are not member symbols.)

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

Constructor & Destructor Documentation

◆ RWCharInputStream() [1/2]

RWCharInputStream::RWCharInputStream ( RWCharInputStreamImp * ptr)
inlineexplicit

Constructor.

◆ RWCharInputStream() [2/2]

RWCharInputStream::RWCharInputStream ( const RWCharInputStream & handle)
inline

Copy constructor.

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

Member Function Documentation

◆ available()

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.

◆ close()

void RWCharInputStream::close ( )
inline

Closes the stream.

◆ isBad()

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.

◆ isEof()

bool RWCharInputStream::isEof ( ) const
inline

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

◆ isFail()

bool RWCharInputStream::isFail ( ) const
inline

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

◆ isGood()

bool RWCharInputStream::isGood ( ) const
inline

Returns true to indicate a stream in a valid state.

◆ operator=()

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

Assignment operator. Throws no exceptions.

Parameters
handleA narrow stream handle used to initialize this handle.

◆ operator>>() [1/3]

RWCharInputStream & RWCharInputStream::operator>> ( char & charValue)
inline

Reads a single narrow character from the stream.

Parameters
charValueThe narrow character to be read from the stream.

◆ operator>>() [2/3]

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

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.

◆ operator>>() [3/3]

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

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.

◆ read() [1/2]

char RWCharInputStream::read ( )
inline

Reads a single narrow character from the stream.

◆ read() [2/2]

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.

◆ readStringUntil()

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.

◆ readUntil()

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.

◆ skip()

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

◆ rwDisc()

RWCharInputStream & rwDisc ( RWCharInputStream & stream)
related

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

Parameters
streamThe narrow character stream.

◆ rwGuard()

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

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