|
cbase 1.50.0
C/C++ Static Template
|
Allocator-agnostic StringBuilder for efficient string concatenation. More...
#include "base_macros.h"#include "base_strings.h"#include "base_types.h"#include "memory/mem_allocator.h"#include <stdarg.h>#include <stdio.h>

Go to the source code of this file.
Classes | |
| struct | StringBuilder |
| An allocator-agnostic string builder. More... | |
Typedefs | |
| typedef struct StringBuilder | StringBuilder |
| An allocator-agnostic string builder. | |
Functions | |
| static void | sb_append (StringBuilder *sb, MemAllocator *alloc, String8 str) |
| Appends a String8 slice to the builder. | |
| static void | sb_append_cstr (StringBuilder *sb, MemAllocator *alloc, const char *cstr) |
| Appends a null-terminated C string to the builder. | |
| static void | sb_append_fmt (StringBuilder *sb, MemAllocator *alloc, const char *fmt,...) |
| Appends a printf-style formatted string to the builder. | |
| static String8 | sb_join (StringBuilder *sb, MemAllocator *out_alloc) |
| Materializes all appended segments into a single contiguous String8. | |
| static void | sb_reset (StringBuilder *sb) |
| Resets the builder to empty without touching the allocator. | |
Allocator-agnostic StringBuilder for efficient string concatenation.
A StringBuilder accumulates string segments as a singly-linked list of String8Node chunks, each allocated from a caller-supplied MemAllocator. No copying occurs during appending - the final contiguous String8 is only materialized when sb_join() is called.
Definition in file str_builder.h.