genfilelist.h 2.0 KB

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