SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWUCharFromUTF8ByteInputStreamImp Class Reference

Concrete class connecting a UTF-16 character stream to a UTF-8 binary stream. More...

#include <rw/stream/RWUCharFromUTF8ByteInputStreamImp.h>

Inheritance diagram for RWUCharFromUTF8ByteInputStreamImp:
RWUCharInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

Public Member Functions

virtual ~RWUCharFromUTF8ByteInputStreamImp ()
 
virtual RWSize available () const
 
virtual void close ()
 
virtual bool isBad () const
 
virtual bool isEof () const
 
virtual bool isFail () const
 
virtual bool isGood () const
 
virtual RWUChar read ()
 
virtual RWSize read (RWUChar *unicodeArray, RWSize numUChars)
 
virtual RWSize readUntil (RWUChar *unicodeArray, RWSize maxSize, RWUChar delim)
 
virtual RWSize skip (RWSize numUnits)
 
- Public Member Functions inherited from RWUCharInputStreamImp
virtual ~RWUCharInputStreamImp ()
 
virtual RWUCharInputStream acquire ()
 
virtual void release ()
 
- Public Member Functions inherited from RWInputStreamImp
virtual ~RWInputStreamImp ()
 
- Public Member Functions inherited from RWStreamImp
virtual ~RWStreamImp ()
 

Static Public Member Functions

static RWUCharInputStream make (const RWByteInputStream &source)
 

Protected Member Functions

 RWUCharFromUTF8ByteInputStreamImp (const RWByteInputStream &sourceStream)
 
RWByteInputStreamgetSourceStream ()
 
const RWByteInputStreamgetSourceStream () const
 
- Protected Member Functions inherited from RWUCharInputStreamImp
 RWUCharInputStreamImp ()
 
- Protected Member Functions inherited from RWInputStreamImp
 RWInputStreamImp ()
 
- Protected Member Functions inherited from RWStreamImp
 RWStreamImp ()
 
- Protected Member Functions inherited from RWBodyBase
 RWBodyBase (const RWBodyBase &second)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (void)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (unsigned initCount=0)
 
RWTCountingBody< RWMutexLock > & operator= (const RWTCountingBody< RWMutexLock > &second)
 
 ~RWTCountingBody (void)
 
unsigned addReference (void)
 
unsigned references (void) const
 
unsigned removeReference (void)
 
- Protected Member Functions inherited from RWTMonitor< RWMutexLock >
 RWTMonitor (const RWTMonitor< RWMutexLock > &second)
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (void)
 
 ~RWTMonitor (void)
 
void acquire (void)
 
bool isAcquired (void) const
 
RWTMonitor< RWMutexLock > & monitor (void) const
 
RWMutexLockmutex (void)
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release (void)
 
bool tryAcquire (void)
 

Additional Inherited Members

- Protected Types inherited from RWTCountingBody< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 
- Protected Types inherited from RWTMonitor< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 

Detailed Description

Concrete class connecting a UTF-16 character stream to a UTF-8 binary stream. The bytes read from the UTF-8 binary stream used as the source of bytes are transformed into UTF-16 characters.

UTF-8 is a variable length encoding of the UTF-16 Standard using 8-bit sequences, where the high bits indicate which part of the sequence a byte belongs to. Implements the body idiom from the handle-body pattern.

Constructor & Destructor Documentation

◆ ~RWUCharFromUTF8ByteInputStreamImp()

virtual RWUCharFromUTF8ByteInputStreamImp::~RWUCharFromUTF8ByteInputStreamImp ( )
virtual

Destructor.

◆ RWUCharFromUTF8ByteInputStreamImp()

RWUCharFromUTF8ByteInputStreamImp::RWUCharFromUTF8ByteInputStreamImp ( const RWByteInputStream & sourceStream)
protected

Initializes the reference to the stream that will be used as the source of bytes.

Parameters
sourceStreamThe binary stream that will serve as the source of bytes.

Member Function Documentation

◆ available()

virtual RWSize RWUCharFromUTF8ByteInputStreamImp::available ( ) const
virtual

