]>
git.saurik.com Git - apt.git/blob - ftparchive/writer.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: writer.h,v 1.4.2.2 2003/12/26 22:55:43 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 ScannerFTW(const char *File
,const struct stat
*sb
,int Flag
);
49 static int ScannerFile(const char *File
, bool ReadLink
);
51 bool Delink(string
&FileName
,const char *OriginalPath
,
52 unsigned long &Bytes
,off_t FileSize
);
54 inline void NewLine(unsigned Priority
)
56 if (ErrorPrinted
== false && Quiet
<= Priority
)
65 unsigned long DeLinkLimit
;
66 string InternalPrefix
;
68 virtual bool DoPackage(string FileName
) = 0;
69 bool RecursiveScan(string Dir
);
70 bool LoadFileList(string BaseDir
,string File
);
71 void ClearPatterns() { Patterns
.clear(); };
72 void AddPattern(string Pattern
) { Patterns
.push_back(Pattern
); };
73 bool SetExts(string Vals
);
76 virtual ~FTWScanner() {delete [] RealPath
;};
79 class PackagesWriter
: public FTWScanner
97 struct CacheDB::Stats
&Stats
;
100 inline bool ReadOverride(string File
) {return Over
.ReadOverride(File
);};
101 inline bool ReadExtraOverride(string File
)
102 {return Over
.ReadExtraOverride(File
);};
103 virtual bool DoPackage(string FileName
);
105 PackagesWriter(string DB
,string Overrides
,string ExtOverrides
=string(),
106 string Arch
=string());
107 virtual ~PackagesWriter() {};
110 class ContentsWriter
: public FTWScanner
120 struct CacheDB::Stats
&Stats
;
123 bool DoPackage(string FileName
,string Package
);
124 virtual bool DoPackage(string FileName
)
125 {return DoPackage(FileName
,string());};
126 bool ReadFromPkgs(string PkgFile
,string PkgCompress
);
128 void Finish() {Gen
.Print(Output
);};
129 inline bool ReadyDB(string DB
) {return Db
.ReadyDB(DB
);};
131 ContentsWriter(string DB
);
132 virtual ~ContentsWriter() {};
135 class SourcesWriter
: public FTWScanner
140 unsigned long BufSize
;
150 struct CacheDB::Stats Stats
;
152 virtual bool DoPackage(string FileName
);
154 SourcesWriter(string BOverrides
,string SOverrides
,
155 string ExtOverrides
=string());
156 virtual ~SourcesWriter() {free(Buffer
);};
159 class ReleaseWriter
: public FTWScanner
162 ReleaseWriter(string DB
);
163 virtual bool DoPackage(string FileName
);
177 // Limited by FileFd::Size()
181 map
<string
,struct CheckSum
> CheckSums
;