Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
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 con-
       fig and map. They are defined in	map.h.

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

       struct map* map_init(void)
	      Allocates	and returns a new string map. String maps only support
	      string values.

       struct map* map_init_void(void)
	      Allocates	and returns a new void map. A void map supports	values
	      of any type.

       void map_free(struct map* map)
	      Frees the	provided map and all it's keys.	Values are only	 freed
	      if it is a string	map.

       bool map_put(struct map*	map, const char* key, char* value)
	      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 run-
	      ning 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().

       bool map_put_void(struct	map* map, const	char* key, void* value)
	      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 run-
	      ning 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().

       void* map_get(struct map* map, const char* key)
	      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.

       bool map_contains(struct	map* map, const	char* key)
	      Returns true if the key exists, false otherwise. This is	imple-
	      mented 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.

       size_t map_size(struct map* map)
	      Returns the number of entries in this map.

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

								   wofi-map(3)

NAME | DESCRIPTION | MAP FUNCTIONS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=wofi-map&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help