]> git.saurik.com Git - apt.git/blob - apt-pkg/indexcopy.h
add d-pointer, virtual destructors and de-inline de/constructors
[apt.git] / apt-pkg / indexcopy.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4
5 Index Copying - Aid for copying and verifying the index files
6
7 ##################################################################### */
8 /*}}}*/
9 #ifndef INDEXCOPY_H
10 #define INDEXCOPY_H
11
12 #include <vector>
13 #include <string>
14 #include <stdio.h>
15
16 #include <apt-pkg/macros.h>
17
18 #ifndef APT_10_CLEANER_HEADERS
19 #include <apt-pkg/gpgv.h>
20 class FileFd;
21 #endif
22 #ifndef APT_8_CLEANER_HEADERS
23 using std::string;
24 using std::vector;
25 #endif
26
27 class pkgTagSection;
28 class indexRecords;
29 class pkgCdromStatus;
30 class FileFd;
31
32 class IndexCopy /*{{{*/
33 {
34 /** \brief dpointer placeholder (for later in case we need it) */
35 void *d;
36
37 protected:
38
39 pkgTagSection *Section;
40
41 std::string ChopDirs(std::string Path,unsigned int Depth);
42 bool ReconstructPrefix(std::string &Prefix,std::string OrigPath,std::string CD,
43 std::string File);
44 bool ReconstructChop(unsigned long &Chop,std::string Dir,std::string File);
45 void ConvertToSourceList(std::string CD,std::string &Path);
46 bool GrabFirst(std::string Path,std::string &To,unsigned int Depth);
47 virtual bool GetFile(std::string &Filename,unsigned long long &Size) = 0;
48 virtual bool RewriteEntry(FileFd &Target, std::string const &File) = 0;
49 virtual const char *GetFileName() = 0;
50 virtual const char *Type() = 0;
51
52 public:
53
54 bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List,
55 pkgCdromStatus *log);
56 IndexCopy();
57 virtual ~IndexCopy();
58 };
59 /*}}}*/
60 class PackageCopy : public IndexCopy /*{{{*/
61 {
62 void *d;
63 protected:
64
65 virtual bool GetFile(std::string &Filename,unsigned long long &Size);
66 virtual bool RewriteEntry(FileFd &Target, std::string const &File);
67 virtual const char *GetFileName() {return "Packages";};
68 virtual const char *Type() {return "Package";};
69
70 public:
71 PackageCopy();
72 virtual ~PackageCopy();
73 };
74 /*}}}*/
75 class SourceCopy : public IndexCopy /*{{{*/
76 {
77 void *d;
78 protected:
79
80 virtual bool GetFile(std::string &Filename,unsigned long long &Size);
81 virtual bool RewriteEntry(FileFd &Target, std::string const &File);
82 virtual const char *GetFileName() {return "Sources";};
83 virtual const char *Type() {return "Source";};
84
85 public:
86 SourceCopy();
87 virtual ~SourceCopy();
88 };
89 /*}}}*/
90 class TranslationsCopy /*{{{*/
91 {
92 void *d;
93 protected:
94 pkgTagSection *Section;
95
96 public:
97 bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List,
98 pkgCdromStatus *log);
99
100 TranslationsCopy();
101 virtual ~TranslationsCopy();
102 };
103 /*}}}*/
104 class SigVerify /*{{{*/
105 {
106 /** \brief dpointer placeholder (for later in case we need it) */
107 void *d;
108
109 APT_HIDDEN bool Verify(std::string prefix,std::string file, indexRecords *records);
110 APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName,
111 std::string prefix, std::string file);
112
113 public:
114 bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::string> &SigList,
115 std::vector<std::string> PkgList,std::vector<std::string> SrcList);
116
117 APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut,
118 int const &statusfd, int fd[2]);
119 APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut,
120 int const &statusfd = -1);
121
122 SigVerify();
123 virtual ~SigVerify();
124 };
125 /*}}}*/
126
127 #endif