1 | // -*- mode: cpp; mode: fold -*- |
---|
2 | // Description /*{{{*/ |
---|
3 | // $Id: indexcopy.h,v 1.1 2002/07/23 17:54:52 niemeyer 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 | using std::string; |
---|
18 | using std::vector; |
---|
19 | |
---|
20 | class pkgTagSection; |
---|
21 | class FileFd; |
---|
22 | |
---|
23 | class IndexCopy { |
---|
24 | protected: |
---|
25 | |
---|
26 | pkgTagSection *Section; |
---|
27 | |
---|
28 | string ChopDirs(string Path, unsigned int Depth); |
---|
29 | bool ReconstructPrefix(string &Prefix, string OrigPath, string CD, |
---|
30 | string File); |
---|
31 | bool ReconstructChop(unsigned long &Chop, string Dir, string File); |
---|
32 | void ConvertToSourceList(string CD, string &Path); |
---|
33 | bool GrabFirst(string Path, string &To, unsigned int Depth); |
---|
34 | virtual bool GetFile(string &Filename, unsigned long &Size) = 0; |
---|
35 | virtual bool RewriteEntry(FILE *Target, string File) = 0; |
---|
36 | virtual const char *GetFileName() = 0; |
---|
37 | virtual const char *Type() = 0; |
---|
38 | |
---|
39 | public: |
---|
40 | |
---|
41 | bool CopyPackages(string CDROM, string Name, vector<string> &List); |
---|
42 | virtual ~IndexCopy() {}; |
---|
43 | }; |
---|
44 | |
---|
45 | class PackageCopy:public IndexCopy { |
---|
46 | protected: |
---|
47 | |
---|
48 | virtual bool GetFile(string &Filename, unsigned long &Size); |
---|
49 | virtual bool RewriteEntry(FILE *Target, string File); |
---|
50 | virtual const char *GetFileName() { |
---|
51 | return "Packages"; |
---|
52 | }; |
---|
53 | virtual const char *Type() { |
---|
54 | return "Package"; |
---|
55 | }; |
---|
56 | |
---|
57 | public: |
---|
58 | virtual ~PackageCopy() {}; |
---|
59 | }; |
---|
60 | |
---|
61 | class SourceCopy:public IndexCopy { |
---|
62 | protected: |
---|
63 | |
---|
64 | virtual bool GetFile(string &Filename, unsigned long &Size); |
---|
65 | virtual bool RewriteEntry(FILE *Target, string File); |
---|
66 | virtual const char *GetFileName() { |
---|
67 | return "Sources"; |
---|
68 | }; |
---|
69 | virtual const char *Type() { |
---|
70 | return "Source"; |
---|
71 | }; |
---|
72 | |
---|
73 | public: |
---|
74 | virtual ~SourceCopy() {}; |
---|
75 | }; |
---|
76 | |
---|
77 | #endif |
---|