Join with aliencode
[ntk/apt.git] / cmdline / indexcopy.h
CommitLineData
143abaeb
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b2e465d6 3// $Id: indexcopy.h,v 1.2 2001/02/20 07:03:17 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
AL
16
17class pkgTagSection;
18class FileFd;
19
20class 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);
143abaeb 32 virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
b2e465d6 33 virtual bool RewriteEntry(FILE *Target,string File) = 0;
143abaeb
AL
34 virtual const char *GetFileName() = 0;
35 virtual const char *Type() = 0;
b2e465d6 36
143abaeb
AL
37 public:
38
39 bool CopyPackages(string CDROM,string Name,vector<string> &List);
40};
41
42class PackageCopy : public IndexCopy
43{
44 protected:
45
46 virtual bool GetFile(string &Filename,unsigned long &Size);
b2e465d6 47 virtual bool RewriteEntry(FILE *Target,string File);
143abaeb
AL
48 virtual const char *GetFileName() {return "Packages";};
49 virtual const char *Type() {return "Package";};
50
51 public:
52};
53
54class SourceCopy : public IndexCopy
55{
56 protected:
57
58 virtual bool GetFile(string &Filename,unsigned long &Size);
b2e465d6 59 virtual bool RewriteEntry(FILE *Target,string File);
143abaeb
AL
60 virtual const char *GetFileName() {return "Sources";};
61 virtual const char *Type() {return "Source";};
62
63 public:
64};
65
66#endif