indexcopy.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: indexcopy.h,v 1.1 1999/07/12 02:59:36 jgg Exp $
  4. /* ######################################################################
  5. Index Copying - Aid for copying and verifying the index files
  6. ##################################################################### */
  7. /*}}}*/
  8. #ifndef INDEXCOPY_H
  9. #define INDEXCOPY_H
  10. #include <vector>
  11. #include <string>
  12. class pkgTagSection;
  13. class FileFd;
  14. class IndexCopy
  15. {
  16. protected:
  17. pkgTagSection *Section;
  18. string ChopDirs(string Path,unsigned int Depth);
  19. bool ReconstructPrefix(string &Prefix,string OrigPath,string CD,
  20. string File);
  21. bool ReconstructChop(unsigned long &Chop,string Dir,string File);
  22. void ConvertToSourceList(string CD,string &Path);
  23. bool GrabFirst(string Path,string &To,unsigned int Depth);
  24. bool CopyWithReplace(FileFd &Target,const char *Tag,string New);
  25. virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
  26. virtual bool RewriteEntry(FileFd &Target,string File) = 0;
  27. virtual const char *GetFileName() = 0;
  28. virtual const char *Type() = 0;
  29. public:
  30. bool CopyPackages(string CDROM,string Name,vector<string> &List);
  31. };
  32. class PackageCopy : public IndexCopy
  33. {
  34. protected:
  35. virtual bool GetFile(string &Filename,unsigned long &Size);
  36. virtual bool RewriteEntry(FileFd &Target,string File);
  37. virtual const char *GetFileName() {return "Packages";};
  38. virtual const char *Type() {return "Package";};
  39. public:
  40. };
  41. class SourceCopy : public IndexCopy
  42. {
  43. protected:
  44. virtual bool GetFile(string &Filename,unsigned long &Size);
  45. virtual bool RewriteEntry(FileFd &Target,string File);
  46. virtual const char *GetFileName() {return "Sources";};
  47. virtual const char *Type() {return "Source";};
  48. public:
  49. };
  50. #endif