Fixed or handling bug
[ntk/apt.git] / cmdline / indexcopy.h
CommitLineData
143abaeb
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: indexcopy.h,v 1.1 1999/07/12 02:59:36 jgg 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
16class pkgTagSection;
17class FileFd;
18
19class IndexCopy
20{
21 protected:
22
23 pkgTagSection *Section;
24
25 string ChopDirs(string Path,unsigned int Depth);
26 bool ReconstructPrefix(string &Prefix,string OrigPath,string CD,
27 string File);
28 bool ReconstructChop(unsigned long &Chop,string Dir,string File);
29 void ConvertToSourceList(string CD,string &Path);
30 bool GrabFirst(string Path,string &To,unsigned int Depth);
31 bool CopyWithReplace(FileFd &Target,const char *Tag,string New);
32 virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
33 virtual bool RewriteEntry(FileFd &Target,string File) = 0;
34 virtual const char *GetFileName() = 0;
35 virtual const char *Type() = 0;
36 public:
37
38 bool CopyPackages(string CDROM,string Name,vector<string> &List);
39};
40
41class PackageCopy : public IndexCopy
42{
43 protected:
44
45 virtual bool GetFile(string &Filename,unsigned long &Size);
46 virtual bool RewriteEntry(FileFd &Target,string File);
47 virtual const char *GetFileName() {return "Packages";};
48 virtual const char *Type() {return "Package";};
49
50 public:
51};
52
53class SourceCopy : public IndexCopy
54{
55 protected:
56
57 virtual bool GetFile(string &Filename,unsigned long &Size);
58 virtual bool RewriteEntry(FileFd &Target,string File);
59 virtual const char *GetFileName() {return "Sources";};
60 virtual const char *Type() {return "Source";};
61
62 public:
63};
64
65#endif