src/diffviewer/ydiff.c: code indentation & cleanup.
[midnight-commander.git] / src / treestore.h
blobbc9a677bb068fd516c82b3ef608ef3ff6d019d20
2 /** \file treestore.h
3 * \brief Header: tree store
5 * Contains a storage of the file system tree representation.
6 */
8 #ifndef MC_TREE_STORE_H
9 #define MC_TREE_STORE_H
11 typedef struct tree_entry {
12 char *name; /* The full path of directory */
13 int sublevel; /* Number of parent directories (slashes) */
14 long submask; /* Bitmask of existing sublevels after this entry */
15 const char *subname; /* The last part of name (the actual name) */
16 unsigned int mark:1; /* Flag: Is this entry marked (e. g. for delete)? */
17 unsigned int scanned:1; /* Flag: childs scanned or not */
18 struct tree_entry *next; /* Next item in the list */
19 struct tree_entry *prev; /* Previous item in the list */
20 } tree_entry;
22 struct TreeStore {
23 tree_entry *tree_first; /* First entry in the list */
24 tree_entry *tree_last; /* Last entry in the list */
25 tree_entry *check_start; /* Start of checked subdirectories */
26 char *check_name;
27 GList *add_queue; /* List of strings of added directories */
28 unsigned int loaded:1;
29 unsigned int dirty:1;
32 struct TreeStore *tree_store_get (void);
33 int tree_store_load (void);
34 int tree_store_save (void);
35 void tree_store_remove_entry (const char *name);
36 tree_entry *tree_store_start_check (const char *path);
37 void tree_store_mark_checked (const char *subname);
38 void tree_store_end_check (void);
39 tree_entry *tree_store_whereis (const char *name);
40 tree_entry *tree_store_rescan (const char *dir);
43 * Register/unregister notification functions for "entry_remove"
45 typedef void (*tree_store_remove_fn) (tree_entry *tree, void *data);
46 void tree_store_add_entry_remove_hook (tree_store_remove_fn callback,
47 void *data);
48 void tree_store_remove_entry_remove_hook (tree_store_remove_fn callback);
50 #endif