BloombergLP::bslfmt::FormatterString_GraphemeCluster::extract

Extract a grapheme cluster from no more than the specified maxBytes of the byte stream at the specified bytes location in the specified encoding. Behavior is undefined if the input bytes are not in the specified encoding. Unicode Byte Order Markers are not supported and behavior is undefined if the input data contains an embedded BOM. Endianness is assumed to be that of the type pointed to by bytes.

Synopsis

Declared in <bslfmt_formatterstring.h>

void
extract(
    UnicodeCodePoint::UtfEncoding encoding,
    void const* bytes,
    size_t maxBytes);

Description

For UTF-8, behavior is undefined if bytes is not a valid pointer to an array of numBytes unsigned char types in contiguous memory.

For UTF-16, behavior is undefined if bytes is not a valid pointer to an array of numBytes/2 wchar_t types in contiguous memory. Behavior is undefined if 2 != sizeof(wchar_t). Endianness is assumed to be the same as for the wchar_t type and Byte Order Markers are not supported.

For UTF-32, behavior is undefined if bytes is not a valid pointer to an array of numBytes/4 wchar_t types in contiguous memory. Behavior is undefined if 4 != sizeof(wchar_t). Endianness is assumed to be the same as for the wchar_t type and Byte Order Markers are not supported.