indexcopy.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: indexcopy.h,v 1.3 2001/05/27 04:46:54 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. using std::string;
  14. using std::vector;
  15. class pkgTagSection;
  16. class FileFd;
  17. class IndexCopy
  18. {
  19. protected:
  20. pkgTagSection *Section;
  21. string ChopDirs(string Path,unsigned int Depth);
  22. bool ReconstructPrefix(string &Prefix,string OrigPath,string CD,
  23. string File);
  24. bool ReconstructChop(unsigned long &Chop,string Dir,string File);
  25. void ConvertToSourceList(string CD,string &Path);
  26. bool GrabFirst(string Path,string &To,unsigned int Depth);
  27. virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
  28. virtual bool RewriteEntry(FILE *Target,string File) = 0;
  29. virtual const char *GetFileName() = 0;
  30. virtual const char *Type() = 0;
  31. public:
  32. bool CopyPackages(string CDROM,string Name,vector<string> &List);
  33. };
  34. class PackageCopy : public IndexCopy
  35. {
  36. protected:
  37. virtual bool GetFile(string &Filename,unsigned long &Size);
  38. virtual bool RewriteEntry(FILE *Target,string File);
  39. virtual const char *GetFileName() {return "Packages";};
  40. virtual const char *Type() {return "Package";};
  41. public:
  42. };
  43. class SourceCopy : public IndexCopy
  44. {
  45. protected:
  46. virtual bool GetFile(string &Filename,unsigned long &Size);
  47. virtual bool RewriteEntry(FILE *Target,string File);
  48. virtual const char *GetFileName() {return "Sources";};
  49. virtual const char *Type() {return "Source";};
  50. public:
  51. };
  52. #endif