]>
git.saurik.com Git - apt-legacy.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 ##################################################################### */
25 #include "apt-ftparchive.h"
36 vector
<string
> Patterns
;
37 const char *OriginalPath
;
40 // Stuff for the delinker
43 static FTWScanner
*Owner
;
44 static int ScannerFTW(const char *File
,const struct stat
*sb
,int Flag
);
45 static int ScannerFile(const char *File
, bool ReadLink
);
47 bool Delink(string
&FileName
,const char *OriginalPath
,
48 unsigned long &Bytes
,off_t FileSize
);
50 inline void NewLine(unsigned Priority
)
52 if (ErrorPrinted
== false && Quiet
<= Priority
)
61 unsigned long DeLinkLimit
;
62 string InternalPrefix
;
64 virtual bool DoPackage(string FileName
) = 0;
65 bool RecursiveScan(string Dir
);
66 bool LoadFileList(string BaseDir
,string File
);
67 void ClearPatterns() { Patterns
.clear(); };
68 void AddPattern(string Pattern
) { Patterns
.push_back(Pattern
); };
69 bool SetExts(string Vals
);
74 class PackagesWriter
: public FTWScanner
93 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 string Arch
=string());
103 virtual ~PackagesWriter() {};
106 class ContentsWriter
: public FTWScanner
116 struct CacheDB::Stats
&Stats
;
119 bool DoPackage(string FileName
,string Package
);
120 virtual bool DoPackage(string FileName
)
121 {return DoPackage(FileName
,string());};
122 bool ReadFromPkgs(string PkgFile
,string PkgCompress
);
124 void Finish() {Gen
.Print(Output
);};
125 inline bool ReadyDB(string DB
) {return Db
.ReadyDB(DB
);};
127 ContentsWriter(string DB
);
128 virtual ~ContentsWriter() {};
131 class SourcesWriter
: public FTWScanner
136 unsigned long BufSize
;
146 struct CacheDB::Stats Stats
;
148 virtual bool DoPackage(string FileName
);
150 SourcesWriter(string BOverrides
,string SOverrides
,
151 string ExtOverrides
=string());
152 virtual ~SourcesWriter() {free(Buffer
);};
155 class ReleaseWriter
: public FTWScanner
158 ReleaseWriter(string DB
);
159 virtual bool DoPackage(string FileName
);
173 // Limited by FileFd::Size()
177 map
<string
,struct CheckSum
> CheckSums
;