Returns the minimum number of UTF-16 characters that can be read from the stream used as the source of bytes without blocking. The actual number might be greater than the number returned by this function.

Implements RWInputStreamImp.

◆ close()

virtual void RWUCharFromUTF8ByteInputStreamImp::close ( )
virtual

This function is forwarded to the binary stream used as the source of bytes. Throws no exceptions.

Implements RWStreamImp.

◆ getSourceStream() [1/2]

RWByteInputStream & RWUCharFromUTF8ByteInputStreamImp::getSourceStream ( )
inlineprotected

Returns a reference to the stream used as the source of bytes. They throw no exceptions.

◆ getSourceStream() [2/2]

const RWByteInputStream & RWUCharFromUTF8ByteInputStreamImp::getSourceStream ( ) const
inlineprotected

Returns a reference to the stream used as the source of bytes. They throw no exceptions.

◆ isBad()

virtual bool RWUCharFromUTF8ByteInputStreamImp::isBad ( ) const
virtual

This function is forwarded to the binary stream used as the source of bytes. Throws no exceptions.

Implements RWStreamImp.

◆ isEof()

virtual bool RWUCharFromUTF8ByteInputStreamImp::isEof ( ) const
virtual

This function is forwarded to the binary stream used as the source of bytes. Throws no exceptions.

Implements RWInputStreamImp.

◆ isFail()

virtual bool RWUCharFromUTF8ByteInputStreamImp::isFail ( ) const
virtual

This function is forwarded to the binary stream used as the source of bytes. Throws no exceptions.

Implements RWStreamImp.

◆ isGood()

virtual bool RWUCharFromUTF8ByteInputStreamImp::isGood ( ) const
virtual

This function is forwarded to the binary stream used as the source of bytes. Throws no exceptions.

Implements RWStreamImp.

◆ make()

static RWUCharInputStream RWUCharFromUTF8ByteInputStreamImp::make ( const RWByteInputStream & source)
inlinestatic

Constructs an RWUCharFromUTF8ByteInputStreamImp instance that uses source as the source of bytes, and returns a handle to it.

Parameters
sourceThe binary stream that is used as the source of bytes.

◆ read() [1/2]

virtual RWUChar RWUCharFromUTF8ByteInputStreamImp::read ( )
virtual

Reads and decodes a single UTF-16 character from the stream used as the source of bytes.

Implements RWUCharInputStreamImp.

◆ read() [2/2]

virtual RWSize RWUCharFromUTF8ByteInputStreamImp::read ( RWUChar * unicodeArray,
RWSize numUChars )
virtual

Reads and decodes an array of UTF-16 characters from the stream used as the source of bytes. The array must be pre-allocated to contain at least numUChars elements. The function returns the actual number of UTF-16 characters extracted from the stream.

Parameters
unicodeArrayA pointer to the first element of the array.
numUCharsThe number of UTF-16 characters to be read from the stream.

Implements RWUCharInputStreamImp.

◆ readUntil()

virtual RWSize RWUCharFromUTF8ByteInputStreamImp::readUntil ( RWUChar * unicodeArray,
RWSize maxSize,
RWUChar delim )
virtual

Reads and decodes UTF-16 characters from the stream used as the source of bytes until the last UTF-16 character read is equal to delim, or maxSize UTF-16 characters have been read, or the end of the input sequence is reached. The UTF-16 characters that are read are stored in unicodeArray. The function returns the actual number of UTF-16 characters inserted into unicodeArray. If the last character extracted is equal to delim, then it is not stored in unicodeArray.

Parameters
unicodeArrayA pointer to the array receiving the UTF-16 characters extracted from the stream.
maxSizeThe maximum number of UTF-16 characters to be read.
delimThe UTF-16 character used as a delimiter.

Implements RWUCharInputStreamImp.

◆ skip()

virtual RWSize RWUCharFromUTF8ByteInputStreamImp::skip ( RWSize numUnits)
virtual

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

Parameters
numUnitsThe number of UTF-16 characters to be skipped.

Implements RWInputStreamImp.

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