share/dir: extend to support other directory access methods
[neverball] / share / dir.h
1 #ifndef DIR_H
2 #define DIR_H
3
4 #include "array.h"
5
6 struct dir_item
7 {
8     const char *path;
9     void *data;
10 };
11
12 /*
13  * A minor convenience for quick member access, as in "DIR_ITEM_GET(a,
14  * i)->member".  Most of the time this macro is not what you want to
15  * use.
16  */
17 #define DIR_ITEM_GET(a, i) ((struct dir_item *) array_get((a), (i)))
18
19 Array dir_scan(const char *,
20                int    (*filter)   (struct dir_item *),
21                char **(*get_list) (const char *),
22                void   (*free_list)(void *));
23 void  dir_free(Array);
24
25 #endif