MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / ImTextStrFromUtf8

Function ImTextStrFromUtf8

examples/ThirdPartyLibs/imgui/imgui.cpp:1256–1273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1254}
1255
1256int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_text_remaining)
1257{
1258 ImWchar* buf_out = buf;
1259 ImWchar* buf_end = buf + buf_size;
1260 while (buf_out < buf_end - 1 && (!in_text_end || in_text < in_text_end) && *in_text)
1261 {
1262 unsigned int c;
1263 in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
1264 if (c == 0)
1265 break;
1266 if (c < 0x10000) // FIXME: Losing characters that don't fit in 2 bytes
1267 *buf_out++ = (ImWchar)c;
1268 }
1269 *buf_out = 0;
1270 if (in_text_remaining)
1271 *in_text_remaining = in_text;
1272 return (int)(buf_out - buf);
1273}
1274
1275int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end)
1276{

Callers 4

ImFileOpenFunction · 0.85
InputTextExMethod · 0.85

Calls 1

ImTextCharFromUtf8Function · 0.85

Tested by

no test coverage detected