indexcopy.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: indexcopy.h,v 1.2 2001/02/20 07:03:17 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. #include <stdio.h>
  13. class pkgTagSection;
  14. class FileFd;
  15. class IndexCopy
  16. {
  17. protected:
  18. pkgTagSection *Section;
  19. string ChopDirs(string Path,unsigned int Depth);
  20. bool ReconstructPrefix(string &Prefix,string OrigPath,string CD,
  21. string File);
  22. bool ReconstructChop(unsigned long &Chop,string Dir,string File);
  23. void ConvertToSourceList(string CD,string &Path);
  24. bool GrabFirst(string Path,string &To,unsigned int Depth);
  25. virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
  26. virtual bool RewriteEntry(FILE *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(FILE *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(FILE *Target,string File);
  46. virtual const char *GetFileName() {return "Sources";};
  47. virtual const char *Type() {return "Source";};
  48. public:
  49. };
  50. #endif