Go to the source code of this file.
|
static int | as_map_clear (as_map *map) |
|
AS_EXTERN as_map * | as_map_cons (as_map *map, bool free, uint32_t flags, const as_map_hooks *hooks) |
|
static void | as_map_destroy (as_map *map) |
|
static bool | as_map_foreach (const as_map *map, as_map_foreach_callback callback, void *udata) |
|
static as_map * | as_map_fromval (const as_val *val) |
|
static as_val * | as_map_get (const as_map *map, const as_val *key) |
|
static uint32_t | as_map_hashcode (const as_map *map) |
|
AS_EXTERN as_map * | as_map_init (as_map *map, const as_map_hooks *hooks) |
|
static union as_map_iterator_u * | as_map_iterator_init (union as_map_iterator_u *it, const as_map *map) |
|
static union as_map_iterator_u * | as_map_iterator_new (const as_map *map) |
|
AS_EXTERN as_map * | as_map_new (const as_map_hooks *hooks) |
|
static int | as_map_remove (as_map *map, const as_val *key) |
|
static int | as_map_set (as_map *map, const as_val *key, const as_val *val) |
|
static void | as_map_set_flags (as_map *map, uint32_t flags) |
|
static uint32_t | as_map_size (const as_map *map) |
|
static as_val * | as_map_toval (const as_map *map) |
|
AS_EXTERN void | as_map_val_destroy (as_val *val) |
|
AS_EXTERN uint32_t | as_map_val_hashcode (const as_val *val) |
|
AS_EXTERN char * | as_map_val_tostring (const as_val *val) |
|
◆ AS_MAP_FLAGS_MASK
#define AS_MAP_FLAGS_MASK 0x13 |
◆ as_map_foreach_callback
typedef bool(* as_map_foreach_callback) (const as_val *key, const as_val *value, void *udata) |
Callback function for as_map_foreach()
. Called for each entry in the map.
- Parameters
-
key | The key of the current entry. |
value | The value of the current entry. |
udata | The user-data provided to as_map_foreach() . |
- Returns
- true to continue iterating through the map. false to stop iterating.
Definition at line 49 of file as_map.h.
◆ as_map_clear()
static int as_map_clear |
( |
as_map * | map | ) |
|
|
inlinestatic |
Remove all entries from the map.
- Parameters
-
- Returns
- 0 on success. Otherwise an error occurred.
Definition at line 330 of file as_map.h.
◆ as_map_cons()
Utilized by subtypes of as_map to initialize the parent.
- Parameters
-
map | The map to initialize |
free | If TRUE, then as_map_destory() will free the map. |
flags | Map attributes. |
hooks | Implementaton for the map interface. |
- Returns
- The initialized as_map on success. Otherwise NULL.
◆ as_map_destroy()
static void as_map_destroy |
( |
as_map * | map | ) |
|
|
inlinestatic |
Destroy the as_map and associated resources.
Definition at line 254 of file as_map.h.
◆ as_map_foreach()
Call the callback function for each entry in the map.
- Parameters
-
map | The map. |
callback | The function to call for each entry. |
udata | User-data to be passed to the callback. |
- Returns
- true if iteration completes fully. false if iteration was aborted.
Definition at line 375 of file as_map.h.
◆ as_map_fromval()
◆ as_map_get()
Get the value for specified key.
- Parameters
-
- Returns
- The value for the specified key on success. Otherwise NULL.
Definition at line 302 of file as_map.h.
◆ as_map_hashcode()
static uint32_t as_map_hashcode |
( |
const as_map * | map | ) |
|
|
inlinestatic |
Hash value for the map
- Parameters
-
- Returns
- The hashcode value of the map.
Definition at line 271 of file as_map.h.
◆ as_map_init()
Initialize a stack allocated map.
- Parameters
-
map | Stack allocated map to initialize. |
hooks | Implementation for the map interface. |
- Returns
- On success, the initialized map. Otherwise NULL.
◆ as_map_iterator_init()
static union as_map_iterator_u * as_map_iterator_init |
( |
union as_map_iterator_u * | it, |
|
|
const as_map * | map ) |
|
static |
Initialzies a stack allocated iterator over the given map.
- Parameters
-
map | The map to iterate. |
it | The iterator to initialize. |
- Returns
- On success, the initializes as_iterator. Otherwise NULL.
Definition at line 402 of file as_map.h.
◆ as_map_iterator_new()
static union as_map_iterator_u * as_map_iterator_new |
( |
const as_map * | map | ) |
|
|
static |
Creates and initializes a new heap allocated iterator over the given map.
- Parameters
-
- Returns
- On success, a new as_iterator. Otherwise NULL.
Definition at line 388 of file as_map.h.
◆ as_map_new()
Create and initialize a new heap allocated map.
- Parameters
-
hooks | Implementation for the map interface. |
- Returns
- On success, a new map. Otherwise NULL.
◆ as_map_remove()
static int as_map_remove |
( |
as_map * | map, |
|
|
const as_val * | key ) |
|
inlinestatic |
Remove the entry specified by the key.
- Parameters
-
map | The map to remove the entry from. |
key | The key of the entry to be removed. |
- Returns
- 0 on success. Otherwise an error occurred.
Definition at line 345 of file as_map.h.
◆ as_map_set()
Set the value for specified key.
- Parameters
-
map | The map. |
key | The key. |
val | The value for the key. |
- Returns
- 0 on success. Otherwise an error occurred.
Definition at line 317 of file as_map.h.
◆ as_map_set_flags()
static void as_map_set_flags |
( |
as_map * | map, |
|
|
uint32_t | flags ) |
|
inlinestatic |
Set map attributes.
Definition at line 355 of file as_map.h.
◆ as_map_size()
static uint32_t as_map_size |
( |
const as_map * | map | ) |
|
|
inlinestatic |
Get the number of entries in the map.
- Parameters
-
- Returns
- The size of the map.
Definition at line 284 of file as_map.h.
◆ as_map_toval()
◆ as_map_val_destroy()
Internal helper function for destroying an as_val.
◆ as_map_val_hashcode()
Internal helper function for getting the hashcode of an as_val.
◆ as_map_val_tostring()
Internal helper function for getting the string representation of an as_val.