MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / utf16_to_code_point

Function utf16_to_code_point

extlibs/sol3/include/sol/sol.hpp:11588–11623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11586
11587 template <typename It>
11588 inline decoded_result<It> utf16_to_code_point(It it, It last) {
11589 decoded_result<It> dr;
11590 if (it == last) {
11591 dr.next = it;
11592 dr.error = error_code::sequence_too_short;
11593 return dr;
11594 }
11595
11596 char16_t lead = static_cast<char16_t>(*it);
11597
11598 if (!unicode_detail::is_surrogate(lead)) {
11599 ++it;
11600 dr.codepoint = static_cast<char32_t>(lead);
11601 dr.next = it;
11602 dr.error = error_code::ok;
11603 return dr;
11604 }
11605 if (!unicode_detail::is_lead_surrogate(lead)) {
11606 dr.error = error_code::invalid_leading_surrogate;
11607 dr.next = it;
11608 return dr;
11609 }
11610
11611 ++it;
11612 auto trail = *it;
11613 if (!unicode_detail::is_trail_surrogate(trail)) {
11614 dr.error = error_code::invalid_trailing_surrogate;
11615 dr.next = it;
11616 return dr;
11617 }
11618
11619 dr.codepoint = unicode_detail::combine_surrogates(lead, trail);
11620 dr.next = ++it;
11621 dr.error = error_code::ok;
11622 return dr;
11623 }
11624
11625 template <typename It>
11626 inline decoded_result<It> utf32_to_code_point(It it, It last) {

Callers 2

convert_intoMethod · 0.85
pushMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected