]>
git.saurik.com Git - apt.git/blob - ftparchive/writer.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: writer.h,v 1.7 2003/12/26 22:55:13 mdz Exp $
4 /* ######################################################################
8 The file writer classes. These write various types of output, sources,
11 ##################################################################### */
17 #pragma interface "writer.h"
28 #include "apt-ftparchive.h"
39 vector
<string
> Patterns
;
40 const char *OriginalPath
;
44 // Stuff for the delinker
47 static FTWScanner
*Owner
;
48 static int Scanner(const char *File
,const struct stat
*sb
,int Flag
);
50 bool Delink(string
&FileName
,const char *OriginalPath
,
51 unsigned long &Bytes
,struct stat
&St
);
53 inline void NewLine(unsigned Priority
)
55 if (ErrorPrinted
== false && Quiet
<= Priority
)
64 unsigned long DeLinkLimit
;
65 string InternalPrefix
;
67 virtual bool DoPackage(string FileName
) = 0;
68 bool RecursiveScan(string Dir
);
69 bool LoadFileList(string BaseDir
,string File
);
70 void ClearPatterns() { Patterns
.clear(); };
71 void AddPattern(string Pattern
) { Patterns
.push_back(Pattern
); };
72 bool SetExts(string Vals
);
75 virtual ~FTWScanner() {delete [] RealPath
;};
78 class PackagesWriter
: public FTWScanner
94 struct CacheDB::Stats
&Stats
;
96 inline bool ReadOverride(string File
) {return Over
.ReadOverride(File
);};
97 inline bool ReadExtraOverride(string File
)
98 {return Over
.ReadExtraOverride(File
);};
99 virtual bool DoPackage(string FileName
);
101 PackagesWriter(string DB
,string Overrides
,string ExtOverrides
=string());
102 virtual ~PackagesWriter() {};
105 class ContentsWriter
: public FTWScanner
115 struct CacheDB::Stats
&Stats
;
118 bool DoPackage(string FileName
,string Package
);
119 virtual bool DoPackage(string FileName
)
120 {return DoPackage(FileName
,string());};
121 bool ReadFromPkgs(string PkgFile
,string PkgCompress
);
123 void Finish() {Gen
.Print(Output
);};
124 inline bool ReadyDB(string DB
) {return Db
.ReadyDB(DB
);};
126 ContentsWriter(string DB
);
127 virtual ~ContentsWriter() {};
130 class SourcesWriter
: public FTWScanner
135 unsigned long BufSize
;
145 struct CacheDB::Stats Stats
;
147 virtual bool DoPackage(string FileName
);
149 SourcesWriter(string BOverrides
,string SOverrides
,
150 string ExtOverrides
=string());
151 virtual ~SourcesWriter() {free(Buffer
);};
154 class ReleaseWriter
: public FTWScanner
157 ReleaseWriter(string DB
);
158 virtual bool DoPackage(string FileName
);
171 // Limited by FileFd::Size()
174 map
<string
,struct CheckSum
> CheckSums
;