source: projects/synaptic/trunk/common/indexcopy.h @ 280

Revision 280, 2.0 KB checked in by yasumichi, 15 years ago (diff)

first import

Line 
1// -*- mode: cpp; mode: fold -*-
2// Description                                                          /*{{{*/
3// $Id: indexcopy.h,v 1.1 2002/07/23 17:54:52 niemeyer 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#include <stdio.h>
16
17using std::string;
18using std::vector;
19
20class pkgTagSection;
21class FileFd;
22
23class IndexCopy {
24 protected:
25
26   pkgTagSection *Section;
27
28   string ChopDirs(string Path, unsigned int Depth);
29   bool ReconstructPrefix(string &Prefix, string OrigPath, string CD,
30                          string File);
31   bool ReconstructChop(unsigned long &Chop, string Dir, string File);
32   void ConvertToSourceList(string CD, string &Path);
33   bool GrabFirst(string Path, string &To, unsigned int Depth);
34   virtual bool GetFile(string &Filename, unsigned long &Size) = 0;
35   virtual bool RewriteEntry(FILE *Target, string File) = 0;
36   virtual const char *GetFileName() = 0;
37   virtual const char *Type() = 0;
38
39 public:
40
41   bool CopyPackages(string CDROM, string Name, vector<string> &List);
42   virtual ~IndexCopy() {};
43};
44
45class PackageCopy:public IndexCopy {
46 protected:
47
48   virtual bool GetFile(string &Filename, unsigned long &Size);
49   virtual bool RewriteEntry(FILE *Target, string File);
50   virtual const char *GetFileName() {
51      return "Packages";
52   };
53   virtual const char *Type() {
54      return "Package";
55   };
56
57 public:
58   virtual ~PackageCopy() {};
59};
60
61class SourceCopy:public IndexCopy {
62 protected:
63
64   virtual bool GetFile(string &Filename, unsigned long &Size);
65   virtual bool RewriteEntry(FILE *Target, string File);
66   virtual const char *GetFileName() {
67      return "Sources";
68   };
69   virtual const char *Type() {
70      return "Source";
71   };
72
73 public:
74   virtual ~SourceCopy() {};
75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.