MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / ImTextStrToUtf8

Function ImTextStrToUtf8

extern/imgui/imgui.cpp:2169–2183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2167}
2168
2169int ImTextStrToUtf8(char* out_buf, int out_buf_size, const ImWchar* in_text, const ImWchar* in_text_end)
2170{
2171 char* buf_p = out_buf;
2172 const char* buf_end = out_buf + out_buf_size;
2173 while (buf_p < buf_end - 1 && (!in_text_end || in_text < in_text_end) && *in_text)
2174 {
2175 unsigned int c = (unsigned int)(*in_text++);
2176 if (c < 0x80)
2177 *buf_p++ = (char)c;
2178 else
2179 buf_p += ImTextCharToUtf8_inline(buf_p, (int)(buf_end - buf_p - 1), c);
2180 }
2181 *buf_p = 0;
2182 return (int)(buf_p - out_buf);
2183}
2184
2185int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end)
2186{

Callers 2

InputTextExMethod · 0.85

Calls 1

ImTextCharToUtf8_inlineFunction · 0.85

Tested by

no test coverage detected