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

UTF-16 encoding data sink. More...

#include <cc/Utf16Sink>

Public Member Functions

 Utf16Sink (const Stream &stream, ByteOrder endian=ByteOrder::BigEndian)
 Create a new UTF-16 encoding data sink.
 
 Utf16Sink (const Stream &stream, const Bytes &buffer, ByteOrder endian=ByteOrder::BigEndian)
 Create a new UTF-16 encoding data sink.
 
 Utf16Sink (const Bytes &buffer, ByteOrder endian=ByteOrder::BigEndian)
 Create a new UTF-16 encoding data sink.
 
void writeByteOrderMark ()
 Write the optional Byte Order Mark (BOM).
 
void write (char32_t ch)
 Write an Unicode character ch.
 
long long currentOffset () const
 Get the total number of bytes written.
 

Detailed Description

UTF-16 encoding data sink.

Exceptions
UnicodeError

Constructor & Destructor Documentation

◆ Utf16Sink() [1/3]

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

Create a new UTF-16 encoding data sink.

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

◆ Utf16Sink() [2/3]

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

Create a new UTF-16 encoding data sink.

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

◆ Utf16Sink() [3/3]

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

Create a new UTF-16 encoding data sink.

Parameters
bufferOutput buffer
endianByte order of the 16 bit words transmitted

Member Function Documentation

◆ writeByteOrderMark()

void writeByteOrderMark ( )

Write the optional Byte Order Mark (BOM).

The BOM is the first 16 bit word of the transmission. It signifies the byte order for the following words. (The value of the BOM is 0xFEFF).

◆ write()

void write ( char32_t ch)

Write an Unicode character ch.

◆ currentOffset()

long long currentOffset ( ) const

Get the total number of bytes written.