chsvlib
chsv helper source code

◆ u8_decode_string() [8/8]

std::basic_string<ucp_t, CharTraits, Allocator> Chusov::String::u8_decode_string ( InputIterator  it,
std::size_t  cbAvail 
)

Produces a C++ string of Unicode 11.0 code points from bytes of UTF-8 encoded characters.

Template Parameters
CharTraitsspecifies a CharTraits type used to instantiate the std::basic_string class in order to produce the output string. By default it is an instantiation of std::char_traits for the type ucp_t. Such specialization is provided by the chsvlib library to treat ucp_t based strings as case-sensitive and 0-terminated.
Allocatoris a type of an Allocator used to instantiate the returned string object. By default it resolves to
std::allocator<ucp_t>
.
InputIteratoris a deducible type of an input iterator of bytes of the UTF-8 string to convert.
Parameters
itis an iterator of input bytes of the UTF-8 string to convert to the returned ucp_t based string.
cbAvailspecifies the exact number of bytes constituting the input UTF-8 string.
Returns
A newly created string, an instantiation of std::basic_string, with Unicode 11.0 code points as its elements along with optionally specified CharTraits and Allocator.
Exceptions
Chusov::Exceptions::InvalidCharSequenceExceptionThe specified UTF-8 string is detected to contain an invalid or incomplete multi-byte UTF-8 character.
See also
ucp_string