2012-09-07 15:33:22 +08:00
|
|
|
#ifndef _RPMSTRPOOL_H
|
|
|
|
#define _RPMSTRPOOL_H
|
|
|
|
|
2012-09-07 19:09:35 +08:00
|
|
|
#include <rpm/rpmtypes.h>
|
2012-09-07 15:33:22 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* XXX TODO: properly document... */
|
|
|
|
|
|
|
|
/* create a new string pool */
|
|
|
|
rpmstrPool rpmstrPoolCreate(void);
|
|
|
|
|
|
|
|
/* destroy a string pool (refcounted) */
|
|
|
|
rpmstrPool rpmstrPoolFree(rpmstrPool sidpool);
|
|
|
|
|
|
|
|
/* reference a string pool */
|
|
|
|
rpmstrPool rpmstrPoolLink(rpmstrPool sidpool);
|
|
|
|
|
2012-09-12 21:47:43 +08:00
|
|
|
/* freeze pool to free memory (keephash required for string -> id lookups) */
|
|
|
|
void rpmstrPoolFreeze(rpmstrPool sidpool, int keephash);
|
2012-09-07 15:33:22 +08:00
|
|
|
|
|
|
|
/* unfreeze pool (ie recreate hash table) */
|
|
|
|
void rpmstrPoolUnfreeze(rpmstrPool sidpool);
|
|
|
|
|
|
|
|
/* get the id of a string, optionally storing if not already present */
|
|
|
|
rpmsid rpmstrPoolId(rpmstrPool sidpool, const char *s, int create);
|
|
|
|
|
|
|
|
/* get the id of a string + length, optionally storing if not already present */
|
|
|
|
rpmsid rpmstrPoolIdn(rpmstrPool sidpool, const char *s, size_t slen, int create);
|
|
|
|
|
|
|
|
/* get a string by its id */
|
|
|
|
const char * rpmstrPoolStr(rpmstrPool sidpool, rpmsid sid);
|
|
|
|
|
|
|
|
/* get a strings length by its id (in constant time) */
|
|
|
|
size_t rpmstrPoolStrlen(rpmstrPool pool, rpmsid sid);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _RPMSIDPOOL_H */
|