txtdb.h (690B)
1 /* 2 * Copy me if you can. 3 * by 20h 4 */ 5 6 #ifndef __TXTDB_H__ 7 #define __TXTDB_H__ 8 9 #include "llist.h" 10 11 typedef struct txtdb_t txtdb_t; 12 struct txtdb_t { 13 llist_t *values; 14 15 int changed; 16 void *data; 17 18 char *path; 19 char *name; 20 }; 21 22 txtdb_t *txtdb_new(void); 23 void txtdb_free(txtdb_t *txtdb); 24 llistelem_t *txtdb_add(txtdb_t *txtdb, char *key, char *value); 25 llistelem_t *txtdb_del(txtdb_t *txtdb, char *key); 26 llistelem_t *txtdb_get(txtdb_t *txtdb, char *key); 27 llist_t *txtdb_find(txtdb_t *txtdb, char *regex); 28 llistelem_t *txtdb_set(txtdb_t *txtdb, char *key, char *value); 29 int txtdb_len(txtdb_t *txtdb); 30 txtdb_t *txtdb_read(char *file); 31 txtdb_t *txtdb_write(txtdb_t *txtdb, char *file); 32 33 #endif 34