libresman
view src/resman.h @ 26:6b9974a8bdae
started BSD/mac support for file watching
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 31 Mar 2014 19:51:00 +0300 |
parents | bebc065a941f |
children |
line source
1 #ifndef RESOURCE_MANAGER_H_
2 #define RESOURCE_MANAGER_H_
4 /* load callback: everything or just file read/parse stage
5 * done callback: second-stage callback, called in the context of the
6 * user thread, after the load callback returns
7 */
8 typedef int (*resman_load_func)(const char *fname, int id, void *closure);
9 typedef int (*resman_done_func)(int id, void *closure);
10 typedef void (*resman_destroy_func)(int id, void *closure);
12 struct resman;
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
18 struct resman *resman_create(void);
19 void resman_free(struct resman *rman);
21 int resman_init(struct resman *rman);
22 void resman_destroy(struct resman *rman);
24 void resman_set_load_func(struct resman *rman, resman_load_func func, void *cls);
25 void resman_set_done_func(struct resman *rman, resman_done_func func, void *cls);
26 void resman_set_destroy_func(struct resman *rman, resman_destroy_func func, void *cls);
28 int resman_lookup(struct resman *rman, const char *fname, void *data);
29 void resman_wait(struct resman *rman, int id);
31 int resman_poll(struct resman *rman);
33 const char *resman_get_res_name(struct resman *rman, int res_id);
35 void resman_set_res_data(struct resman *rman, int res_id, void *data);
36 void *resman_get_res_data(struct resman *rman, int res_id);
38 int resman_get_res_result(struct resman *rman, int res_id);
40 int resman_get_res_load_count(struct resman *rman, int res_id);
42 #ifdef __cplusplus
43 }
44 #endif
47 #endif /* RESOURCE_MANAGER_H_ */