]> git.decadent.org.uk Git - dak.git/blob - tools/dsync-0.0/libdsync/genfilelist.h
debianqueued: remove current directory from @INC
[dak.git] / tools / dsync-0.0 / libdsync / genfilelist.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description                                                          /*{{{*/
3 // $Id: genfilelist.h,v 1.5 1999/12/26 06:59:01 jgg Exp $
4 /* ######################################################################
5    
6    Generate File List 
7    
8    This class is responsible for generating the file list. It is fairly
9    simple and direct. One hook is provided to allow a derived class to
10    cache md5 generation.
11    
12    The file list format is documented in the filelist.sgml document.
13    
14    ##################################################################### */
15                                                                         /*}}}*/
16 #ifndef DSYNC_GENFILELIST
17 #define DSYNC_GENFILELIST
18
19 #ifdef __GNUG__
20 #pragma interface "dsync/genfilelist.h"
21 #endif 
22
23 #include <dsync/filefilter.h>
24 #include <dsync/filelist.h>
25 #include <list>
26
27 class dsGenFileList
28 {
29    protected:
30    
31    list<string> Queue;
32    list<string> DelayQueue;
33    dsFList::IO *IO;
34    
35    // Hooks
36    virtual int Visit(const char *Directory,const char *File,
37                      struct stat const &Stat) {return 0;};
38       
39    // Directory handlers
40    bool DirDepthFirst(char *CurDir);
41    bool DirTree();
42  
43    // Emitters
44    bool EnterDir(const char *Dir,struct stat const &St);
45    bool LeaveDir(const char *Dir);
46    bool DirectoryMarker(const char *Dir,struct stat const &St);
47    bool DoFile(const char *Dir,const char *File,struct stat const &St);
48
49    bool EmitOwner(struct stat const &St,unsigned long &UID,
50                   unsigned long &GID,unsigned int Tag,unsigned int Flag);
51    virtual bool EmitMD5(const char *Dir,const char *File,
52                         struct stat const &St,unsigned char MD5[16],
53                         unsigned int Tag,unsigned int Flag);
54
55    virtual bool NeedsRSync(const char *Dir,const char *File,
56                            dsFList::NormalFile &F) {return false;};
57    virtual bool EmitRSync(const char *Dir,const char *File,
58                           struct stat const &St,dsFList::NormalFile &F,
59                           dsFList::RSyncChecksum &Ck);
60       
61    public:
62    
63    // Configurable things
64    enum {Depth,Breadth,Tree} Type;
65    dsFileFilter Filter;
66    dsFileFilter PreferFilter;
67    
68    bool Go(string Base,dsFList::IO &IO);
69
70    dsGenFileList();
71    virtual ~dsGenFileList();
72 };
73
74 #endif