BloombergLP::bdlde::CharConvertUtf16::computeRequiredUtf16Words

Return the UTF-16 word count needed for the given UTF-8 input.

Synopsis

Declared in <bdlde_charconvertutf16.h>

static
std::size_t
computeRequiredUtf16Words(
    char const* srcBuffer,
    char const* endPtr = 0);

Description

Return the number of words required to store the translation of the specified UTF-8 string srcBuffer into a 0 terminated UTF-16 string (including the 0 terminating word into the returned count). Optionally specify endPtr, referring to one past the last input character. If endPtr is not supplied, or is 0, treat srcBuffer as 0 terminated. Note that this function will return the size utf8ToUtf16 will require, assuming the errorWord argument to utf8ToUtf16 is non-zero.

Return Value

the number of UTF-16 words required, including the terminating 0

Parameters

NameDescription
srcBuffersource buffer to measure
endPtrone past the last input character, or 0 if null-terminated