Scroll to navigation

wofi-map(3) Library Functions Manual wofi-map(3)

NAME

wofi - Map API functions and documentation

DESCRIPTION

The functions documented here are used for interacting with wofi's config and map. They are defined in map.h.

MAP FUNCTIONS

The following functions are used to interact with a struct map*

Allocates and returns a new string map. String maps only support string values.

Allocates and returns a new void map. A void map supports values of any type.

Frees the provided map and all it's keys. Values are only freed if it is a string map.

Returns true if the given map is a string map, otherwise returns false and prints a message to stderr.

struct map* map - The map to insert into.

const char* key - The key to store the value under. This key is given to strdup() before being saved and will be freed when running map_free().

char* value - The value to store. This value is given to strdup() before being saved and will be freed when running map_free(). If the value is NULL it will not be given to strdup().

Returns true if the given map is a void map, otherwise returns false and prints a message to stderr.

struct map* map - The map to insert into.

const char* key - The key to store the value under. This key is given to strdup() before being saved and will be freed when running map_free().

void* value - The value to store. This pointer is stored in the map, it is on the caller to free this and it will not be freed when running map_free().

Returns the value stored under key or NULL if no key exists. NULL can also be returned if it was stored there with map_put() or map_put_void().

struct map* map - The map to get the value from.

const char* key - The key to lookup.

Returns true if the key exists, false otherwise. This is implemented as a value != NULL check so a NULL value is considered to not exist.

struct map* map - The map to check against.

const char* key - The key to check for.

Returns the number of entries in this map.

struct map* map - The map to get the size of.