utils/symap.h file

API for Symap, a basic symbol map (string interner).

Contents

Particularly useful for implementing LV2 URI mapping.

Functions

auto symap_new(void) -> Symap*
Create a new symbol map.
void symap_free(Symap* map)
Free a symbol map.
auto symap_try_map(Symap* map, const char* sym) -> uint32_t
Map a string to a symbol ID if it is already mapped, otherwise return 0.
auto symap_map(Symap* map, const char* sym) -> uint32_t
Map a string to a symbol ID.
auto symap_unmap(Symap* map, uint32_t id) -> const char*
Unmap a symbol ID back to a symbol, or NULL if no such ID exists.

Function documentation

uint32_t symap_map(Symap* map, const char* sym)

Map a string to a symbol ID.

Note that 0 is never a valid symbol ID.

const char* symap_unmap(Symap* map, uint32_t id)

Unmap a symbol ID back to a symbol, or NULL if no such ID exists.

Note that 0 is never a valid symbol ID.