MCPcopy Create free account
hub / github.com/RenderKit/embree / appendfv

Method appendfv

tutorials/common/imgui/imgui.cpp:2512–2536  ·  view source on GitHub ↗

Helper: Text buffer for logging/accumulating text

Source from the content-addressed store, hash-verified

2510
2511// Helper: Text buffer for logging/accumulating text
2512void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
2513{
2514 va_list args_copy;
2515 va_copy(args_copy, args);
2516
2517 int len = ImFormatStringV(NULL, 0, fmt, args); // FIXME-OPT: could do a first pass write attempt, likely successful on first pass.
2518 if (len <= 0)
2519 {
2520 va_end(args_copy);
2521 return;
2522 }
2523
2524 // Add zero-terminator the first time
2525 const int write_off = (Buf.Size != 0) ? Buf.Size : 1;
2526 const int needed_sz = write_off + len;
2527 if (write_off + len >= Buf.Capacity)
2528 {
2529 int new_capacity = Buf.Capacity * 2;
2530 Buf.reserve(needed_sz > new_capacity ? needed_sz : new_capacity);
2531 }
2532
2533 Buf.resize(needed_sz);
2534 ImFormatStringV(&Buf[write_off - 1], (size_t)len + 1, fmt, args_copy);
2535 va_end(args_copy);
2536}
2537
2538void ImGuiTextIndex::append(const char* base, int old_size, int new_size)
2539{

Callers 2

LogTextVFunction · 0.80
DebugLogVMethod · 0.80

Calls 3

ImFormatStringVFunction · 0.85
reserveMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected