Salad  1.0.15
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Typedefs | Functions
Sld_map

Data Structures

struct  sld_map
 

Typedefs

typedef struct sld_map sld_map
 

Functions

SLD_SSINT sld_map_init (struct sld_map *map)
 Initializes a sld_map. More...
 
SLD_UINT sld_map_size (struct sld_map *map)
 Returns the size of a sld_map. More...
 
SLD_SSINT sld_map_add (struct sld_map *map, char *key, void *value)
 Adds an object to a sld_map. More...
 
SLD_BOOL sld_map_delete (struct sld_map *map, char *key)
 Removes an object from a sld_map with the specified key. More...
 
SLD_BOOL sld_map_has_key (struct sld_map *map, char *key)
 Checks whether or not a sld_map contains the specified key. More...
 
void * sld_map_get_value (struct sld_map *map, char *key)
 Obtains the value from a sld_map using the specified key. More...
 
void * sld_map_key_at (struct sld_map *map, SLD_UINT index)
 Obtains the key from a sld_map at the specified index. More...
 
void * sld_map_value_at (struct sld_map *map, SLD_UINT index)
 Obtains the value from a sld_map at the specified index. More...
 
void sld_map_free (struct sld_map *map)
 Frees any memory allocated for an initialized sld_map. More...
 

Detailed Description

This module contains functions and structures related to sld_map objects.

Typedef Documentation

typedef struct sld_map sld_map

A sld_map contains key/value pairs

Function Documentation

SLD_SSINT sld_map_add ( struct sld_map map,
char *  key,
void *  value 
)
related

Adds an object to a sld_map.

Parameters
mapan initialized sld_map
keya key as a string
valuean arbitrary object
Returns
Success or failure
sld_map_add(&map, "foo", "bar");
Examples:
map.c.
SLD_BOOL sld_map_delete ( struct sld_map map,
char *  key 
)
related

Removes an object from a sld_map with the specified key.

Parameters
mapan initialized sld_map
keya key as a string
Returns
Success or failure
sld_map_delete(&map, "foo");
void sld_map_free ( struct sld_map map)
related

Frees any memory allocated for an initialized sld_map.

Parameters
mapan initialized sld_map
Examples:
map.c, and options.c.
void * sld_map_get_value ( struct sld_map map,
char *  key 
)
related

Obtains the value from a sld_map using the specified key.

Parameters
mapan initialized sld_map
keya key as a string
Returns
The object paired with the specified key
puts((char *)sld_map_get_value(&map, "foo"));
Examples:
map.c.
SLD_BOOL sld_map_has_key ( struct sld_map map,
char *  key 
)
related

Checks whether or not a sld_map contains the specified key.

Parameters
mapan initialized sld_map
keya key as a string
Returns
True or false
if(sld_map_has_key(&map, "foo"))
...
SLD_SSINT sld_map_init ( struct sld_map map)
related

Initializes a sld_map.

Parameters
mapan uninitialized sld_map
Returns
Success or failure
sld_map map;
Examples:
map.c, and options.c.
void * sld_map_key_at ( struct sld_map map,
SLD_UINT  index 
)
related

Obtains the key from a sld_map at the specified index.

Parameters
mapan initialized sld_map
indexan index where a key resides within the sld_map
Returns
The key residing at index
puts((char *)sld_map_key_at(&map, 5));
Examples:
options.c.
SLD_UINT sld_map_size ( struct sld_map map)
related

Returns the size of a sld_map.

Parameters
mapan initialized sld_map
Returns
The size of the passed sld_map
printf("Initial map size: %u\n", sld_map_size(&map));
Examples:
map.c, and options.c.
void * sld_map_value_at ( struct sld_map map,
SLD_UINT  index 
)
related

Obtains the value from a sld_map at the specified index.

Parameters
mapan initialized sld_map
indexan index where a value resides within the sld_map
Returns
The object residing at index
puts((char *)sld_map_value_at(&map, 1));
Examples:
options.c.