CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
Utf16Source Class Reference

UTF-16 decoding data source. More...

#include <cc/Utf16Source>

Public Member Functions

 Utf16Source (const Stream &stream, ByteOrder endian=ByteOrder::BigEndian)
 Create a new UTF-16 decoding data source.
 
 Utf16Source (const Stream &stream, const Bytes &buffer, ByteOrder endian=ByteOrder::BigEndian)
 Create a new UTF-16 decoding data source.
 
 Utf16Source (const Bytes &buffer, ByteOrder endian=ByteOrder::BigEndian)
 Create a new UTF-16 decoding data source.
 
bool read (Out< char32_t > ch)
 Read the next Unicode character.
 

Detailed Description

UTF-16 decoding data source.

A Byte Order Mark (BOM) at the start of the stream automatically sets endianess. The decoder is designed to be as strict as possible. It checks if the input streams delivers full 16-bit words and it requires a high surrogate to be followed by a low surrogate.

Constructor & Destructor Documentation

◆ Utf16Source() [1/3]

Utf16Source ( const Stream & stream,
ByteOrder endian = ByteOrder::BigEndian )

Create a new UTF-16 decoding data source.

Parameters
streamUnderlying data stream
endianByte order of the 16-bit words transmitted

◆ Utf16Source() [2/3]

Utf16Source ( const Stream & stream,
const Bytes & buffer,
ByteOrder endian = ByteOrder::BigEndian )

Create a new UTF-16 decoding data source.

Parameters
streamUnderlying data stream
bufferInput buffer
endianByte order of the 16-bit words transmitted

◆ Utf16Source() [3/3]

Utf16Source ( const Bytes & buffer,
ByteOrder endian = ByteOrder::BigEndian )

Create a new UTF-16 decoding data source.

Parameters
bufferInput buffer
endianByte order of the 16-bit words transmitted

Member Function Documentation

◆ read()

bool read ( Out< char32_t > ch)

Read the next Unicode character.

Parameters
chReturns the Unicode character read if any
Returns
True if not end of information, false otherwise