gdbm_wrapper.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * GDBM wrapper functions for Vala bindings.
  3. *
  4. * These wrapper functions handle the datum struct conversion between
  5. * C and Vala types.
  6. */
  7. #ifndef GDBM_WRAPPER_H
  8. #define GDBM_WRAPPER_H
  9. #include <glib.h>
  10. #include <gdbm.h>
  11. G_BEGIN_DECLS
  12. /**
  13. * Wrapper for gdbm_exists that takes a string key.
  14. */
  15. int gdbm_exists_wrapper(GDBM_FILE dbf, const char *key);
  16. /**
  17. * Wrapper for gdbm_fetch that returns a GBytes object.
  18. * Returns NULL if key not found.
  19. * Caller must unref the result.
  20. */
  21. GBytes* gdbm_fetch_wrapper(GDBM_FILE dbf, const char *key);
  22. /**
  23. * Wrapper for gdbm_store that takes a string key and GBytes content.
  24. */
  25. int gdbm_store_wrapper(GDBM_FILE dbf, const char *key, GBytes *content, int flag);
  26. /**
  27. * Wrapper for gdbm_delete that takes a string key.
  28. */
  29. int gdbm_delete_wrapper(GDBM_FILE dbf, const char *key);
  30. /**
  31. * Wrapper for gdbm_firstkey that returns a string.
  32. * Returns NULL if database is empty.
  33. * Caller must free the result.
  34. */
  35. char* gdbm_firstkey_wrapper(GDBM_FILE dbf);
  36. /**
  37. * Wrapper for gdbm_nextkey that returns a string.
  38. * Returns NULL if no more keys.
  39. * Caller must free the result.
  40. */
  41. char* gdbm_nextkey_wrapper(GDBM_FILE dbf, const char *prev_key);
  42. G_END_DECLS
  43. #endif /* GDBM_WRAPPER_H */