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

Method appendfv

extern/imgui/imgui.cpp:2574–2598  ·  view source on GitHub ↗

Helper: Text buffer for logging/accumulating text

Source from the content-addressed store, hash-verified

2572
2573// Helper: Text buffer for logging/accumulating text
2574void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
2575{
2576 va_list args_copy;
2577 va_copy(args_copy, args);
2578
2579 int len = ImFormatStringV(NULL, 0, fmt, args); // FIXME-OPT: could do a first pass write attempt, likely successful on first pass.
2580 if (len <= 0)
2581 {
2582 va_end(args_copy);
2583 return;
2584 }
2585
2586 // Add zero-terminator the first time
2587 const int write_off = (Buf.Size != 0) ? Buf.Size : 1;
2588 const int needed_sz = write_off + len;
2589 if (write_off + len >= Buf.Capacity)
2590 {
2591 int new_capacity = Buf.Capacity * 2;
2592 Buf.reserve(needed_sz > new_capacity ? needed_sz : new_capacity);
2593 }
2594
2595 Buf.resize(needed_sz);
2596 ImFormatStringV(&Buf[write_off - 1], (size_t)len + 1, fmt, args_copy);
2597 va_end(args_copy);
2598}
2599
2600void ImGuiTextIndex::append(const char* base, int old_size, int new_size)
2601{

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