BloombergLP::bdlde::Utf8Util::isValidCodePoint

Return whether codePoint begins a valid UTF-8 code point.

Synopsis

Declared in <bdlde_utf8util.h>

static
bool
isValidCodePoint(
    int* status,
    char const* codePoint,
    size_type numBytes);

Description

If the specified codePoint (having at least the specified numBytes) refers to a valid UTF-8 code point then return true and load the specified status with the number of bytes in the code-point; otherwise, if codePoint is not a valid code-point, return false and load status with one of the (negative) ErrorStatus constants. The behavior is undefined unless numBytes > 0.

Return Value

true if codePoint is valid UTF-8, and false otherwise

Parameters

NameDescription
statusreceives byte length on success, or an ErrorStatus value
codePointcandidate first byte of a UTF-8 code point
numBytesnumber of bytes available at codePoint