cbase 1.46.11
C/C++ Static Template
Loading...
Searching...
No Matches
base_strings.h File Reference

Sized string (string slice) definitions and helper macros. More...

#include "base_macros.h"
#include "base_types.h"
Include dependency graph for base_strings.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  String8
 A sized UTF-8 string slice. More...
struct  String8Node
 A node for a linked list of strings (String Builder). More...
struct  String8List
 A linked list of strings, useful for concatenating text without reallocation. More...

Macros

#define STR8(s)
 Wraps a C string literal into a String8 struct at compile time.
#define STR8_FMT(s)
 Helper macro to use a String8 in a printf-style format string. Example:

Typedefs

typedef struct String8 String8
 A sized UTF-8 string slice.
typedef struct String8Node String8Node
 A node for a linked list of strings (String Builder).
typedef struct String8List String8List
 A linked list of strings, useful for concatenating text without reallocation.

Functions

static String8 str8 (u8 *str, usize size)
 Creates a String8 from a raw pointer and size.
static String8 str8_range (u8 *first, u8 *one_past_last)
 Creates a String8 spanning from the first pointer to the one_past_last pointer.
static String8 str8_cstr (const char *cstr)
 Converts a standard null-terminated C string into a String8.
static String8 str8_prefix (String8 str, usize size)
 Returns a substring containing the first size bytes of the input string.
static String8 str8_skip (String8 str, usize amt)
 Returns a substring by skipping the first amt bytes of the input string.
static String8 str8_substr (String8 str, usize first, usize one_past_last)
 Returns a substring spanning from first to one_past_last indices.
static b32 str8_match (String8 a, String8 b)
 Checks if two String8s are exactly equal (case-sensitive).

Detailed Description

Sized string (string slice) definitions and helper macros.

  • Provides safe, allocation-free string manipulation using pointer/length pairs.

Definition in file base_strings.h.