SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWByteInputStream Class Reference

Handle class for all binary input stream implementation classes. More...

#include <rw/stream/RWByteInputStream.h>

Inheritance diagram for RWByteInputStream:
RWHandleBase

Public Member Functions

 RWByteInputStream (const RWByteInputStream &handle)
 
 RWByteInputStream (RWByteInputStreamImp *ptr)
 
RWSize available () const
 
void close ()
 
bool isBad () const
 
bool isEof () const
 
bool isFail () const
 
bool isGood () const
 
RWByteInputStreamoperator= (const RWByteInputStream &handle)
 
RWByteInputStreamoperator>> (RWByte &byteValue)
 
RWByteInputStreamoperator>> (RWByteInputStream &(*pf)(RWByteInputStream &))
 
RWByteInputStream operator>> (RWByteInputStream(*pf)(RWByteInputStream &))
 
RWByte read ()
 
RWSize read (RWByte *byteArray, RWSize numBytes)
 
RWSize readUntil (RWByte *byteArray, RWSize maxSize, RWByte 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< RWByteInputStream, RWFilteredByteInputStreamImp >
 

Related Symbols

(Note that these are not member symbols.)

RWByteInputStreamrwDisc (RWByteInputStream &stream)
 
RWByteInputStream rwGuard (RWByteInputStream &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 binary input stream implementation classes. Implement the handle idiom from the handle-body pattern.

Constructor & Destructor Documentation

◆ RWByteInputStream() [1/2]

RWByteInputStream::RWByteInputStream ( RWByteInputStreamImp * ptr)
inlineexplicit

Constructor.

◆ RWByteInputStream() [2/2]

RWByteInputStream::RWByteInputStream ( const RWByteInputStream & handle)
inline

Copy constructor. Throws no exceptions.

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

Member Function Documentation

◆ available()

RWSize RWByteInputStream::available ( ) const
inline

Returns the number of bytes that can be read from the stream without blocking.

◆ close()

void RWByteInputStream::close ( )
inline

Closes the stream.

◆ isBad()

bool RWByteInputStream::isBad ( ) const
inline

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

◆ isEof()

bool RWByteInputStream::isEof ( ) const
inline

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

◆ isFail()

bool RWByteInputStream::isFail ( ) const
inline

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

◆ isGood()

bool RWByteInputStream::isGood ( ) const
inline

Returns true to indicate a stream in a valid state.

◆ operator=()

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

Assignment operator. Throws no exceptions.

Parameters
handleA binary stream handle used to initialize this handle.

◆ operator>>() [1/3]

RWByteInputStream & RWByteInputStream::operator>> ( RWByte & byteValue)
inline

Reads a single byte from the stream.

Parameters
byteValueThe byte to be read from the stream.

◆ operator>>() [2/3]

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

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.

◆ operator>>() [3/3]

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

Extractor executing a manipulator function.

Parameters
pfThe manipulator's function pointer.

◆ read() [1/2]

RWByte RWByteInputStream::read ( )
inline

Reads a single byte from the stream.

◆ read() [2/2]

RWSize RWByteInputStream::read ( RWByte * byteArray,
RWSize numBytes )
inline

Reads an array of bytes from the stream. The array must be pre-allocated to contain at least numBytes elements. The function returns the actual number of bytes extracted from the stream.

Parameters
byteArrayA pointer to the first element of the array.
numBytesThe number of bytes to be read from the stream.

◆ readUntil()

RWSize RWByteInputStream::readUntil ( RWByte * byteArray,
RWSize maxSize,
RWByte delim )
inline

Reads bytes from the stream until the last byte read is equal to delim, or maxSize bytes have been read, or the end of the input sequence is reached. The bytes read are stored in byteArray. The function returns the actual number of bytes read from the stream.

Parameters
byteArrayA pointer to the array receiving the bytes extracted from the stream.
maxSizeThe maximum number of bytes to be read.
delimThe byte value used as a delimiter.

◆ skip()

RWSize RWByteInputStream::skip ( RWSize numUnits)
inline

Skips numUnits bytes from the input sequence if possible. The function returns the actual number of bytes skipped, which can be any value between 0 and numUnits.

Parameters
numUnitsThe number of bytes to be skipped.

Friends And Related Symbol Documentation

◆ rwDisc()

RWByteInputStream & rwDisc ( RWByteInputStream & stream)
related

Manipulator that discards a byte from a stream input sequence.

Parameters
streamThe binary stream.

◆ rwGuard()

RWByteInputStream rwGuard ( RWByteInputStream & stream)
related
Header File
#include <rw/stream/RWGuardedByteInputStreamImp.h>

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

Parameters
streamA binary 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 extractions:
instr >> rwGuard >> data1 >> data2 >> data3;
RWByteInputStream rwGuard(RWByteInputStream &stream)

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