* merged with otavoi
[ntk/apt.git] / apt-pkg / indexcopy.h
CommitLineData
143abaeb
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
076d01b0 3// $Id: indexcopy.h,v 1.3 2001/05/27 04:46:54 jgg Exp $
143abaeb
AL
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>
b2e465d6 15#include <stdio.h>
143abaeb 16
076d01b0
AL
17using std::string;
18using std::vector;
19
143abaeb
AL
20class pkgTagSection;
21class FileFd;
a75c6a6e
MZ
22class indexRecords;
23class pkgCdromStatus;
143abaeb
AL
24
25class IndexCopy
26{
27 protected:
28
29 pkgTagSection *Section;
30
31 string ChopDirs(string Path,unsigned int Depth);
32 bool ReconstructPrefix(string &Prefix,string OrigPath,string CD,
33 string File);
34 bool ReconstructChop(unsigned long &Chop,string Dir,string File);
35 void ConvertToSourceList(string CD,string &Path);
36 bool GrabFirst(string Path,string &To,unsigned int Depth);
143abaeb 37 virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
b2e465d6 38 virtual bool RewriteEntry(FILE *Target,string File) = 0;
143abaeb
AL
39 virtual const char *GetFileName() = 0;
40 virtual const char *Type() = 0;
b2e465d6 41
143abaeb
AL
42 public:
43
a75c6a6e
MZ
44 bool CopyPackages(string CDROM,string Name,vector<string> &List,
45 pkgCdromStatus *log);
143abaeb
AL
46};
47
48class PackageCopy : public IndexCopy
49{
50 protected:
51
52 virtual bool GetFile(string &Filename,unsigned long &Size);
b2e465d6 53 virtual bool RewriteEntry(FILE *Target,string File);
143abaeb
AL
54 virtual const char *GetFileName() {return "Packages";};
55 virtual const char *Type() {return "Package";};
56
57 public:
58};
59
60class SourceCopy : public IndexCopy
61{
62 protected:
63
64 virtual bool GetFile(string &Filename,unsigned long &Size);
b2e465d6 65 virtual bool RewriteEntry(FILE *Target,string File);
143abaeb
AL
66 virtual const char *GetFileName() {return "Sources";};
67 virtual const char *Type() {return "Source";};
68
69 public:
70};
71
a75c6a6e
MZ
72class SigVerify
73{
74 bool Verify(string prefix,string file, indexRecords *records);
75 bool CopyMetaIndex(string CDROM, string CDName,
76 string prefix, string file);
77
78 public:
79 bool CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
80 vector<string> PkgList,vector<string> SrcList);
81};
82
143abaeb 83#endif