]> git.saurik.com Git - apt.git/blame - apt-pkg/indexcopy.h
avoid virtual in the iterators
[apt.git] / apt-pkg / indexcopy.h
CommitLineData
143abaeb
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
143abaeb
AL
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>
b2e465d6 14#include <stdio.h>
143abaeb 15
2f5b6151
DK
16#include <apt-pkg/macros.h>
17
453b82a3
DK
18#ifndef APT_10_CLEANER_HEADERS
19#include <apt-pkg/gpgv.h>
20class FileFd;
21#endif
a4f6bdc8
DK
22#ifndef APT_8_CLEANER_HEADERS
23using std::string;
24using std::vector;
25#endif
26
143abaeb 27class pkgTagSection;
a75c6a6e 28class pkgCdromStatus;
88593886 29class FileFd;
5ad0096a 30class metaIndex;
143abaeb 31
92fcbfc1 32class IndexCopy /*{{{*/
143abaeb 33{
be9b62f7 34 /** \brief dpointer placeholder (for later in case we need it) */
6c55f07a 35 void * const d;
be9b62f7 36
143abaeb
AL
37 protected:
38
39 pkgTagSection *Section;
40
8f3ba4e8
DK
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;
88593886 48 virtual bool RewriteEntry(FileFd &Target, std::string const &File) = 0;
143abaeb
AL
49 virtual const char *GetFileName() = 0;
50 virtual const char *Type() = 0;
b2e465d6 51
143abaeb
AL
52 public:
53
8f3ba4e8 54 bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List,
a75c6a6e 55 pkgCdromStatus *log);
c8a4ce6c 56 IndexCopy();
862bafea 57 virtual ~IndexCopy();
143abaeb 58};
92fcbfc1
DK
59 /*}}}*/
60class PackageCopy : public IndexCopy /*{{{*/
143abaeb 61{
6c55f07a 62 void * const d;
143abaeb 63 protected:
c8a4ce6c 64
3b302846
DK
65 virtual bool GetFile(std::string &Filename,unsigned long long &Size) APT_OVERRIDE;
66 virtual bool RewriteEntry(FileFd &Target, std::string const &File) APT_OVERRIDE;
67 virtual const char *GetFileName() APT_OVERRIDE {return "Packages";};
68 virtual const char *Type() APT_OVERRIDE {return "Package";};
c8a4ce6c
DK
69
70 public:
71 PackageCopy();
72 virtual ~PackageCopy();
143abaeb 73};
92fcbfc1
DK
74 /*}}}*/
75class SourceCopy : public IndexCopy /*{{{*/
143abaeb 76{
6c55f07a 77 void * const d;
143abaeb
AL
78 protected:
79
3b302846
DK
80 virtual bool GetFile(std::string &Filename,unsigned long long &Size) APT_OVERRIDE;
81 virtual bool RewriteEntry(FileFd &Target, std::string const &File) APT_OVERRIDE;
82 virtual const char *GetFileName() APT_OVERRIDE {return "Sources";};
83 virtual const char *Type() APT_OVERRIDE {return "Source";};
c8a4ce6c
DK
84
85 public:
86 SourceCopy();
87 virtual ~SourceCopy();
143abaeb 88};
92fcbfc1
DK
89 /*}}}*/
90class TranslationsCopy /*{{{*/
22f8568d 91{
6c55f07a 92 void * const d;
22f8568d
MV
93 protected:
94 pkgTagSection *Section;
95
96 public:
8f3ba4e8 97 bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List,
22f8568d 98 pkgCdromStatus *log);
c8a4ce6c
DK
99
100 TranslationsCopy();
101 virtual ~TranslationsCopy();
22f8568d 102};
92fcbfc1
DK
103 /*}}}*/
104class SigVerify /*{{{*/
a75c6a6e 105{
be9b62f7 106 /** \brief dpointer placeholder (for later in case we need it) */
6c55f07a 107 void * const d;
be9b62f7 108
5ad0096a 109 APT_HIDDEN bool Verify(std::string prefix,std::string file, metaIndex *records);
3809194b 110 APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName,
8f3ba4e8 111 std::string prefix, std::string file);
a75c6a6e
MZ
112
113 public:
8f3ba4e8
DK
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);
a319c4ee 116
453b82a3 117 APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut,
27cc55ee 118 int const &statusfd, int fd[2]);
453b82a3 119 APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut,
27cc55ee 120 int const &statusfd = -1);
c8a4ce6c
DK
121
122 SigVerify();
123 virtual ~SigVerify();
a75c6a6e 124};
92fcbfc1 125 /*}}}*/
22f8568d 126
143abaeb 127#endif