1 /** \file treestore.h 2 * \brief Header: tree store 3 * 4 * Contains a storage of the file system tree representation. 5 */ 6 7 #ifndef MC__TREE_STORE_H 8 #define MC__TREE_STORE_H 9 10 /*** typedefs(not structures) and defined constants **********************************************/ 11 12 /* 13 * Register/unregister notification functions for "entry_remove" 14 */ 15 struct tree_entry; 16 typedef void (*tree_store_remove_fn) (struct tree_entry * tree, void *data); 17 18 /*** enums ***************************************************************************************/ 19 20 /*** structures declarations (and typedefs of structures)*****************************************/ 21 22 typedef struct tree_entry 23 { 24 vfs_path_t *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 gboolean mark; /* Flag: Is this entry marked (e. g. for delete)? */ 29 gboolean scanned; /* 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; 33 34 struct TreeStore 35 { 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 vfs_path_t *check_name; 40 GList *add_queue_vpath; /* List of vfs_path_t objects of added directories */ 41 gboolean loaded; 42 gboolean dirty; 43 }; 44 45 /*** global variables defined in .c file *********************************************************/ 46 47 /*** declarations of public functions ************************************************************/ 48 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 vfs_path_t * name_vpath); 53 tree_entry *tree_store_start_check (const vfs_path_t * vpath); 54 void tree_store_mark_checked (const char *subname); 55 void tree_store_end_check (void); 56 tree_entry *tree_store_whereis (const vfs_path_t * name); 57 tree_entry *tree_store_rescan (const vfs_path_t * vpath); 58 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); 61 62 /*** inline functions ****************************************************************************/ 63 #endif /* MC__TREE_STORE_H */