BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
sfifilecrawler.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __SFI_FILE_CRAWLER_H__
00003 #define __SFI_FILE_CRAWLER_H__
00004 
00005 #include <sfi/sfitypes.hh>
00006 #include <sfi/sfiring.hh>
00007 
00008 G_BEGIN_DECLS
00009 
00010 typedef struct {
00011   SfiRing      *results;        /* end user results */
00012   /*< private >*/
00013   gchar        *cwd;
00014   SfiRing      *dpatterns;      /* gchar*, directory patterns */
00015   GFileTest     ptest;
00016   /* path crawler */
00017   SfiRing      *pdqueue;        /* dir segments of current search dir */
00018   GFileTest     stest;          /* final segment file test */
00019   SfiRing      *dlist;          /* dir list */
00020   /* dir crawler */
00021   gpointer      dhandle;
00022   GPatternSpec *pspec;          /* file pattern */
00023   gchar        *base_dir;
00024   GFileTest     ftest;
00025   SfiRing      *accu;           /* readdir result */
00026 } SfiFileCrawler;
00027 
00028 SfiFileCrawler* sfi_file_crawler_new                    (void);
00029 gchar*          sfi_file_crawler_pop                    (SfiFileCrawler *self);
00030 void            sfi_file_crawler_set_cwd                (SfiFileCrawler *self,
00031                                                          const gchar    *cwd);
00032 void            sfi_file_crawler_add_search_path        (SfiFileCrawler *self,
00033                                                          const gchar    *pattern_paths,
00034                                                          const gchar    *file_pattern);
00035 void            sfi_file_crawler_add_tests              (SfiFileCrawler *self,
00036                                                          GFileTest       tests);
00037 void            sfi_file_crawler_crawl                  (SfiFileCrawler *self);
00038 gboolean        sfi_file_crawler_needs_crawl            (SfiFileCrawler *self);
00039 void            sfi_file_crawler_destroy                (SfiFileCrawler *self);
00040 
00041 SfiRing*        sfi_file_crawler_list_files             (const gchar *search_path,
00042                                                          const gchar *file_pattern,
00043                                                          GFileTest    file_test);
00044 
00045 gchar*          sfi_path_get_filename                   (const gchar  *filename,
00046                                                          const gchar  *parentdir);
00047 void            sfi_make_dirpath                        (const gchar  *dir);
00048 void            sfi_make_dirname_path                   (const gchar  *filename);
00049 
00050 /* --- file tests --- */
00051 gboolean        g_file_test_all                         (const gchar  *filename,
00052                                                          GFileTest     test);
00053 
00054 
00055 /* --- implementations --- */
00056 void _sfi_init_file_crawler (void);
00057 
00058 G_END_DECLS
00059 
00060 #endif /* __SFI_FILE_CRAWLER_H__ */
00061 
00062 /* vim:set ts=8 sts=2 sw=2: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines