|
liboggz 1.1.3
|
A lookup table. More...
Go to the source code of this file.
Typedefs | |
| typedef void | OggzTable |
| A table of key-value pairs. | |
Functions | |
| OggzTable * | oggz_table_new (void) |
| Instantiate a new OggzTable. | |
| void | oggz_table_delete (OggzTable *table) |
| Delete an OggzTable. | |
| void * | oggz_table_insert (OggzTable *table, long key, void *data) |
| Insert an element into a table. | |
| int | oggz_table_remove (OggzTable *table, long key) |
| Remove the element of an OggzTable indexed by a given key. | |
| void * | oggz_table_lookup (OggzTable *table, long key) |
| Retrieve the element of an OggzTable indexed by a given key. | |
| int | oggz_table_size (OggzTable *table) |
| Query the number of elements in an OggzTable. | |
| void * | oggz_table_nth (OggzTable *table, int n, long *key) |
| Retrieve the nth element of an OggzTable, and optionally its key. | |
A lookup table.
OggzTable is provided for convenience to allow the storage of serialno-specific data.
| void * oggz_table_insert | ( | OggzTable * | table, |
| long | key, | ||
| void * | data ) |
Insert an element into a table.
If a previous value existed for this key, it is overwritten with the new data element.
| table | An OggzTable |
| key | Key to access this data element |
| data | The new element to add |
| data | If the element was successfully added |
| NULL | If adding the element failed due to a realloc() error |
| void * oggz_table_lookup | ( | OggzTable * | table, |
| long | key ) |
| OggzTable * oggz_table_new | ( | void | ) |
| void * oggz_table_nth | ( | OggzTable * | table, |
| int | n, | ||
| long * | key ) |
Retrieve the nth element of an OggzTable, and optionally its key.
| table | An OggzTable |
| n | An index into the table |
| key | Return pointer for key corresponding to nth data element of table. Ignored if NULL. |
| NULL | table is undefined, or n is out of range |
| int oggz_table_remove | ( | OggzTable * | table, |
| long | key ) |