SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Concrete class connecting a UTF-16 character stream to an input binary stream. More...
#include <rw/stream/RWUCharFromByteInputStreamImp.h>
Public Member Functions | |
virtual | ~RWUCharFromByteInputStreamImp () |
virtual void | close () |
virtual bool | isEof () const |
virtual bool | isBad () 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 | available () const |
virtual RWSize | skip (RWSize numUnits) |
Static Public Member Functions | |
static RWUCharInputStream | make (const RWByteInputStream &source) |
Protected Member Functions | |
RWUCharFromByteInputStreamImp (const RWByteInputStream &sourceStream) | |
RWByteInputStream & | getSourceStream () |
const RWByteInputStream & | getSourceStream () const |
Private Member Functions | |
void | getUChar (RWUChar &uc) |
RWSize | getUChars (RWUChar *ucAr, RWSize max) |
Static Private Member Functions | |
static void | swap2Bytes (RWUChar &uc) |
static void | swapnBytes (RWUChar *ucAr, RWSize n) |
Concrete class connecting a UTF-16 character stream to a binary stream. The UTF-16 characters are read as a sequence of bytes using the byte ordering (little endian or big endian) specified by the stream header. The stream header consists of the UTF-16 character U+FEFF
that is inserted in the stream when generating the output byte sequence. Implements the body idiom from the handle-body pattern.
virtual RWUCharFromByteInputStreamImp::~RWUCharFromByteInputStreamImp | ( | ) | [virtual] |
Destructor.
RWUCharFromByteInputStreamImp::RWUCharFromByteInputStreamImp | ( | const RWByteInputStream & | sourceStream | ) | [protected] |
Initializes the reference to the stream that will be used as the source of bytes.
sourceStream | The binary stream that will serve as the source of bytes. |
virtual RWSize RWUCharFromByteInputStreamImp::available | ( | ) | const [virtual] |
Returns the number of UTF-16 characters that can be read from the stream used as the source of bytes without blocking.
Implements RWInputStreamImp.
virtual void RWUCharFromByteInputStreamImp::close | ( | ) | [virtual] |
This function is forwarded to the binary stream used as the source of bytes. Throws no exceptions.
Implements RWStreamImp.
const RWByteInputStream& RWUCharFromByteInputStreamImp::getSourceStream | ( | ) | const [inline, protected] |
Returns a reference to the stream used as the source of bytes. They throw no exceptions.
RWByteInputStream& RWUCharFromByteInputStreamImp::getSourceStream | ( | ) | [inline, protected] |
Returns a reference to the stream used as the source of bytes. They throw no exceptions.
void RWUCharFromByteInputStreamImp::getUChar | ( | RWUChar & | uc | ) | [private] |
Reads a single UTF-16 character from the stream used as the source of bytes.
uc | A reference to a UTF-16 character that will be updated if the function succeeds. |
Reads an array of max UTF-16 characters from the stream used as the source of bytes. The function returns the actual number of UTF-16 characters read.
ucAr | A pre-allocated array. | |
max | The number of UTF-16 characters to be read. |
virtual bool RWUCharFromByteInputStreamImp::isBad | ( | ) | const [virtual] |
This function forwarded to the binary stream used as the source of bytes. Throws no exceptions.
Implements RWStreamImp.
virtual bool RWUCharFromByteInputStreamImp::isEof | ( | ) | const [virtual] |
This function forwarded to the binary stream used as the source of bytes. Throws no exceptions.
Implements RWInputStreamImp.
virtual bool RWUCharFromByteInputStreamImp::isFail | ( | ) | const [virtual] |
This function forwarded to the binary stream used as the source of bytes. Throws no exceptions.
Implements RWStreamImp.
virtual bool RWUCharFromByteInputStreamImp::isGood | ( | ) | const [virtual] |
This function forwarded to the binary stream used as the source of bytes. Throws no exceptions.
Implements RWStreamImp.
static RWUCharInputStream RWUCharFromByteInputStreamImp::make | ( | const RWByteInputStream & | source | ) | [inline, static] |
Constructs an RWUCharFromByteInputStreamImp instance that uses source as the source of bytes, and returns a handle to it.
source | The binary stream that is used as the source of bytes. |
virtual RWSize RWUCharFromByteInputStreamImp::read | ( | RWUChar * | unicodeArray, | |
RWSize | numUChars | |||
) | [virtual] |
Reads 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.
unicodeArray | A pointer to the first element of the array. | |
numUChars | The number of UTF-16 characters(s) to be read from the stream. |
Implements RWUCharInputStreamImp.
virtual RWUChar RWUCharFromByteInputStreamImp::read | ( | ) | [virtual] |
This function forwarded to the binary stream used as the source of bytes. Throws no exceptions.
Implements RWUCharInputStreamImp.
virtual RWSize RWUCharFromByteInputStreamImp::readUntil | ( | RWUChar * | unicodeArray, | |
RWSize | maxSize, | |||
RWUChar | delim | |||
) | [virtual] |
Reads 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 read are stored in unicodeArray. The function returns the actual number of UTF-16 characters inserted into unicodeArray. If the last UTF-16 character extracted is equal to delim, then it is not stored in unicodeArray.
unicodeArray | A pointer to the array receiving the UTF-16 characters extracted from the stream. | |
maxSize | The maximum number of UTF-16 characters to be read. | |
delim | The UTF-16 character used as a delimiter. |
Implements RWUCharInputStreamImp.
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.
numUnits | The number of UTF-16 characters to be skipped. |
Implements RWInputStreamImp.
static void RWUCharFromByteInputStreamImp::swap2Bytes | ( | RWUChar & | uc | ) | [inline, static, private] |
Swap the Hi
and Lo
bytes of a single UTF-16 character. Throws no exceptions.
uc | A reference to a UTF-16 character that will have its bytes swapped. |
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.