]> git.saurik.com Git - apt.git/blob - cmdline/indexcopy.h
Newer sub/guess scripts
[apt.git] / cmdline / indexcopy.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: indexcopy.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
4 /* ######################################################################
5
6 Index Copying - Aid for copying and verifying the index files
7
8 ##################################################################### */
9 /*}}}*/
10 #ifndef INDEXCOPY_H
11 #define INDEXCOPY_H
12
13 #include <vector>
14 #include <string>
15 #include <stdio.h>
16
17 class pkgTagSection;
18 class FileFd;
19
20 class IndexCopy
21 {
22 protected:
23
24 pkgTagSection *Section;
25
26 string ChopDirs(string Path,unsigned int Depth);
27 bool ReconstructPrefix(string &Prefix,string OrigPath,string CD,
28 string File);
29 bool ReconstructChop(unsigned long &Chop,string Dir,string File);
30 void ConvertToSourceList(string CD,string &Path);
31 bool GrabFirst(string Path,string &To,unsigned int Depth);
32 virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
33 virtual bool RewriteEntry(FILE *Target,string File) = 0;
34 virtual const char *GetFileName() = 0;
35 virtual const char *Type() = 0;
36
37 public:
38
39 bool CopyPackages(string CDROM,string Name,vector<string> &List);
40 };
41
42 class PackageCopy : public IndexCopy
43 {
44 protected:
45
46 virtual bool GetFile(string &Filename,unsigned long &Size);
47 virtual bool RewriteEntry(FILE *Target,string File);
48 virtual const char *GetFileName() {return "Packages";};
49 virtual const char *Type() {return "Package";};
50
51 public:
52 };
53
54 class SourceCopy : public IndexCopy
55 {
56 protected:
57
58 virtual bool GetFile(string &Filename,unsigned long &Size);
59 virtual bool RewriteEntry(FILE *Target,string File);
60 virtual const char *GetFileName() {return "Sources";};
61 virtual const char *Type() {return "Source";};
62
63 public:
64 };
65
66 #endif