Split file src/keybind.[ch] to lib/keybind.[ch] and src/keybind-defaults.[ch].
[midnight-commander.git] / src / treestore.h
blob9cdf16038446e984a42d6a3db752de4d4588ff73
1 /** \file treestore.h
2 * \brief Header: tree store
4 * Contains a storage of the file system tree representation.
5 */
7 #ifndef MC__TREE_STORE_H
8 #define MC__TREE_STORE_H
10 /*** typedefs(not structures) and defined constants **********************************************/
13 * Register/unregister notification functions for "entry_remove"
15 struct tree_entry;
16 typedef void (*tree_store_remove_fn) (struct tree_entry * tree, void *data);
18 /*** enums ***************************************************************************************/
20 /*** structures declarations (and typedefs of structures)*****************************************/
22 typedef struct tree_entry
24 char *name; /* The full path of directory */
25 int sublevel; /* Number of parent directories (slashes) */
26 long submask; /* Bitmask of existing sublevels after this entry */
27 const char *subname; /* The last part of name (the actual name) */
28 unsigned int mark:1; /* Flag: Is this entry marked (e. g. for delete)? */
29 unsigned int scanned:1; /* Flag: childs scanned or not */
30 struct tree_entry *next; /* Next item in the list */
31 struct tree_entry *prev; /* Previous item in the list */
32 } tree_entry;
34 struct TreeStore
36 tree_entry *tree_first; /* First entry in the list */
37 tree_entry *tree_last; /* Last entry in the list */
38 tree_entry *check_start; /* Start of checked subdirectories */
39 char *check_name;
40 GList *add_queue; /* List of strings of added directories */
41 unsigned int loaded:1;
42 unsigned int dirty:1;
45 /*** global variables defined in .c file *********************************************************/
47 /*** declarations of public functions ************************************************************/
49 struct TreeStore *tree_store_get (void);
50 int tree_store_load (void);
51 int tree_store_save (void);
52 void tree_store_remove_entry (const char *name);
53 tree_entry *tree_store_start_check (const char *path);
54 void tree_store_mark_checked (const char *subname);
55 void tree_store_end_check (void);
56 tree_entry *tree_store_whereis (const char *name);
57 tree_entry *tree_store_rescan (const char *dir);
59 void tree_store_add_entry_remove_hook (tree_store_remove_fn callback, void *data);
60 void tree_store_remove_entry_remove_hook (tree_store_remove_fn callback);
62 /*** inline functions ****************************************************************************/
63 #endif /* MC__TREE_STORE_H */