chsvlib
chsv helper source code

◆ u8blen() [3/3]

constexpr std::size_t Chusov::String::u8blen ( ucp_t  ucp)
constexprnoexcept

Returns the byte size of a UTF-8 representation of a given Unicode code point.

Template Parameters
do_full_checksspecifies whether the function should perform all checks for validity of the input UTF-8 code as specified by the section 3.9 of the Unicode 11.0 standard. The template parameter is ignored for now.
throw_on_failureA boolean flag which specifies whether the function should throw an exception should the code point ucp be invalid. If the flag is false, the function is marked noexcept and in case of an invalid code point value returns
std::size_t(-1)
. The default value is true.
Parameters
ucpis a Unicode 11.0 code point. See ucp_t.
Returns
On success the function returns a byte size of the UTF-8 representation of ucp. On failure, if throw_on_failure is false, the function returns
std::size_t(-1)
.
Exceptions
Chusov::Exceptions::InvalidCharSequenceExceptionThe value of ucp specifies an invalid Unicode 11.0 code point. The exception is only thrown when throw_on_failure is true.