| 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) { |
nothing calls this directly
no test coverage detected