MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / ImParseFormatFindEnd

Function ImParseFormatFindEnd

KBotExt/imgui/imgui_widgets.cpp:3256–3271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3254}
3255
3256const char* ImParseFormatFindEnd(const char* fmt)
3257{
3258 // Printf/scanf types modifiers: I/L/h/j/l/t/w/z. Other uppercase letters qualify as types aka end of the format.
3259 if (fmt[0] != '%')
3260 return fmt;
3261 const unsigned int ignored_uppercase_mask = (1 << ('I' - 'A')) | (1 << ('L' - 'A'));
3262 const unsigned int ignored_lowercase_mask = (1 << ('h' - 'a')) | (1 << ('j' - 'a')) | (1 << ('l' - 'a')) | (1 << ('t' - 'a')) | (1 << ('w' - 'a')) | (1 << ('z' - 'a'));
3263 for (char c; (c = *fmt) != 0; fmt++)
3264 {
3265 if (c >= 'A' && c <= 'Z' && ((1 << (c - 'A')) & ignored_uppercase_mask) == 0)
3266 return fmt + 1;
3267 if (c >= 'a' && c <= 'z' && ((1 << (c - 'a')) & ignored_lowercase_mask) == 0)
3268 return fmt + 1;
3269 }
3270 return fmt;
3271}
3272
3273// Extract the format out of a format string with leading or trailing decorations
3274// fmt = "blah blah" -> return ""

Calls

no outgoing calls

Tested by

no test coverage detected