libgutenprint API Reference
5.3.4
|
A simple reference cache. More...
#include <gutenprint/string-list.h>
Functions | |
int | stp_refcache_create (const char *name) |
Create a new object cache. More... | |
void * | stp_refcache_find_item (const char *cache, const char *item) |
Find an item in a cache. More... | |
int | stp_refcache_add_item (const char *cache, const char *item, void *data) |
Add an item to a cache. More... | |
void | stp_refcache_remove_item (const char *cache, const char *item) |
Remove an item from cache. More... | |
void | stp_refcache_replace_item (const char *cache, const char *item, void *data) |
Replace an item's data, or add if it doesn't exist. More... | |
void | stp_refcache_destroy (const char *cache) |
Destroy a cache. More... | |
const stp_string_list_t * | stp_refcache_list_caches (void) |
Return a static list of all caches in existence. More... | |
const stp_string_list_t * | stp_refcache_list_cache_items (const char *cache) |
Return a static list of items in a specified cache. More... | |
A simple reference cache.
int stp_refcache_add_item | ( | const char * | cache, |
const char * | item, | ||
void * | data | ||
) |
Add an item to a cache.
cache | the cache to use or create. |
item | the name of the item to cache |
data | pointer to the data item to store |
int stp_refcache_create | ( | const char * | name | ) |
Create a new object cache.
name | The name of the cache to create |
void stp_refcache_destroy | ( | const char * | cache | ) |
Destroy a cache.
The individual items are not freed. If cache does not exist this is a no-op.
cache | the cache to destroy. |
void* stp_refcache_find_item | ( | const char * | cache, |
const char * | item | ||
) |
Find an item in a cache.
cache | the cache to use. |
item | the name of the item to cache |
const stp_string_list_t* stp_refcache_list_cache_items | ( | const char * | cache | ) |
Return a static list of items in a specified cache.
cache | name of cache |
const stp_string_list_t* stp_refcache_list_caches | ( | void | ) |
Return a static list of all caches in existence.
void stp_refcache_remove_item | ( | const char * | cache, |
const char * | item | ||
) |
Remove an item from cache.
The item's data is not freed. If cache or item does not exist this is a no-op.
cache | the cache to use. |
item | the name of the item to remove from cache |
void stp_refcache_replace_item | ( | const char * | cache, |
const char * | item, | ||
void * | data | ||
) |
Replace an item's data, or add if it doesn't exist.
The old data (if any) is not freed. Fails if cache does not already exist.
cache | the cache to use. |
item | the name of the item to add/update. |
data | the data to be added/updated for the cached item. |