|
liboggz
1.1.1
|
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. More... | |
| void | oggz_table_delete (OggzTable *table) |
| Delete an OggzTable. More... | |
| void * | oggz_table_insert (OggzTable *table, long key, void *data) |
| Insert an element into a table. More... | |
| int | oggz_table_remove (OggzTable *table, long key) |
| Remove the element of an OggzTable indexed by a given key. More... | |
| void * | oggz_table_lookup (OggzTable *table, long key) |
| Retrieve the element of an OggzTable indexed by a given key. More... | |
| int | oggz_table_size (OggzTable *table) |
| Query the number of elements in an OggzTable. More... | |
| void * | oggz_table_nth (OggzTable *table, int n, long *key) |
| Retrieve the nth element of an OggzTable, and optionally its key. More... | |
A lookup table.
OggzTable is provided for convenience to allow the storage of serialno-specific data.
| void oggz_table_delete | ( | OggzTable * | table | ) |
Delete an OggzTable.
| table | An OggzTable |
| 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 | ||
| ) |
Retrieve the element of an OggzTable indexed by a given key.
| table | An OggzTable |
| key | a key |
| NULL | table is undefined, or no element is indexed by key |
| OggzTable* oggz_table_new | ( | void | ) |
Instantiate a new OggzTable.
| NULL | Could not allocate memory for table |
| 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 | ||
| ) |
Remove the element of an OggzTable indexed by a given key.
| table | An OggzTable |
| key | a key |
| 0 | Success |
| -1 | Not found |
| int oggz_table_size | ( | OggzTable * | table | ) |
Query the number of elements in an OggzTable.
| table | An OggzTable |
1.8.18