MCPcopy Create free account
hub / github.com/ThePhD/sol2 / convert

Function convert

include/sol/stack_get_unqualified.hpp:76–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74
75 template <typename Ch, typename F>
76 inline void convert(const char* strb, const char* stre, F&& f) {
77 char32_t cp = 0;
78 for (const char* strtarget = strb; strtarget < stre;) {
79 auto dr = unicode::utf8_to_code_point(strtarget, stre);
80 if (dr.error != unicode::error_code::ok) {
81 cp = unicode::unicode_detail::replacement;
82 ++strtarget;
83 }
84 else {
85 cp = dr.codepoint;
86 strtarget = dr.next;
87 }
88 if constexpr (std::is_same_v<Ch, char32_t>) {
89 auto er = unicode::code_point_to_utf32(cp);
90 f(er);
91 }
92 else {
93 auto er = unicode::code_point_to_utf16(cp);
94 f(er);
95 }
96 }
97 }
98
99 template <typename BaseCh, typename S>
100 inline S get_into(lua_State* L, int index, record& tracking) {

Callers

nothing calls this directly

Calls 3

utf8_to_code_pointFunction · 0.85
code_point_to_utf32Function · 0.85
code_point_to_utf16Function · 0.85

Tested by

no test coverage detected